don't accept blocks from slashed miners
This commit is contained in:
parent
e6a08784f8
commit
8181b283c0
@ -114,7 +114,7 @@ func (sm *StateManager) computeTipSetState(ctx context.Context, blks []*types.Bl
|
|||||||
return cid.Undef, cid.Undef, xerrors.Errorf("failed to get network actor: %w", err)
|
return cid.Undef, cid.Undef, xerrors.Errorf("failed to get network actor: %w", err)
|
||||||
}
|
}
|
||||||
reward := vm.MiningReward(netact.Balance)
|
reward := vm.MiningReward(netact.Balance)
|
||||||
for _, b := range blks {
|
for tsi, b := range blks {
|
||||||
netact, err = vmi.StateTree().GetActor(actors.NetworkAddress)
|
netact, err = vmi.StateTree().GetActor(actors.NetworkAddress)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return cid.Undef, cid.Undef, xerrors.Errorf("failed to get network actor: %w", err)
|
return cid.Undef, cid.Undef, xerrors.Errorf("failed to get network actor: %w", err)
|
||||||
@ -150,7 +150,7 @@ func (sm *StateManager) computeTipSetState(ctx context.Context, blks []*types.Bl
|
|||||||
return cid.Undef, cid.Undef, xerrors.Errorf("submit election post message for block %s (miner %s) invocation failed: %w", b.Cid(), b.Miner, err)
|
return cid.Undef, cid.Undef, xerrors.Errorf("submit election post message for block %s (miner %s) invocation failed: %w", b.Cid(), b.Miner, err)
|
||||||
}
|
}
|
||||||
if ret.ExitCode != 0 {
|
if ret.ExitCode != 0 {
|
||||||
return cid.Undef, cid.Undef, xerrors.Errorf("submit election post invocation returned nonzero exit code: %d (err = %s)", ret.ExitCode, ret.ActorErr)
|
return cid.Undef, cid.Undef, xerrors.Errorf("submit election post invocation returned nonzero exit code: %d (err = %s, block = %s, miner = %s, tsi = %d)", ret.ExitCode, ret.ActorErr, b.Cid(), b.Miner, tsi)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -492,6 +492,15 @@ func (syncer *Syncer) ValidateBlock(ctx context.Context, b *types.FullBlock) err
|
|||||||
}
|
}
|
||||||
|
|
||||||
winnerCheck := async.Err(func() error {
|
winnerCheck := async.Err(func() error {
|
||||||
|
slashedAt, err := stmgr.GetMinerSlashed(ctx, syncer.sm, baseTs, h.Miner)
|
||||||
|
if err != nil {
|
||||||
|
return xerrors.Errorf("failed to check if block miner was slashed: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if slashedAt != 0 {
|
||||||
|
return xerrors.Errorf("received block was from miner slashed at height %d", slashedAt)
|
||||||
|
}
|
||||||
|
|
||||||
_, tpow, err := stmgr.GetPower(ctx, syncer.sm, baseTs, h.Miner)
|
_, tpow, err := stmgr.GetPower(ctx, syncer.sm, baseTs, h.Miner)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return xerrors.Errorf("failed getting power: %w", err)
|
return xerrors.Errorf("failed getting power: %w", err)
|
||||||
|
Loading…
Reference in New Issue
Block a user