Don't use pkg/errors

License: MIT
Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
This commit is contained in:
Jakub Sztandera 2019-11-15 02:40:16 +01:00
parent ff94e7680d
commit 432706bd09
No known key found for this signature in database
GPG Key ID: 9A9AF56F8B3879BA

View File

@ -5,9 +5,10 @@ import (
"sync" "sync"
"time" "time"
"errors"
lru "github.com/hashicorp/golang-lru" lru "github.com/hashicorp/golang-lru"
pubsub "github.com/libp2p/go-libp2p-pubsub" pubsub "github.com/libp2p/go-libp2p-pubsub"
"github.com/pkg/errors"
"go.uber.org/multierr" "go.uber.org/multierr"
"golang.org/x/xerrors" "golang.org/x/xerrors"
@ -356,7 +357,7 @@ func (mp *MessagePool) HeadChange(revert []*types.TipSet, apply []*types.TipSet)
for _, b := range ts.Blocks() { for _, b := range ts.Blocks() {
bmsgs, smsgs, err := mp.sm.ChainStore().MessagesForBlock(b) bmsgs, smsgs, err := mp.sm.ChainStore().MessagesForBlock(b)
if err != nil { if err != nil {
return errors.Wrapf(err, "failed to get messages for revert block %s(height %d)", b.Cid(), b.Height) return xerrors.Errorf("failed to get messages for revert block %s(height %d): %w", b.Cid(), b.Height, err)
} }
for _, msg := range smsgs { for _, msg := range smsgs {
if err := mp.Add(msg); err != nil { if err := mp.Add(msg); err != nil {
@ -381,7 +382,7 @@ func (mp *MessagePool) HeadChange(revert []*types.TipSet, apply []*types.TipSet)
for _, b := range ts.Blocks() { for _, b := range ts.Blocks() {
bmsgs, smsgs, err := mp.sm.ChainStore().MessagesForBlock(b) bmsgs, smsgs, err := mp.sm.ChainStore().MessagesForBlock(b)
if err != nil { if err != nil {
return errors.Wrapf(err, "failed to get messages for apply block %s(height %d) (msgroot = %s)", b.Cid(), b.Height, b.Messages) return xerrors.Errorf("failed to get messages for apply block %s(height %d) (msgroot = %s): %w", b.Cid(), b.Height, b.Messages, err)
} }
for _, msg := range smsgs { for _, msg := range smsgs {
mp.Remove(msg.Message.From, msg.Message.Nonce) mp.Remove(msg.Message.From, msg.Message.Nonce)