mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-23 05:06:43 +00:00
core/txpool/blobpool: test gapped blob tx acceptance
Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com>
This commit is contained in:
parent
24b9c5dcb0
commit
3ede2631a0
1 changed files with 19 additions and 6 deletions
|
|
@ -1375,6 +1375,7 @@ func TestAdd(t *testing.T) {
|
||||||
"bob": {balance: 21100 + blobSize, nonce: 1},
|
"bob": {balance: 21100 + blobSize, nonce: 1},
|
||||||
"claire": {balance: 21100 + blobSize},
|
"claire": {balance: 21100 + blobSize},
|
||||||
"dave": {balance: 21100 + blobSize, nonce: 1},
|
"dave": {balance: 21100 + blobSize, nonce: 1},
|
||||||
|
"eve": {balance: 21100 + blobSize, nonce: 10}, // High nonce to test gapped acceptance
|
||||||
},
|
},
|
||||||
adds: []addtx{
|
adds: []addtx{
|
||||||
{ // New account, no previous txs: accept nonce 0
|
{ // New account, no previous txs: accept nonce 0
|
||||||
|
|
@ -1402,6 +1403,11 @@ func TestAdd(t *testing.T) {
|
||||||
tx: makeUnsignedTx(2, 1, 1, 1),
|
tx: makeUnsignedTx(2, 1, 1, 1),
|
||||||
err: core.ErrNonceTooHigh,
|
err: core.ErrNonceTooHigh,
|
||||||
},
|
},
|
||||||
|
{ // Old account, 10 txs in chain: 0 pending: accept nonce 11 as gapped
|
||||||
|
from: "eve",
|
||||||
|
tx: makeUnsignedTx(11, 1, 1, 1),
|
||||||
|
err: nil,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
// Transactions from already pooled accounts should only be accepted if
|
// Transactions from already pooled accounts should only be accepted if
|
||||||
|
|
@ -1762,6 +1768,12 @@ func TestAdd(t *testing.T) {
|
||||||
t.Errorf("test %d, tx %d: adding transaction error mismatch: have %v, want %v", i, j, errs[0], add.err)
|
t.Errorf("test %d, tx %d: adding transaction error mismatch: have %v, want %v", i, j, errs[0], add.err)
|
||||||
}
|
}
|
||||||
if add.err == nil {
|
if add.err == nil {
|
||||||
|
// first check if tx is in the queue
|
||||||
|
if !pool.Has(signed.Hash()) {
|
||||||
|
t.Errorf("test %d, tx %d: added transaction not found in pool", i, j)
|
||||||
|
}
|
||||||
|
// if it is pending, check if size matches
|
||||||
|
if pool.Status(signed.Hash()) == txpool.TxStatusPending {
|
||||||
size, exist := pool.lookup.sizeOfTx(signed.Hash())
|
size, exist := pool.lookup.sizeOfTx(signed.Hash())
|
||||||
if !exist {
|
if !exist {
|
||||||
t.Errorf("test %d, tx %d: failed to lookup transaction's size", i, j)
|
t.Errorf("test %d, tx %d: failed to lookup transaction's size", i, j)
|
||||||
|
|
@ -1771,6 +1783,7 @@ func TestAdd(t *testing.T) {
|
||||||
i, j, size, signed.Size())
|
i, j, size, signed.Size())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
verifyPoolInternals(t, pool)
|
verifyPoolInternals(t, pool)
|
||||||
}
|
}
|
||||||
verifyPoolInternals(t, pool)
|
verifyPoolInternals(t, pool)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue