From 9c05a1f734989aed7702555aefd64a3585c9a6a2 Mon Sep 17 00:00:00 2001 From: Mike Seiler Date: Thu, 4 May 2023 23:50:07 -1000 Subject: [PATCH] chain errors using xerrors.Errorf --- chain/messagepool/check.go | 6 ++---- chain/messagepool/messagepool.go | 9 +++------ 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/chain/messagepool/check.go b/chain/messagepool/check.go index a20215786..17829057a 100644 --- a/chain/messagepool/check.go +++ b/chain/messagepool/check.go @@ -70,8 +70,7 @@ func (mp *MessagePool) CheckReplaceMessages(ctx context.Context, replace []*type msgMap[m.From] = mmap mset, ok, err := mp.getPendingMset(ctx, m.From) if err != nil { - log.Warnf("errored while getting pending mset: %w", err) - return nil, err + return nil, xerrors.Errorf("errored while getting pending mset: %w", err) } if ok { count += len(mset.msgs) @@ -154,8 +153,7 @@ func (mp *MessagePool) checkMessages(ctx context.Context, msgs []*types.Message, mp.lk.RLock() mset, ok, err := mp.getPendingMset(ctx, m.From) if err != nil { - log.Warnf("errored while getting pending mset: %w", err) - return nil, err + return nil, xerrors.Errorf("errored while getting pending mset: %w", err) } if ok && !interned { st = &actorState{nextNonce: mset.nextNonce, requiredFunds: mset.requiredFunds} diff --git a/chain/messagepool/messagepool.go b/chain/messagepool/messagepool.go index 4dcb6eb9b..81a65dd06 100644 --- a/chain/messagepool/messagepool.go +++ b/chain/messagepool/messagepool.go @@ -749,8 +749,7 @@ func (mp *MessagePool) checkMessage(ctx context.Context, m *types.SignedMessage) } if err := mp.VerifyMsgSig(m); err != nil { - log.Warnf("signature verification failed: %s", err) - return err + return xerrors.Errorf("signature verification failed: %s", err) } return nil @@ -969,13 +968,11 @@ func (mp *MessagePool) addLocked(ctx context.Context, m *types.SignedMessage, st } if _, err := mp.api.PutMessage(ctx, m); err != nil { - log.Warnf("mpooladd cs.PutMessage failed: %s", err) - return err + return xerrors.Errorf("mpooladd cs.PutMessage failed: %s", err) } if _, err := mp.api.PutMessage(ctx, &m.Message); err != nil { - log.Warnf("mpooladd cs.PutMessage failed: %s", err) - return err + return xerrors.Errorf("mpooladd cs.PutMessage failed: %s", err) } // Note: If performance becomes an issue, making this getOrCreatePendingMset will save some work