aboutsummaryrefslogtreecommitdiffstats
path: root/core/tx_pool_test.go
diff options
context:
space:
mode:
authorJim McDonald <Jim@mcdee.net>2017-10-30 19:05:00 +0800
committerPéter Szilágyi <peterke@gmail.com>2017-10-30 19:05:00 +0800
commit0131bd6ff9b1850fdd307715c62174af4f05d2c7 (patch)
tree097b929fd5757137f6e56b39b9f7b8d2a7b4fa7c /core/tx_pool_test.go
parentdd8a62683e2007b1127bfdc55c58c39f78b58ebf (diff)
downloadgo-tangerine-0131bd6ff9b1850fdd307715c62174af4f05d2c7.tar
go-tangerine-0131bd6ff9b1850fdd307715c62174af4f05d2c7.tar.gz
go-tangerine-0131bd6ff9b1850fdd307715c62174af4f05d2c7.tar.bz2
go-tangerine-0131bd6ff9b1850fdd307715c62174af4f05d2c7.tar.lz
go-tangerine-0131bd6ff9b1850fdd307715c62174af4f05d2c7.tar.xz
go-tangerine-0131bd6ff9b1850fdd307715c62174af4f05d2c7.tar.zst
go-tangerine-0131bd6ff9b1850fdd307715c62174af4f05d2c7.zip
core: respect price bump threshold (#15401)
* core: allow price bump at threshold * core: test changes to allow price bump at threshold * core: reinstate tx replacement test underneath threshold * core: minor test failure message cleanups
Diffstat (limited to 'core/tx_pool_test.go')
-rw-r--r--core/tx_pool_test.go20
1 files changed, 10 insertions, 10 deletions
diff --git a/core/tx_pool_test.go b/core/tx_pool_test.go
index eec128cba..737ea4cd3 100644
--- a/core/tx_pool_test.go
+++ b/core/tx_pool_test.go
@@ -1411,10 +1411,10 @@ func TestTransactionReplacement(t *testing.T) {
if err := pool.AddRemote(pricedTransaction(0, big.NewInt(100000), big.NewInt(price), key)); err != nil {
t.Fatalf("failed to add original proper pending transaction: %v", err)
}
- if err := pool.AddRemote(pricedTransaction(0, big.NewInt(100000), big.NewInt(threshold), key)); err != ErrReplaceUnderpriced {
+ if err := pool.AddRemote(pricedTransaction(0, big.NewInt(100001), big.NewInt(threshold-1), key)); err != ErrReplaceUnderpriced {
t.Fatalf("original proper pending transaction replacement error mismatch: have %v, want %v", err, ErrReplaceUnderpriced)
}
- if err := pool.AddRemote(pricedTransaction(0, big.NewInt(100000), big.NewInt(threshold+1), key)); err != nil {
+ if err := pool.AddRemote(pricedTransaction(0, big.NewInt(100000), big.NewInt(threshold), key)); err != nil {
t.Fatalf("failed to replace original proper pending transaction: %v", err)
}
if err := validateEvents(events, 2); err != nil {
@@ -1422,23 +1422,23 @@ func TestTransactionReplacement(t *testing.T) {
}
// Add queued transactions, ensuring the minimum price bump is enforced for replacement (for ultra low prices too)
if err := pool.AddRemote(pricedTransaction(2, big.NewInt(100000), big.NewInt(1), key)); err != nil {
- t.Fatalf("failed to add original queued transaction: %v", err)
+ t.Fatalf("failed to add original cheap queued transaction: %v", err)
}
if err := pool.AddRemote(pricedTransaction(2, big.NewInt(100001), big.NewInt(1), key)); err != ErrReplaceUnderpriced {
- t.Fatalf("original queued transaction replacement error mismatch: have %v, want %v", err, ErrReplaceUnderpriced)
+ t.Fatalf("original cheap queued transaction replacement error mismatch: have %v, want %v", err, ErrReplaceUnderpriced)
}
if err := pool.AddRemote(pricedTransaction(2, big.NewInt(100000), big.NewInt(2), key)); err != nil {
- t.Fatalf("failed to replace original queued transaction: %v", err)
+ t.Fatalf("failed to replace original cheap queued transaction: %v", err)
}
if err := pool.AddRemote(pricedTransaction(2, big.NewInt(100000), big.NewInt(price), key)); err != nil {
- t.Fatalf("failed to add original queued transaction: %v", err)
+ t.Fatalf("failed to add original proper queued transaction: %v", err)
}
- if err := pool.AddRemote(pricedTransaction(2, big.NewInt(100001), big.NewInt(threshold), key)); err != ErrReplaceUnderpriced {
- t.Fatalf("original queued transaction replacement error mismatch: have %v, want %v", err, ErrReplaceUnderpriced)
+ if err := pool.AddRemote(pricedTransaction(2, big.NewInt(100001), big.NewInt(threshold-1), key)); err != ErrReplaceUnderpriced {
+ t.Fatalf("original proper queued transaction replacement error mismatch: have %v, want %v", err, ErrReplaceUnderpriced)
}
- if err := pool.AddRemote(pricedTransaction(2, big.NewInt(100000), big.NewInt(threshold+1), key)); err != nil {
- t.Fatalf("failed to replace original queued transaction: %v", err)
+ if err := pool.AddRemote(pricedTransaction(2, big.NewInt(100000), big.NewInt(threshold), key)); err != nil {
+ t.Fatalf("failed to replace original proper queued transaction: %v", err)
}
if err := validateEvents(events, 0); err != nil {