feat: slasher: print error on failure

This commit is contained in:
Aayush 2023-06-13 10:21:48 -04:00
parent 1358d70128
commit 4cfdf8e83c

View File

@ -406,7 +406,7 @@ var DaemonCmd = &cli.Command{
go func() { go func() {
err := slashConsensus(api, cctx.String("slashdb-dir"), cctx.String("slasher-sender")) err := slashConsensus(api, cctx.String("slashdb-dir"), cctx.String("slasher-sender"))
if err != nil { if err != nil {
panic("slashConsensus error") panic("slashConsensus error: " + err.Error())
} }
}() }()
} }
@ -697,15 +697,19 @@ func slashFilterMinedBlock(ctx context.Context, sf *slashfilter.SlashFilter, a l
if err != nil { if err != nil {
return nil, nil, xerrors.Errorf("chain get block error:%s", err) return nil, nil, xerrors.Errorf("chain get block error:%s", err)
} }
otherCid, err := sf.MinedBlock(ctx, blockB, blockC.Height) otherCid, err := sf.MinedBlock(ctx, blockB, blockC.Height)
if err != nil { if err != nil {
return nil, nil, xerrors.Errorf("slash filter check block error:%s", err) return nil, nil, xerrors.Errorf("slash filter check block error:%s", err)
} }
if otherCid != cid.Undef { if otherCid != cid.Undef {
otherHeader, err := a.ChainGetBlock(ctx, otherCid) otherHeader, err := a.ChainGetBlock(ctx, otherCid)
return otherHeader, nil, xerrors.Errorf("chain get other block error:%s", err) return otherHeader, nil, xerrors.Errorf("chain get other block error:%s", err)
} }
blockA, err := a.ChainGetBlock(ctx, otherCid) blockA, err := a.ChainGetBlock(ctx, otherCid)
if
// (c) parent-grinding fault // (c) parent-grinding fault
// Here extra is the "witness", a third block that shows the connection between A and B as // Here extra is the "witness", a third block that shows the connection between A and B as