Fix bad block rason if ValidateBlock fails
Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
This commit is contained in:
parent
99b5ec96a2
commit
74db060cdb
@ -30,7 +30,7 @@ func (bbr BadBlockReason) Linked(reason string, i ...interface{}) BadBlockReason
|
|||||||
if bbr.OriginalReason != nil {
|
if bbr.OriginalReason != nil {
|
||||||
or = bbr.OriginalReason
|
or = bbr.OriginalReason
|
||||||
}
|
}
|
||||||
return BadBlockReason{Reason: reason, OriginalReason: or}
|
return BadBlockReason{Reason: fmt.Sprintf(reason, i...), OriginalReason: or}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (bbr BadBlockReason) String() string {
|
func (bbr BadBlockReason) String() string {
|
||||||
|
@ -536,7 +536,7 @@ func (syncer *Syncer) ValidateTipSet(ctx context.Context, fts *store.FullTipSet)
|
|||||||
futures = append(futures, async.Err(func() error {
|
futures = append(futures, async.Err(func() error {
|
||||||
if err := syncer.ValidateBlock(ctx, b); err != nil {
|
if err := syncer.ValidateBlock(ctx, b); err != nil {
|
||||||
if isPermanent(err) {
|
if isPermanent(err) {
|
||||||
syncer.bad.Add(b.Cid(), BadBlockReason{Reason: err.Error()})
|
syncer.bad.Add(b.Cid(), NewBadBlockReason([]cid.Cid{b.Cid()}, err.Error()))
|
||||||
}
|
}
|
||||||
return xerrors.Errorf("validating block %s: %w", b.Cid(), err)
|
return xerrors.Errorf("validating block %s: %w", b.Cid(), err)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user