@@ -78,8 +78,7 @@ func pricedTransaction(nonce uint64, gaslimit uint64, gasprice *big.Int, key *ec
78
78
}
79
79
80
80
func setupTxPool () (* TxPool , * ecdsa.PrivateKey ) {
81
- diskdb := ethdb .NewMemDatabase ()
82
- statedb , _ := state .New (common.Hash {}, state .NewDatabase (diskdb ))
81
+ statedb , _ := state .New (common.Hash {}, state .NewDatabase (ethdb .NewMemDatabase ()))
83
82
blockchain := & testBlockChain {statedb , 1000000 , new (event.Feed )}
84
83
85
84
key , _ := crypto .GenerateKey ()
@@ -158,8 +157,7 @@ func (c *testChain) State() (*state.StateDB, error) {
158
157
// a state change between those fetches.
159
158
stdb := c .statedb
160
159
if * c .trigger {
161
- db := ethdb .NewMemDatabase ()
162
- c .statedb , _ = state .New (common.Hash {}, state .NewDatabase (db ))
160
+ c .statedb , _ = state .New (common.Hash {}, state .NewDatabase (ethdb .NewMemDatabase ()))
163
161
// simulate that the new head block included tx0 and tx1
164
162
c .statedb .SetNonce (c .address , 2 )
165
163
c .statedb .SetBalance (c .address , new (big.Int ).SetUint64 (params .Ether ))
@@ -175,10 +173,9 @@ func TestStateChangeDuringTransactionPoolReset(t *testing.T) {
175
173
t .Parallel ()
176
174
177
175
var (
178
- db = ethdb .NewMemDatabase ()
179
176
key , _ = crypto .GenerateKey ()
180
177
address = crypto .PubkeyToAddress (key .PublicKey )
181
- statedb , _ = state .New (common.Hash {}, state .NewDatabase (db ))
178
+ statedb , _ = state .New (common.Hash {}, state .NewDatabase (ethdb . NewMemDatabase () ))
182
179
trigger = false
183
180
)
184
181
@@ -332,8 +329,7 @@ func TestTransactionChainFork(t *testing.T) {
332
329
333
330
addr := crypto .PubkeyToAddress (key .PublicKey )
334
331
resetState := func () {
335
- db := ethdb .NewMemDatabase ()
336
- statedb , _ := state .New (common.Hash {}, state .NewDatabase (db ))
332
+ statedb , _ := state .New (common.Hash {}, state .NewDatabase (ethdb .NewMemDatabase ()))
337
333
statedb .AddBalance (addr , big .NewInt (100000000000000 ))
338
334
339
335
pool .chain = & testBlockChain {statedb , 1000000 , new (event.Feed )}
@@ -362,8 +358,7 @@ func TestTransactionDoubleNonce(t *testing.T) {
362
358
363
359
addr := crypto .PubkeyToAddress (key .PublicKey )
364
360
resetState := func () {
365
- db := ethdb .NewMemDatabase ()
366
- statedb , _ := state .New (common.Hash {}, state .NewDatabase (db ))
361
+ statedb , _ := state .New (common.Hash {}, state .NewDatabase (ethdb .NewMemDatabase ()))
367
362
statedb .AddBalance (addr , big .NewInt (100000000000000 ))
368
363
369
364
pool .chain = & testBlockChain {statedb , 1000000 , new (event.Feed )}
@@ -553,8 +548,7 @@ func TestTransactionPostponing(t *testing.T) {
553
548
t .Parallel ()
554
549
555
550
// Create the pool to test the postponing with
556
- db := ethdb .NewMemDatabase ()
557
- statedb , _ := state .New (common.Hash {}, state .NewDatabase (db ))
551
+ statedb , _ := state .New (common.Hash {}, state .NewDatabase (ethdb .NewMemDatabase ()))
558
552
blockchain := & testBlockChain {statedb , 1000000 , new (event.Feed )}
559
553
560
554
pool := NewTxPool (testTxPoolConfig , params .TestChainConfig , blockchain )
@@ -769,8 +763,7 @@ func testTransactionQueueGlobalLimiting(t *testing.T, nolocals bool) {
769
763
t .Parallel ()
770
764
771
765
// Create the pool to test the limit enforcement with
772
- db := ethdb .NewMemDatabase ()
773
- statedb , _ := state .New (common.Hash {}, state .NewDatabase (db ))
766
+ statedb , _ := state .New (common.Hash {}, state .NewDatabase (ethdb .NewMemDatabase ()))
774
767
blockchain := & testBlockChain {statedb , 1000000 , new (event.Feed )}
775
768
776
769
config := testTxPoolConfig
@@ -858,8 +851,7 @@ func testTransactionQueueTimeLimiting(t *testing.T, nolocals bool) {
858
851
evictionInterval = time .Second
859
852
860
853
// Create the pool to test the non-expiration enforcement
861
- db := ethdb .NewMemDatabase ()
862
- statedb , _ := state .New (common.Hash {}, state .NewDatabase (db ))
854
+ statedb , _ := state .New (common.Hash {}, state .NewDatabase (ethdb .NewMemDatabase ()))
863
855
blockchain := & testBlockChain {statedb , 1000000 , new (event.Feed )}
864
856
865
857
config := testTxPoolConfig
@@ -1013,8 +1005,7 @@ func TestTransactionPendingGlobalLimiting(t *testing.T) {
1013
1005
t .Parallel ()
1014
1006
1015
1007
// Create the pool to test the limit enforcement with
1016
- db := ethdb .NewMemDatabase ()
1017
- statedb , _ := state .New (common.Hash {}, state .NewDatabase (db ))
1008
+ statedb , _ := state .New (common.Hash {}, state .NewDatabase (ethdb .NewMemDatabase ()))
1018
1009
blockchain := & testBlockChain {statedb , 1000000 , new (event.Feed )}
1019
1010
1020
1011
config := testTxPoolConfig
@@ -1060,8 +1051,7 @@ func TestTransactionCapClearsFromAll(t *testing.T) {
1060
1051
t .Parallel ()
1061
1052
1062
1053
// Create the pool to test the limit enforcement with
1063
- db := ethdb .NewMemDatabase ()
1064
- statedb , _ := state .New (common.Hash {}, state .NewDatabase (db ))
1054
+ statedb , _ := state .New (common.Hash {}, state .NewDatabase (ethdb .NewMemDatabase ()))
1065
1055
blockchain := & testBlockChain {statedb , 1000000 , new (event.Feed )}
1066
1056
1067
1057
config := testTxPoolConfig
@@ -1095,8 +1085,7 @@ func TestTransactionPendingMinimumAllowance(t *testing.T) {
1095
1085
t .Parallel ()
1096
1086
1097
1087
// Create the pool to test the limit enforcement with
1098
- db := ethdb .NewMemDatabase ()
1099
- statedb , _ := state .New (common.Hash {}, state .NewDatabase (db ))
1088
+ statedb , _ := state .New (common.Hash {}, state .NewDatabase (ethdb .NewMemDatabase ()))
1100
1089
blockchain := & testBlockChain {statedb , 1000000 , new (event.Feed )}
1101
1090
1102
1091
config := testTxPoolConfig
@@ -1144,8 +1133,7 @@ func TestTransactionPoolRepricing(t *testing.T) {
1144
1133
t .Parallel ()
1145
1134
1146
1135
// Create the pool to test the pricing enforcement with
1147
- db := ethdb .NewMemDatabase ()
1148
- statedb , _ := state .New (common.Hash {}, state .NewDatabase (db ))
1136
+ statedb , _ := state .New (common.Hash {}, state .NewDatabase (ethdb .NewMemDatabase ()))
1149
1137
blockchain := & testBlockChain {statedb , 1000000 , new (event.Feed )}
1150
1138
1151
1139
pool := NewTxPool (testTxPoolConfig , params .TestChainConfig , blockchain )
@@ -1266,8 +1254,7 @@ func TestTransactionPoolRepricingKeepsLocals(t *testing.T) {
1266
1254
t .Parallel ()
1267
1255
1268
1256
// Create the pool to test the pricing enforcement with
1269
- db := ethdb .NewMemDatabase ()
1270
- statedb , _ := state .New (common.Hash {}, state .NewDatabase (db ))
1257
+ statedb , _ := state .New (common.Hash {}, state .NewDatabase (ethdb .NewMemDatabase ()))
1271
1258
blockchain := & testBlockChain {statedb , 1000000 , new (event.Feed )}
1272
1259
1273
1260
pool := NewTxPool (testTxPoolConfig , params .TestChainConfig , blockchain )
@@ -1329,8 +1316,7 @@ func TestTransactionPoolUnderpricing(t *testing.T) {
1329
1316
t .Parallel ()
1330
1317
1331
1318
// Create the pool to test the pricing enforcement with
1332
- db := ethdb .NewMemDatabase ()
1333
- statedb , _ := state .New (common.Hash {}, state .NewDatabase (db ))
1319
+ statedb , _ := state .New (common.Hash {}, state .NewDatabase (ethdb .NewMemDatabase ()))
1334
1320
blockchain := & testBlockChain {statedb , 1000000 , new (event.Feed )}
1335
1321
1336
1322
config := testTxPoolConfig
@@ -1436,8 +1422,7 @@ func TestTransactionPoolStableUnderpricing(t *testing.T) {
1436
1422
t .Parallel ()
1437
1423
1438
1424
// Create the pool to test the pricing enforcement with
1439
- db := ethdb .NewMemDatabase ()
1440
- statedb , _ := state .New (common.Hash {}, state .NewDatabase (db ))
1425
+ statedb , _ := state .New (common.Hash {}, state .NewDatabase (ethdb .NewMemDatabase ()))
1441
1426
blockchain := & testBlockChain {statedb , 1000000 , new (event.Feed )}
1442
1427
1443
1428
config := testTxPoolConfig
@@ -1503,8 +1488,7 @@ func TestTransactionReplacement(t *testing.T) {
1503
1488
t .Parallel ()
1504
1489
1505
1490
// Create the pool to test the pricing enforcement with
1506
- db := ethdb .NewMemDatabase ()
1507
- statedb , _ := state .New (common.Hash {}, state .NewDatabase (db ))
1491
+ statedb , _ := state .New (common.Hash {}, state .NewDatabase (ethdb .NewMemDatabase ()))
1508
1492
blockchain := & testBlockChain {statedb , 1000000 , new (event.Feed )}
1509
1493
1510
1494
pool := NewTxPool (testTxPoolConfig , params .TestChainConfig , blockchain )
@@ -1598,8 +1582,7 @@ func testTransactionJournaling(t *testing.T, nolocals bool) {
1598
1582
os .Remove (journal )
1599
1583
1600
1584
// Create the original pool to inject transaction into the journal
1601
- db := ethdb .NewMemDatabase ()
1602
- statedb , _ := state .New (common.Hash {}, state .NewDatabase (db ))
1585
+ statedb , _ := state .New (common.Hash {}, state .NewDatabase (ethdb .NewMemDatabase ()))
1603
1586
blockchain := & testBlockChain {statedb , 1000000 , new (event.Feed )}
1604
1587
1605
1588
config := testTxPoolConfig
@@ -1697,8 +1680,7 @@ func TestTransactionStatusCheck(t *testing.T) {
1697
1680
t .Parallel ()
1698
1681
1699
1682
// Create the pool to test the status retrievals with
1700
- db := ethdb .NewMemDatabase ()
1701
- statedb , _ := state .New (common.Hash {}, state .NewDatabase (db ))
1683
+ statedb , _ := state .New (common.Hash {}, state .NewDatabase (ethdb .NewMemDatabase ()))
1702
1684
blockchain := & testBlockChain {statedb , 1000000 , new (event.Feed )}
1703
1685
1704
1686
pool := NewTxPool (testTxPoolConfig , params .TestChainConfig , blockchain )
0 commit comments