@@ -413,7 +413,7 @@ func TestInvalidTransactions(t *testing.T) {
413
413
414
414
tx = transaction (1 , 100000 , key )
415
415
pool .gasTip .Store (uint256 .NewInt (1000 ))
416
- if err , want := pool .addRemote (tx ), txpool .ErrUnderpriced ; ! errors .Is (err , want ) {
416
+ if err , want := pool .addRemote (tx ), txpool .ErrTxGasPriceTooLow ; ! errors .Is (err , want ) {
417
417
t .Errorf ("want %v have %v" , want , err )
418
418
}
419
419
}
@@ -484,7 +484,7 @@ func TestNegativeValue(t *testing.T) {
484
484
tx , _ := types .SignTx (types .NewTransaction (0 , common.Address {}, big .NewInt (- 1 ), 100 , big .NewInt (1 ), nil ), types.HomesteadSigner {}, key )
485
485
from , _ := deriveSender (tx )
486
486
testAddBalance (pool , from , big .NewInt (1 ))
487
- if err := pool .addRemote (tx ); err != txpool .ErrNegativeValue {
487
+ if err := pool .addRemote (tx ); ! errors . Is ( err , txpool .ErrNegativeValue ) {
488
488
t .Error ("expected" , txpool .ErrNegativeValue , "got" , err )
489
489
}
490
490
}
@@ -497,7 +497,7 @@ func TestTipAboveFeeCap(t *testing.T) {
497
497
498
498
tx := dynamicFeeTx (0 , 100 , big .NewInt (1 ), big .NewInt (2 ), key )
499
499
500
- if err := pool .addRemote (tx ); err != core .ErrTipAboveFeeCap {
500
+ if err := pool .addRemote (tx ); ! errors . Is ( err , core .ErrTipAboveFeeCap ) {
501
501
t .Error ("expected" , core .ErrTipAboveFeeCap , "got" , err )
502
502
}
503
503
}
@@ -512,12 +512,12 @@ func TestVeryHighValues(t *testing.T) {
512
512
veryBigNumber .Lsh (veryBigNumber , 300 )
513
513
514
514
tx := dynamicFeeTx (0 , 100 , big .NewInt (1 ), veryBigNumber , key )
515
- if err := pool .addRemote (tx ); err != core .ErrTipVeryHigh {
515
+ if err := pool .addRemote (tx ); ! errors . Is ( err , core .ErrTipVeryHigh ) {
516
516
t .Error ("expected" , core .ErrTipVeryHigh , "got" , err )
517
517
}
518
518
519
519
tx2 := dynamicFeeTx (0 , 100 , veryBigNumber , big .NewInt (1 ), key )
520
- if err := pool .addRemote (tx2 ); err != core .ErrFeeCapVeryHigh {
520
+ if err := pool .addRemote (tx2 ); ! errors . Is ( err , core .ErrFeeCapVeryHigh ) {
521
521
t .Error ("expected" , core .ErrFeeCapVeryHigh , "got" , err )
522
522
}
523
523
}
@@ -1424,14 +1424,14 @@ func TestRepricing(t *testing.T) {
1424
1424
t .Fatalf ("pool internal state corrupted: %v" , err )
1425
1425
}
1426
1426
// Check that we can't add the old transactions back
1427
- if err := pool .addRemote (pricedTransaction (1 , 100000 , big .NewInt (1 ), keys [0 ])); ! errors .Is (err , txpool .ErrUnderpriced ) {
1428
- t .Fatalf ("adding underpriced pending transaction error mismatch: have %v, want %v" , err , txpool .ErrUnderpriced )
1427
+ if err := pool .addRemote (pricedTransaction (1 , 100000 , big .NewInt (1 ), keys [0 ])); ! errors .Is (err , txpool .ErrTxGasPriceTooLow ) {
1428
+ t .Fatalf ("adding underpriced pending transaction error mismatch: have %v, want %v" , err , txpool .ErrTxGasPriceTooLow )
1429
1429
}
1430
- if err := pool .addRemote (pricedTransaction (0 , 100000 , big .NewInt (1 ), keys [1 ])); ! errors .Is (err , txpool .ErrUnderpriced ) {
1431
- t .Fatalf ("adding underpriced pending transaction error mismatch: have %v, want %v" , err , txpool .ErrUnderpriced )
1430
+ if err := pool .addRemote (pricedTransaction (0 , 100000 , big .NewInt (1 ), keys [1 ])); ! errors .Is (err , txpool .ErrTxGasPriceTooLow ) {
1431
+ t .Fatalf ("adding underpriced pending transaction error mismatch: have %v, want %v" , err , txpool .ErrTxGasPriceTooLow )
1432
1432
}
1433
- if err := pool .addRemote (pricedTransaction (2 , 100000 , big .NewInt (1 ), keys [2 ])); ! errors .Is (err , txpool .ErrUnderpriced ) {
1434
- t .Fatalf ("adding underpriced queued transaction error mismatch: have %v, want %v" , err , txpool .ErrUnderpriced )
1433
+ if err := pool .addRemote (pricedTransaction (2 , 100000 , big .NewInt (1 ), keys [2 ])); ! errors .Is (err , txpool .ErrTxGasPriceTooLow ) {
1434
+ t .Fatalf ("adding underpriced queued transaction error mismatch: have %v, want %v" , err , txpool .ErrTxGasPriceTooLow )
1435
1435
}
1436
1436
if err := validateEvents (events , 0 ); err != nil {
1437
1437
t .Fatalf ("post-reprice event firing failed: %v" , err )
@@ -1476,14 +1476,14 @@ func TestMinGasPriceEnforced(t *testing.T) {
1476
1476
tx := pricedTransaction (0 , 100000 , big .NewInt (2 ), key )
1477
1477
pool .SetGasTip (big .NewInt (tx .GasPrice ().Int64 () + 1 ))
1478
1478
1479
- if err := pool .Add ([]* types.Transaction {tx }, true )[0 ]; ! errors .Is (err , txpool .ErrUnderpriced ) {
1479
+ if err := pool .Add ([]* types.Transaction {tx }, true )[0 ]; ! errors .Is (err , txpool .ErrTxGasPriceTooLow ) {
1480
1480
t .Fatalf ("Min tip not enforced" )
1481
1481
}
1482
1482
1483
1483
tx = dynamicFeeTx (0 , 100000 , big .NewInt (3 ), big .NewInt (2 ), key )
1484
1484
pool .SetGasTip (big .NewInt (tx .GasTipCap ().Int64 () + 1 ))
1485
1485
1486
- if err := pool .Add ([]* types.Transaction {tx }, true )[0 ]; ! errors .Is (err , txpool .ErrUnderpriced ) {
1486
+ if err := pool .Add ([]* types.Transaction {tx }, true )[0 ]; ! errors .Is (err , txpool .ErrTxGasPriceTooLow ) {
1487
1487
t .Fatalf ("Min tip not enforced" )
1488
1488
}
1489
1489
}
@@ -1560,16 +1560,16 @@ func TestRepricingDynamicFee(t *testing.T) {
1560
1560
}
1561
1561
// Check that we can't add the old transactions back
1562
1562
tx := pricedTransaction (1 , 100000 , big .NewInt (1 ), keys [0 ])
1563
- if err := pool .addRemote (tx ); ! errors .Is (err , txpool .ErrUnderpriced ) {
1564
- t .Fatalf ("adding underpriced pending transaction error mismatch: have %v, want %v" , err , txpool .ErrUnderpriced )
1563
+ if err := pool .addRemote (tx ); ! errors .Is (err , txpool .ErrTxGasPriceTooLow ) {
1564
+ t .Fatalf ("adding underpriced pending transaction error mismatch: have %v, want %v" , err , txpool .ErrTxGasPriceTooLow )
1565
1565
}
1566
1566
tx = dynamicFeeTx (0 , 100000 , big .NewInt (2 ), big .NewInt (1 ), keys [1 ])
1567
- if err := pool .addRemote (tx ); ! errors .Is (err , txpool .ErrUnderpriced ) {
1568
- t .Fatalf ("adding underpriced pending transaction error mismatch: have %v, want %v" , err , txpool .ErrUnderpriced )
1567
+ if err := pool .addRemote (tx ); ! errors .Is (err , txpool .ErrTxGasPriceTooLow ) {
1568
+ t .Fatalf ("adding underpriced pending transaction error mismatch: have %v, want %v" , err , txpool .ErrTxGasPriceTooLow )
1569
1569
}
1570
1570
tx = dynamicFeeTx (2 , 100000 , big .NewInt (1 ), big .NewInt (1 ), keys [2 ])
1571
- if err := pool .addRemote (tx ); ! errors .Is (err , txpool .ErrUnderpriced ) {
1572
- t .Fatalf ("adding underpriced queued transaction error mismatch: have %v, want %v" , err , txpool .ErrUnderpriced )
1571
+ if err := pool .addRemote (tx ); ! errors .Is (err , txpool .ErrTxGasPriceTooLow ) {
1572
+ t .Fatalf ("adding underpriced queued transaction error mismatch: have %v, want %v" , err , txpool .ErrTxGasPriceTooLow )
1573
1573
}
1574
1574
if err := validateEvents (events , 0 ); err != nil {
1575
1575
t .Fatalf ("post-reprice event firing failed: %v" , err )
@@ -1673,7 +1673,7 @@ func TestUnderpricing(t *testing.T) {
1673
1673
t .Fatalf ("failed to add well priced transaction: %v" , err )
1674
1674
}
1675
1675
// Ensure that replacing a pending transaction with a future transaction fails
1676
- if err := pool .addRemoteSync (pricedTransaction (5 , 100000 , big .NewInt (6 ), keys [1 ])); err != ErrFutureReplacePending {
1676
+ if err := pool .addRemoteSync (pricedTransaction (5 , 100000 , big .NewInt (6 ), keys [1 ])); ! errors . Is ( err , ErrFutureReplacePending ) {
1677
1677
t .Fatalf ("adding future replace transaction error mismatch: have %v, want %v" , err , ErrFutureReplacePending )
1678
1678
}
1679
1679
pending , queued = pool .Stats ()
@@ -1995,7 +1995,7 @@ func TestReplacement(t *testing.T) {
1995
1995
if err := pool .addRemoteSync (pricedTransaction (0 , 100000 , big .NewInt (1 ), key )); err != nil {
1996
1996
t .Fatalf ("failed to add original cheap pending transaction: %v" , err )
1997
1997
}
1998
- if err := pool .addRemote (pricedTransaction (0 , 100001 , big .NewInt (1 ), key )); err != txpool .ErrReplaceUnderpriced {
1998
+ if err := pool .addRemote (pricedTransaction (0 , 100001 , big .NewInt (1 ), key )); ! errors . Is ( err , txpool .ErrReplaceUnderpriced ) {
1999
1999
t .Fatalf ("original cheap pending transaction replacement error mismatch: have %v, want %v" , err , txpool .ErrReplaceUnderpriced )
2000
2000
}
2001
2001
if err := pool .addRemote (pricedTransaction (0 , 100000 , big .NewInt (2 ), key )); err != nil {
@@ -2008,7 +2008,7 @@ func TestReplacement(t *testing.T) {
2008
2008
if err := pool .addRemoteSync (pricedTransaction (0 , 100000 , big .NewInt (price ), key )); err != nil {
2009
2009
t .Fatalf ("failed to add original proper pending transaction: %v" , err )
2010
2010
}
2011
- if err := pool .addRemote (pricedTransaction (0 , 100001 , big .NewInt (threshold - 1 ), key )); err != txpool .ErrReplaceUnderpriced {
2011
+ if err := pool .addRemote (pricedTransaction (0 , 100001 , big .NewInt (threshold - 1 ), key )); ! errors . Is ( err , txpool .ErrReplaceUnderpriced ) {
2012
2012
t .Fatalf ("original proper pending transaction replacement error mismatch: have %v, want %v" , err , txpool .ErrReplaceUnderpriced )
2013
2013
}
2014
2014
if err := pool .addRemote (pricedTransaction (0 , 100000 , big .NewInt (threshold ), key )); err != nil {
@@ -2022,7 +2022,7 @@ func TestReplacement(t *testing.T) {
2022
2022
if err := pool .addRemote (pricedTransaction (2 , 100000 , big .NewInt (1 ), key )); err != nil {
2023
2023
t .Fatalf ("failed to add original cheap queued transaction: %v" , err )
2024
2024
}
2025
- if err := pool .addRemote (pricedTransaction (2 , 100001 , big .NewInt (1 ), key )); err != txpool .ErrReplaceUnderpriced {
2025
+ if err := pool .addRemote (pricedTransaction (2 , 100001 , big .NewInt (1 ), key )); ! errors . Is ( err , txpool .ErrReplaceUnderpriced ) {
2026
2026
t .Fatalf ("original cheap queued transaction replacement error mismatch: have %v, want %v" , err , txpool .ErrReplaceUnderpriced )
2027
2027
}
2028
2028
if err := pool .addRemote (pricedTransaction (2 , 100000 , big .NewInt (2 ), key )); err != nil {
@@ -2032,7 +2032,7 @@ func TestReplacement(t *testing.T) {
2032
2032
if err := pool .addRemote (pricedTransaction (2 , 100000 , big .NewInt (price ), key )); err != nil {
2033
2033
t .Fatalf ("failed to add original proper queued transaction: %v" , err )
2034
2034
}
2035
- if err := pool .addRemote (pricedTransaction (2 , 100001 , big .NewInt (threshold - 1 ), key )); err != txpool .ErrReplaceUnderpriced {
2035
+ if err := pool .addRemote (pricedTransaction (2 , 100001 , big .NewInt (threshold - 1 ), key )); ! errors . Is ( err , txpool .ErrReplaceUnderpriced ) {
2036
2036
t .Fatalf ("original proper queued transaction replacement error mismatch: have %v, want %v" , err , txpool .ErrReplaceUnderpriced )
2037
2037
}
2038
2038
if err := pool .addRemote (pricedTransaction (2 , 100000 , big .NewInt (threshold ), key )); err != nil {
@@ -2096,7 +2096,7 @@ func TestReplacementDynamicFee(t *testing.T) {
2096
2096
}
2097
2097
// 2. Don't bump tip or feecap => discard
2098
2098
tx = dynamicFeeTx (nonce , 100001 , big .NewInt (2 ), big .NewInt (1 ), key )
2099
- if err := pool .addRemote (tx ); err != txpool .ErrReplaceUnderpriced {
2099
+ if err := pool .addRemote (tx ); ! errors . Is ( err , txpool .ErrReplaceUnderpriced ) {
2100
2100
t .Fatalf ("original cheap %s transaction replacement error mismatch: have %v, want %v" , stage , err , txpool .ErrReplaceUnderpriced )
2101
2101
}
2102
2102
// 3. Bump both more than min => accept
@@ -2117,24 +2117,25 @@ func TestReplacementDynamicFee(t *testing.T) {
2117
2117
if err := pool .addRemoteSync (tx ); err != nil {
2118
2118
t .Fatalf ("failed to add original proper %s transaction: %v" , stage , err )
2119
2119
}
2120
+
2120
2121
// 6. Bump tip max allowed so it's still underpriced => discard
2121
2122
tx = dynamicFeeTx (nonce , 100000 , big .NewInt (gasFeeCap ), big .NewInt (tipThreshold - 1 ), key )
2122
- if err := pool .addRemote (tx ); err != txpool .ErrReplaceUnderpriced {
2123
+ if err := pool .addRemote (tx ); ! errors . Is ( err , txpool .ErrReplaceUnderpriced ) {
2123
2124
t .Fatalf ("original proper %s transaction replacement error mismatch: have %v, want %v" , stage , err , txpool .ErrReplaceUnderpriced )
2124
2125
}
2125
2126
// 7. Bump fee cap max allowed so it's still underpriced => discard
2126
2127
tx = dynamicFeeTx (nonce , 100000 , big .NewInt (feeCapThreshold - 1 ), big .NewInt (gasTipCap ), key )
2127
- if err := pool .addRemote (tx ); err != txpool .ErrReplaceUnderpriced {
2128
+ if err := pool .addRemote (tx ); ! errors . Is ( err , txpool .ErrReplaceUnderpriced ) {
2128
2129
t .Fatalf ("original proper %s transaction replacement error mismatch: have %v, want %v" , stage , err , txpool .ErrReplaceUnderpriced )
2129
2130
}
2130
2131
// 8. Bump tip min for acceptance => accept
2131
2132
tx = dynamicFeeTx (nonce , 100000 , big .NewInt (gasFeeCap ), big .NewInt (tipThreshold ), key )
2132
- if err := pool .addRemote (tx ); err != txpool .ErrReplaceUnderpriced {
2133
+ if err := pool .addRemote (tx ); ! errors . Is ( err , txpool .ErrReplaceUnderpriced ) {
2133
2134
t .Fatalf ("original proper %s transaction replacement error mismatch: have %v, want %v" , stage , err , txpool .ErrReplaceUnderpriced )
2134
2135
}
2135
2136
// 9. Bump fee cap min for acceptance => accept
2136
2137
tx = dynamicFeeTx (nonce , 100000 , big .NewInt (feeCapThreshold ), big .NewInt (gasTipCap ), key )
2137
- if err := pool .addRemote (tx ); err != txpool .ErrReplaceUnderpriced {
2138
+ if err := pool .addRemote (tx ); ! errors . Is ( err , txpool .ErrReplaceUnderpriced ) {
2138
2139
t .Fatalf ("original proper %s transaction replacement error mismatch: have %v, want %v" , stage , err , txpool .ErrReplaceUnderpriced )
2139
2140
}
2140
2141
// 10. Check events match expected (3 new executable txs during pending, 0 during queue)
0 commit comments