From 20040b6d188f7ab2e36ae66cb45d37309510c782 Mon Sep 17 00:00:00 2001 From: "alex.sharov" Date: Wed, 4 Aug 2021 10:01:52 +0700 Subject: [PATCH] packet test --- txpool/pool_fuzz_test.go | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/txpool/pool_fuzz_test.go b/txpool/pool_fuzz_test.go index 5e79088d4..04e5fa1b2 100644 --- a/txpool/pool_fuzz_test.go +++ b/txpool/pool_fuzz_test.go @@ -175,7 +175,13 @@ func FuzzOnNewBlocks3(f *testing.F) { } byHash := map[string]*MetaTx{} pending, baseFee, queued := NewSubPool(), NewSubPool(), NewSubPool() - onNewBlock(senders, txs, nil, protocolBaseFee, blockBaseFee, pending, baseFee, queued, byHash) + unwindTxs := txs + var minedTxs []*TxSlot + if len(txs) > 3 { + unwindTxs = txs[:len(txs)-3] + minedTxs = txs[len(txs)-3:] + } + onNewBlock(senders, unwindTxs, minedTxs, protocolBaseFee, blockBaseFee, pending, baseFee, queued, byHash) best, worst := pending.Best(), pending.Worst() assert.LessOrEqual(pending.Len(), PendingSubPoolLimit) @@ -276,6 +282,11 @@ func FuzzOnNewBlocks3(f *testing.F) { }) } + // mined txs must be removed + for i := range minedTxs { + _, ok = byHash[string(minedTxs[i].idHash[:])] + assert.False(ok) + } }) }