From 05c527b6818fefa7eb08258f962bf7a73eb7062e Mon Sep 17 00:00:00 2001 From: Jakub Sztandera Date: Fri, 7 Aug 2020 02:48:53 +0200 Subject: [PATCH] Hold tipset lock while selecting messages Signed-off-by: Jakub Sztandera --- chain/messagepool/selection.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/chain/messagepool/selection.go b/chain/messagepool/selection.go index c2b954a01..27b16ae40 100644 --- a/chain/messagepool/selection.go +++ b/chain/messagepool/selection.go @@ -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) {