mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-05-31 12:08:37 +00:00
core/txpool: fix check for gapped messages
Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com>
This commit is contained in:
parent
5c1272effc
commit
daa495f775
1 changed files with 15 additions and 8 deletions
|
|
@ -1816,23 +1816,30 @@ func TestAdd(t *testing.T) {
|
||||||
// Verify the pool internals after each addition
|
// Verify the pool internals after each addition
|
||||||
verifyPoolInternals(t, pool)
|
verifyPoolInternals(t, pool)
|
||||||
// verify that if the tx was added, an event was emitted
|
// verify that if the tx was added, an event was emitted
|
||||||
if add.err == nil {
|
txStatus := pool.Status(signed.Hash())
|
||||||
select {
|
select {
|
||||||
case ev := <-txsCh:
|
case ev := <-txsCh:
|
||||||
|
switch {
|
||||||
|
case add.err == nil && txStatus == txpool.TxStatusPending:
|
||||||
if len(ev.Txs) != 1 {
|
if len(ev.Txs) != 1 {
|
||||||
t.Errorf("test %d, tx %d: event txs length mismatch: have %d, want 1", i, j, len(ev.Txs))
|
t.Errorf("test %d, tx %d: event txs length mismatch: have %d, want 1", i, j, len(ev.Txs))
|
||||||
}
|
}
|
||||||
if ev.Txs[0].Hash() != signed.Hash() {
|
if ev.Txs[0].Hash() != signed.Hash() {
|
||||||
t.Errorf("test %d, tx %d: event tx mismatch: have %v, want %v", i, j, ev.Txs[0].Hash(), signed.Hash())
|
t.Errorf("test %d, tx %d: event tx mismatch: have %v, want %v", i, j, ev.Txs[0].Hash(), signed.Hash())
|
||||||
}
|
}
|
||||||
|
case add.err == nil && txStatus == txpool.TxStatusQueued:
|
||||||
|
t.Errorf("test %d, tx %d: unexpected new tx event for queued tx", i, j)
|
||||||
|
case add.err != nil:
|
||||||
|
t.Errorf("test %d, tx %d: unexpected new tx event for failed tx", i, j)
|
||||||
default:
|
default:
|
||||||
t.Errorf("test %d, tx %d: expected new tx event, none received", i, j)
|
t.Errorf("test %d, tx %d: unexpected test result", i, j)
|
||||||
}
|
}
|
||||||
} else {
|
default:
|
||||||
select {
|
switch {
|
||||||
case ev := <-txsCh:
|
case add.err == nil && txStatus == txpool.TxStatusPending:
|
||||||
t.Errorf("test %d, tx %d: unexpected new tx event with %d txs", i, j, len(ev.Txs))
|
t.Errorf("test %d, tx %d: expected new tx event, none received", i, j)
|
||||||
default:
|
default:
|
||||||
|
// expected no event
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue