@ -164,7 +164,7 @@ func setupPoolWithConfig(config *params.ChainConfig) (*LegacyPool, *ecdsa.Privat
key , _ := crypto . GenerateKey ( )
pool := New ( testTxPoolConfig , blockchain )
if err := pool . Init ( new ( big . Int ) . SetUint64 ( testTxPoolConfig . PriceLimit ) , blockchain . CurrentBlock ( ) , makeAddressReserver ( ) ) ; err != nil {
if err := pool . Init ( testTxPoolConfig . PriceLimit , blockchain . CurrentBlock ( ) , makeAddressReserver ( ) ) ; err != nil {
panic ( err )
}
// wait for the pool to initialize
@ -199,9 +199,6 @@ func validatePoolInternals(pool *LegacyPool) error {
if nonce := pool . pendingNonces . get ( addr ) ; nonce != last + 1 {
return fmt . Errorf ( "pending nonce mismatch: have %v, want %v" , nonce , last + 1 )
}
if txs . totalcost . Cmp ( common . Big0 ) < 0 {
return fmt . Errorf ( "totalcost went negative: %v" , txs . totalcost )
}
}
return nil
}
@ -283,7 +280,7 @@ func TestStateChangeDuringReset(t *testing.T) {
tx1 := transaction ( 1 , 100000 , key )
pool := New ( testTxPoolConfig , blockchain )
pool . Init ( new ( big . Int ) . SetUint64 ( testTxPoolConfig . PriceLimit ) , blockchain . CurrentBlock ( ) , makeAddressReserver ( ) )
pool . Init ( testTxPoolConfig . PriceLimit , blockchain . CurrentBlock ( ) , makeAddressReserver ( ) )
defer pool . Close ( )
nonce := pool . Nonce ( address )
@ -349,7 +346,7 @@ func TestInvalidTransactions(t *testing.T) {
}
tx = transaction ( 1 , 100000 , key )
pool . gasTip . Store ( big . NewInt ( 1000 ) )
pool . gasTip . Store ( uint256 . NewInt ( 1000 ) )
if err , want := pool . addRemote ( tx ) , txpool . ErrUnderpriced ; ! errors . Is ( err , want ) {
t . Errorf ( "want %v have %v" , want , err )
}
@ -703,7 +700,7 @@ func TestPostponing(t *testing.T) {
blockchain := newTestBlockChain ( params . TestChainConfig , 1000000 , statedb , new ( event . Feed ) )
pool := New ( testTxPoolConfig , blockchain )
pool . Init ( new ( big . Int ) . SetUint64 ( testTxPoolConfig . PriceLimit ) , blockchain . CurrentBlock ( ) , makeAddressReserver ( ) )
pool . Init ( testTxPoolConfig . PriceLimit , blockchain . CurrentBlock ( ) , makeAddressReserver ( ) )
defer pool . Close ( )
// Create two test accounts to produce different gap profiles with
@ -920,7 +917,7 @@ func testQueueGlobalLimiting(t *testing.T, nolocals bool) {
config . GlobalQueue = config . AccountQueue * 3 - 1 // reduce the queue limits to shorten test time (-1 to make it non divisible)
pool := New ( config , blockchain )
pool . Init ( new ( big . Int ) . SetUint64 ( testTxPoolConfig . PriceLimit ) , blockchain . CurrentBlock ( ) , makeAddressReserver ( ) )
pool . Init ( testTxPoolConfig . PriceLimit , blockchain . CurrentBlock ( ) , makeAddressReserver ( ) )
defer pool . Close ( )
// Create a number of test accounts and fund them (last one will be the local)
@ -1013,7 +1010,7 @@ func testQueueTimeLimiting(t *testing.T, nolocals bool) {
config . NoLocals = nolocals
pool := New ( config , blockchain )
pool . Init ( new ( big . Int ) . SetUint64 ( config . PriceLimit ) , blockchain . CurrentBlock ( ) , makeAddressReserver ( ) )
pool . Init ( config . PriceLimit , blockchain . CurrentBlock ( ) , makeAddressReserver ( ) )
defer pool . Close ( )
// Create two test accounts to ensure remotes expire but locals do not
@ -1198,7 +1195,7 @@ func TestPendingGlobalLimiting(t *testing.T) {
config . GlobalSlots = config . AccountSlots * 10
pool := New ( config , blockchain )
pool . Init ( new ( big . Int ) . SetUint64 ( config . PriceLimit ) , blockchain . CurrentBlock ( ) , makeAddressReserver ( ) )
pool . Init ( config . PriceLimit , blockchain . CurrentBlock ( ) , makeAddressReserver ( ) )
defer pool . Close ( )
// Create a number of test accounts and fund them
@ -1302,7 +1299,7 @@ func TestCapClearsFromAll(t *testing.T) {
config . GlobalSlots = 8
pool := New ( config , blockchain )
pool . Init ( new ( big . Int ) . SetUint64 ( config . PriceLimit ) , blockchain . CurrentBlock ( ) , makeAddressReserver ( ) )
pool . Init ( config . PriceLimit , blockchain . CurrentBlock ( ) , makeAddressReserver ( ) )
defer pool . Close ( )
// Create a number of test accounts and fund them
@ -1335,7 +1332,7 @@ func TestPendingMinimumAllowance(t *testing.T) {
config . GlobalSlots = 1
pool := New ( config , blockchain )
pool . Init ( new ( big . Int ) . SetUint64 ( config . PriceLimit ) , blockchain . CurrentBlock ( ) , makeAddressReserver ( ) )
pool . Init ( config . PriceLimit , blockchain . CurrentBlock ( ) , makeAddressReserver ( ) )
defer pool . Close ( )
// Create a number of test accounts and fund them
@ -1381,7 +1378,7 @@ func TestRepricing(t *testing.T) {
blockchain := newTestBlockChain ( params . TestChainConfig , 1000000 , statedb , new ( event . Feed ) )
pool := New ( testTxPoolConfig , blockchain )
pool . Init ( new ( big . Int ) . SetUint64 ( testTxPoolConfig . PriceLimit ) , blockchain . CurrentBlock ( ) , makeAddressReserver ( ) )
pool . Init ( testTxPoolConfig . PriceLimit , blockchain . CurrentBlock ( ) , makeAddressReserver ( ) )
defer pool . Close ( )
// Keep track of transaction events to ensure all executables get announced
@ -1503,7 +1500,7 @@ func TestMinGasPriceEnforced(t *testing.T) {
txPoolConfig := DefaultConfig
txPoolConfig . NoLocals = true
pool := New ( txPoolConfig , blockchain )
pool . Init ( new ( big . Int ) . SetUint64 ( txPoolConfig . PriceLimit ) , blockchain . CurrentBlock ( ) , makeAddressReserver ( ) )
pool . Init ( txPoolConfig . PriceLimit , blockchain . CurrentBlock ( ) , makeAddressReserver ( ) )
defer pool . Close ( )
key , _ := crypto . GenerateKey ( )
@ -1674,7 +1671,7 @@ func TestRepricingKeepsLocals(t *testing.T) {
blockchain := newTestBlockChain ( eip1559Config , 1000000 , statedb , new ( event . Feed ) )
pool := New ( testTxPoolConfig , blockchain )
pool . Init ( new ( big . Int ) . SetUint64 ( testTxPoolConfig . PriceLimit ) , blockchain . CurrentBlock ( ) , makeAddressReserver ( ) )
pool . Init ( testTxPoolConfig . PriceLimit , blockchain . CurrentBlock ( ) , makeAddressReserver ( ) )
defer pool . Close ( )
// Create a number of test accounts and fund them
@ -1752,7 +1749,7 @@ func TestUnderpricing(t *testing.T) {
config . GlobalQueue = 2
pool := New ( config , blockchain )
pool . Init ( new ( big . Int ) . SetUint64 ( config . PriceLimit ) , blockchain . CurrentBlock ( ) , makeAddressReserver ( ) )
pool . Init ( config . PriceLimit , blockchain . CurrentBlock ( ) , makeAddressReserver ( ) )
defer pool . Close ( )
// Keep track of transaction events to ensure all executables get announced
@ -1867,7 +1864,7 @@ func TestStableUnderpricing(t *testing.T) {
config . GlobalQueue = 0
pool := New ( config , blockchain )
pool . Init ( new ( big . Int ) . SetUint64 ( config . PriceLimit ) , blockchain . CurrentBlock ( ) , makeAddressReserver ( ) )
pool . Init ( config . PriceLimit , blockchain . CurrentBlock ( ) , makeAddressReserver ( ) )
defer pool . Close ( )
// Keep track of transaction events to ensure all executables get announced
@ -2096,7 +2093,7 @@ func TestDeduplication(t *testing.T) {
blockchain := newTestBlockChain ( params . TestChainConfig , 1000000 , statedb , new ( event . Feed ) )
pool := New ( testTxPoolConfig , blockchain )
pool . Init ( new ( big . Int ) . SetUint64 ( testTxPoolConfig . PriceLimit ) , blockchain . CurrentBlock ( ) , makeAddressReserver ( ) )
pool . Init ( testTxPoolConfig . PriceLimit , blockchain . CurrentBlock ( ) , makeAddressReserver ( ) )
defer pool . Close ( )
// Create a test account to add transactions with
@ -2163,7 +2160,7 @@ func TestReplacement(t *testing.T) {
blockchain := newTestBlockChain ( params . TestChainConfig , 1000000 , statedb , new ( event . Feed ) )
pool := New ( testTxPoolConfig , blockchain )
pool . Init ( new ( big . Int ) . SetUint64 ( testTxPoolConfig . PriceLimit ) , blockchain . CurrentBlock ( ) , makeAddressReserver ( ) )
pool . Init ( testTxPoolConfig . PriceLimit , blockchain . CurrentBlock ( ) , makeAddressReserver ( ) )
defer pool . Close ( )
// Keep track of transaction events to ensure all executables get announced
@ -2374,7 +2371,7 @@ func testJournaling(t *testing.T, nolocals bool) {
config . Rejournal = time . Second
pool := New ( config , blockchain )
pool . Init ( new ( big . Int ) . SetUint64 ( config . PriceLimit ) , blockchain . CurrentBlock ( ) , makeAddressReserver ( ) )
pool . Init ( config . PriceLimit , blockchain . CurrentBlock ( ) , makeAddressReserver ( ) )
// Create two test accounts to ensure remotes expire but locals do not
local , _ := crypto . GenerateKey ( )
@ -2412,7 +2409,7 @@ func testJournaling(t *testing.T, nolocals bool) {
blockchain = newTestBlockChain ( params . TestChainConfig , 1000000 , statedb , new ( event . Feed ) )
pool = New ( config , blockchain )
pool . Init ( new ( big . Int ) . SetUint64 ( config . PriceLimit ) , blockchain . CurrentBlock ( ) , makeAddressReserver ( ) )
pool . Init ( config . PriceLimit , blockchain . CurrentBlock ( ) , makeAddressReserver ( ) )
pending , queued = pool . Stats ( )
if queued != 0 {
@ -2439,7 +2436,7 @@ func testJournaling(t *testing.T, nolocals bool) {
statedb . SetNonce ( crypto . PubkeyToAddress ( local . PublicKey ) , 1 )
blockchain = newTestBlockChain ( params . TestChainConfig , 1000000 , statedb , new ( event . Feed ) )
pool = New ( config , blockchain )
pool . Init ( new ( big . Int ) . SetUint64 ( config . PriceLimit ) , blockchain . CurrentBlock ( ) , makeAddressReserver ( ) )
pool . Init ( config . PriceLimit , blockchain . CurrentBlock ( ) , makeAddressReserver ( ) )
pending , queued = pool . Stats ( )
if pending != 0 {
@ -2470,7 +2467,7 @@ func TestStatusCheck(t *testing.T) {
blockchain := newTestBlockChain ( params . TestChainConfig , 1000000 , statedb , new ( event . Feed ) )
pool := New ( testTxPoolConfig , blockchain )
pool . Init ( new ( big . Int ) . SetUint64 ( testTxPoolConfig . PriceLimit ) , blockchain . CurrentBlock ( ) , makeAddressReserver ( ) )
pool . Init ( testTxPoolConfig . PriceLimit , blockchain . CurrentBlock ( ) , makeAddressReserver ( ) )
defer pool . Close ( )
// Create the test accounts to check various transaction statuses with