From dbf9235c10c8ccc6bdd5061eb129696a36af5172 Mon Sep 17 00:00:00 2001 From: Csaba Kiraly Date: Tue, 24 Feb 2026 12:00:00 +0100 Subject: [PATCH] core/txpool/blobpool: add extra underpriced test Signed-off-by: Csaba Kiraly --- core/txpool/blobpool/blobpool_test.go | 42 +++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/core/txpool/blobpool/blobpool_test.go b/core/txpool/blobpool/blobpool_test.go index 97bbe9a5ce..642fbb5102 100644 --- a/core/txpool/blobpool/blobpool_test.go +++ b/core/txpool/blobpool/blobpool_test.go @@ -1734,6 +1734,48 @@ func TestAdd(t *testing.T) { }, }, }, + // Transactions above the Datacap should be rejected, use eviction values + { + seeds: map[string]seed{ + "alice": { + balance: 2000000, + //nonce: 1, + txs: []*types.BlobTx{ + makeUnsignedTxWithTestBlob(0, 2, 2, 2, 0), + makeUnsignedTxWithTestBlob(1, 2, 2, 2, 1), + }, + }, + "bob": { + balance: 1000000, + //nonce: 1, + txs: []*types.BlobTx{ + makeUnsignedTxWithTestBlob(0, 3, 3, 3, 2), + }, + }, + }, + datacap: 3 * (txAvgSize + blobSize + uint64(txBlobOverhead)), // only allow 2 blobs + adds: []addtx{ + { // Beyond capacity, but kicking out one from Alice should make it fit + from: "bob", + tx: makeUnsignedTxWithTestBlob(1, 3, 3, 3, 3), + }, + { // We've just kicked our nonce 1, so this is nonce too high + from: "alice", + tx: makeUnsignedTxWithTestBlob(2, 1, 2, 2, 4), + err: core.ErrNonceTooHigh, + }, + { // This should not succeed, fees are low + from: "alice", + tx: makeUnsignedTxWithTestBlob(1, 1, 1, 1, 4), + err: txpool.ErrUnderpriced, + }, + { // This should also not succeed, because of rolling fee calculation + from: "alice", + tx: makeUnsignedTxWithTestBlob(1, 1, 1, 1, 4), + err: txpool.ErrUnderpriced, + }, + }, + }, } for i, tt := range tests { // Create a temporary folder for the persistent backend