Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

style: mempool: chain errors using xerrors.Errorf #10836

Merged
merged 1 commit into from
May 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions chain/messagepool/check.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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}
Expand Down
9 changes: 3 additions & 6 deletions chain/messagepool/messagepool.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down