diff --git a/txpool/pool.go b/txpool/pool.go index 5b8427bc2..360b51e0d 100644 --- a/txpool/pool.go +++ b/txpool/pool.go @@ -572,13 +572,15 @@ func (sc *SendersCache) flush(tx kv.RwTx, byNonce *ByNonce) error { if byNonce.count(binary.BigEndian.Uint64(id)) > 0 { return nil } - tx.ForEach(kv.PooledTransaction, nil, func(k, v []byte) error { - senderID := binary.BigEndian.Uint64(v[:8]) - if senderID == binary.BigEndian.Uint64(id) { - panic("why?") - } - return nil - }) + if ASSERT { + tx.ForEach(kv.PooledTransaction, nil, func(k, v []byte) error { + senderID := binary.BigEndian.Uint64(v[:8]) + if senderID == binary.BigEndian.Uint64(id) { + panic("why?") + } + return nil + }) + } if err := tx.Delete(kv.PooledSenderID, addr, nil); err != nil { return err } @@ -589,17 +591,19 @@ func (sc *SendersCache) flush(tx kv.RwTx, byNonce *ByNonce) error { return err } - tx.ForEach(kv.PooledTransaction, nil, func(k, v []byte) error { - vv, err := tx.GetOne(kv.PooledSenderIDToAdress, v[:8]) - if err != nil { - return err - } - if len(vv) == 0 { - fmt.Printf("no: %x,%x\n", id, addr) - panic("no-no") - } - return nil - }) + if ASSERT { + tx.ForEach(kv.PooledTransaction, nil, func(k, v []byte) error { + vv, err := tx.GetOne(kv.PooledSenderIDToAdress, v[:8]) + if err != nil { + return err + } + if len(vv) == 0 { + fmt.Printf("no: %x,%x\n", id, addr) + panic("no-no") + } + return nil + }) + } i++ return nil }); err != nil {