From de995ca0c00c12bc76ab31c29e7aaeaf95335152 Mon Sep 17 00:00:00 2001 From: "alex.sharov" Date: Sat, 28 Aug 2021 14:19:47 +0700 Subject: [PATCH] add state check assert routine --- txpool/pool.go | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/txpool/pool.go b/txpool/pool.go index 22b1d58cc..95b6c057a 100644 --- a/txpool/pool.go +++ b/txpool/pool.go @@ -220,9 +220,11 @@ func (sc *SendersCache) onNewTxs(tx kv.Tx, newTxs TxSlots) (cacheMisses map[uint if err != nil { return nil, err } - if len(cacheMisses) > 0 { - for i, j := range cacheMisses { - fmt.Printf("cache misses: %d,%x\n", i, j) + if ASSERT { + if len(cacheMisses) > 0 { + for i, j := range cacheMisses { + fmt.Printf("cache misses: %d,%x\n", i, j) + } } } return cacheMisses, nil @@ -1449,6 +1451,9 @@ func unsafeAddToPendingPool(byNonce *ByNonce, newTxs TxSlots, pending, baseFee, } func onSenderChange(senderID uint64, sender *senderInfo, byNonce *ByNonce, protocolBaseFee, pendingBaseFee uint64) { + if ASSERT && sender == nil { + fmt.Printf("nil sender info: %d\n", senderID) + } noGapsNonce := sender.nonce + 1 cumulativeRequiredBalance := uint256.NewInt(0) minFeeCap := uint64(math.MaxUint64)