From e9f57ae77f54c53a1b74e8f40ebabceb8faa33b6 Mon Sep 17 00:00:00 2001 From: mx Date: Tue, 11 Jul 2023 16:40:28 +0800 Subject: [PATCH] feat: daemon: improvemens to the consensus slasher --- cmd/lotus/daemon.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/cmd/lotus/daemon.go b/cmd/lotus/daemon.go index 9af07b896..53d24553f 100644 --- a/cmd/lotus/daemon.go +++ b/cmd/lotus/daemon.go @@ -14,6 +14,7 @@ import ( "path" "runtime/pprof" "strings" + "time" "github.com/DataDog/zstd" levelds "github.com/ipfs/go-ds-leveldb" @@ -679,6 +680,13 @@ func slashConsensus(a lapi.FullNode, p string, from string) error { log.Errorf("could not serialize declare faults parameters: %s", err) continue } + for { + head, err := a.ChainHead(ctx) + if err != nil || head.Height() > block.Height { + break + } + time.Sleep(time.Second * 10) + } message, err := a.MpoolPushMessage(ctx, &types.Message{ To: block.Miner, From: fromAddr,