Skip to content

Commit

Permalink
Merge pull request #10836 from filecoin-project/mikers/messagepool/ni…
Browse files Browse the repository at this point in the history
…tfix2

style: mempool: chain errors using xerrors.Errorf
  • Loading branch information
arajasek authored May 5, 2023
2 parents e6c8072 + 9c05a1f commit 49e1910
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
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

0 comments on commit 49e1910

Please sign in to comment.