diff --git a/chain/messagepool/messagepool.go b/chain/messagepool/messagepool.go index 81a65dd06bc..50f64f903ab 100644 --- a/chain/messagepool/messagepool.go +++ b/chain/messagepool/messagepool.go @@ -448,12 +448,8 @@ func New(ctx context.Context, api Provider, ds dtypes.MetadataDS, us stmgr.Upgra return mp, nil } -func (mp *MessagePool) TryForEachPendingMessage(f func(cid.Cid) error) error { - // avoid deadlocks in splitstore compaction when something else needs to access the blockstore - // while holding the mpool lock - if !mp.lk.TryLock() { - return xerrors.Errorf("mpool TryForEachPendingMessage: could not acquire lock") - } +func (mp *MessagePool) ForEachPendingMessage(f func(cid.Cid) error) error { + mp.lk.Lock() defer mp.lk.Unlock() for _, mset := range mp.pending { diff --git a/node/modules/chain.go b/node/modules/chain.go index c4f6d644e9c..f91defc43c3 100644 --- a/node/modules/chain.go +++ b/node/modules/chain.go @@ -70,7 +70,7 @@ func MessagePool(lc fx.Lifecycle, mctx helpers.MetricsCtx, us stmgr.UpgradeSched return mp.Close() }, }) - protector.AddProtector(mp.TryForEachPendingMessage) + protector.AddProtector(mp.ForEachPendingMessage) return mp, nil }