From adaa3bb2ff27460b11c067d156b56c4c1f1507ef Mon Sep 17 00:00:00 2001 From: "alex.sharov" Date: Sat, 28 Aug 2021 15:02:02 +0700 Subject: [PATCH] add state check assert routine --- txpool/pool.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/txpool/pool.go b/txpool/pool.go index 59c2b3bcc..7b7640655 100644 --- a/txpool/pool.go +++ b/txpool/pool.go @@ -1782,7 +1782,7 @@ func BroadcastLoop(ctx context.Context, db kv.RwDB, coreDB kv.RoDB, p *TxPool, s if ASSERT { go func() { if err := p.forceCheckState(ctx, db, coreDB); err != nil { - log.Error("restore from db", "err", err) + log.Error("forceCheckState", "err", err) } }() } @@ -1866,6 +1866,12 @@ func (p *TxPool) forceCheckState(ctx context.Context, db, coreDB kv.RoDB) error if err != nil { return err } + if v2 == nil { + // for now skip this case because we do create + // account with 0 nonce and 0 balance for unknown senders (because + // they may become known in near future) + return nil + } if !bytes.Equal(v, v2) { return fmt.Errorf("state check failed: key=%x, local value=%x, remote value=%x\n", k, v, v2) }