Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion core/txpool/legacypool/legacypool2_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,15 @@ func fillPool(t testing.TB, pool *LegacyPool) {
// Import the batch and verify that limits have been enforced
pool.addRemotesSync(executableTxs)
pool.addRemotesSync(nonExecutableTxs)
pending, queued := pool.Stats()

// Read pending, queued, and all.Slots() under pool.mu.RLock so the three
// values are consistent: no concurrent mutation can interleave between the
// two calls because all paths that modify pool.all require pool.mu.Lock.
pool.mu.RLock()
pending, queued := pool.stats()
slots := pool.all.Slots()
pool.mu.RUnlock()

// sanity-check that the test prerequisites are ok (pending full)
if have, want := pending, slots; have != want {
t.Fatalf("have %d, want %d", have, want)
Expand Down
7 changes: 3 additions & 4 deletions core/txpool/legacypool/list_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
package legacypool

import (
"fmt"
"math/big"
"math/rand"
"testing"
Expand Down Expand Up @@ -145,14 +144,14 @@ func TestFilterTxConditionalKnownAccounts(t *testing.T) {
state.AddBalance(common.Address{19: 1}, uint256.NewInt(1000), tracing.BalanceChangeTransfer)

trie, _ := state.StorageTrie(common.Address{19: 1})
fmt.Println("before", trie)
_ = trie

state.SetState(common.Address{19: 1}, common.Hash{}, common.Hash{30: 1})

state.Finalise(true)

trie, _ = state.StorageTrie(common.Address{19: 1})
fmt.Println("after", trie.Hash())
_ = trie

tx2.PutOptions(&options)
list.Add(tx2, DefaultConfig.PriceBump)
Expand All @@ -169,7 +168,7 @@ func TestFilterTxConditionalKnownAccounts(t *testing.T) {
state.Finalise(true)

trie, _ = state.StorageTrie(common.Address{19: 1})
fmt.Println("after2", trie.Hash())
_ = trie

// tx2 should be the single transaction filtered out
drops = list.FilterTxConditional(state, header)
Expand Down
Loading