core/txpool/legacypool: fix tests

This commit is contained in:
Jared Wasinger 2025-04-09 23:55:13 +08:00
parent fada0937cb
commit 3d63770a2b

View file

@ -398,7 +398,7 @@ func TestQueue(t *testing.T) {
<-pool.requestReset(nil, nil)
pool.enqueueTx(tx.Hash(), tx, true)
<-pool.requestPromoteExecutables(newAccountSet(pool.signer, from))
<-pool.requestPromoteExecutables(&reqPromote{newAccountSet(pool.signer, from), make(chan struct{})})
if len(pool.pending) != 1 {
t.Error("expected valid txs to be 1 is", len(pool.pending))
}
@ -408,7 +408,7 @@ func TestQueue(t *testing.T) {
testSetNonce(pool, from, 2)
pool.enqueueTx(tx.Hash(), tx, true)
<-pool.requestPromoteExecutables(newAccountSet(pool.signer, from))
<-pool.requestPromoteExecutables(&reqPromote{newAccountSet(pool.signer, from), make(chan struct{})})
if _, ok := pool.pending[from].txs.items[tx.Nonce()]; ok {
t.Error("expected transaction to be in tx pool")
}
@ -547,7 +547,7 @@ func TestDoubleNonce(t *testing.T) {
if replace, err := pool.add(tx2); err != nil || !replace {
t.Errorf("second transaction insert failed (%v) or not reported replacement (%v)", err, replace)
}
<-pool.requestPromoteExecutables(newAccountSet(signer, addr))
<-pool.requestPromoteExecutables(&reqPromote{newAccountSet(signer, addr), make(chan struct{})})
if pool.pending[addr].Len() != 1 {
t.Error("expected 1 pending transactions, got", pool.pending[addr].Len())
}
@ -557,7 +557,7 @@ func TestDoubleNonce(t *testing.T) {
// Add the third transaction and ensure it's not saved (smaller price)
pool.add(tx3)
<-pool.requestPromoteExecutables(newAccountSet(signer, addr))
<-pool.requestPromoteExecutables(&reqPromote{newAccountSet(signer, addr), make(chan struct{})})
if pool.pending[addr].Len() != 1 {
t.Error("expected 1 pending transactions, got", pool.pending[addr].Len())
}