Hold tipset lock while selecting messages

Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
This commit is contained in:
Jakub Sztandera 2020-08-07 02:48:53 +02:00
parent 927f355001
commit 05c527b681
No known key found for this signature in database
GPG Key ID: 9A9AF56F8B3879BA

View File

@ -30,13 +30,12 @@ type msgChain struct {
func (mp *MessagePool) SelectMessages(ts *types.TipSet) ([]*types.SignedMessage, error) {
mp.curTsLk.Lock()
curTs := mp.curTs
mp.curTsLk.Unlock()
defer mp.curTsLk.Unlock()
mp.lk.Lock()
defer mp.lk.Unlock()
return mp.selectMessages(curTs, ts)
return mp.selectMessages(mp.curTs, ts)
}
func (mp *MessagePool) selectMessages(curTs, ts *types.TipSet) ([]*types.SignedMessage, error) {