aboutsummaryrefslogtreecommitdiffstats
path: root/core/tx_pool_test.go
diff options
context:
space:
mode:
authorPéter Szilágyi <peterke@gmail.com>2017-08-07 20:47:25 +0800
committerPéter Szilágyi <peterke@gmail.com>2017-08-07 21:00:47 +0800
commit2b50367fe938e603a5f9d3a525e0cdfa000f402e (patch)
treec032258a82131d9d3bacbe309682249c2430d6c9 /core/tx_pool_test.go
parent46cf0a616b597dfb8b1feff80ad58b6eb81e57d5 (diff)
downloaddexon-2b50367fe938e603a5f9d3a525e0cdfa000f402e.tar
dexon-2b50367fe938e603a5f9d3a525e0cdfa000f402e.tar.gz
dexon-2b50367fe938e603a5f9d3a525e0cdfa000f402e.tar.bz2
dexon-2b50367fe938e603a5f9d3a525e0cdfa000f402e.tar.lz
dexon-2b50367fe938e603a5f9d3a525e0cdfa000f402e.tar.xz
dexon-2b50367fe938e603a5f9d3a525e0cdfa000f402e.tar.zst
dexon-2b50367fe938e603a5f9d3a525e0cdfa000f402e.zip
core: fix blockchain goroutine leaks in tests
Diffstat (limited to 'core/tx_pool_test.go')
-rw-r--r--core/tx_pool_test.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/core/tx_pool_test.go b/core/tx_pool_test.go
index 9a03caf61..020d6bedd 100644
--- a/core/tx_pool_test.go
+++ b/core/tx_pool_test.go
@@ -235,6 +235,8 @@ func TestTransactionQueue(t *testing.T) {
}
pool, key = setupTxPool()
+ defer pool.Stop()
+
tx1 := transaction(0, big.NewInt(100), key)
tx2 := transaction(10, big.NewInt(100), key)
tx3 := transaction(11, big.NewInt(100), key)
@@ -848,6 +850,8 @@ func TestTransactionPendingLimitingEquivalency(t *testing.T) { testTransactionLi
func testTransactionLimitingEquivalency(t *testing.T, origin uint64) {
// Add a batch of transactions to a pool one by one
pool1, key1 := setupTxPool()
+ defer pool1.Stop()
+
account1, _ := deriveSender(transaction(0, big.NewInt(0), key1))
state1, _ := pool1.currentState()
state1.AddBalance(account1, big.NewInt(1000000))
@@ -859,6 +863,8 @@ func testTransactionLimitingEquivalency(t *testing.T, origin uint64) {
}
// Add a batch of transactions to a pool in one big batch
pool2, key2 := setupTxPool()
+ defer pool2.Stop()
+
account2, _ := deriveSender(transaction(0, big.NewInt(0), key2))
state2, _ := pool2.currentState()
state2.AddBalance(account2, big.NewInt(1000000))
@@ -1356,6 +1362,7 @@ func testTransactionJournaling(t *testing.T, nolocals bool) {
if err := validateTxPoolInternals(pool); err != nil {
t.Fatalf("pool internal state corrupted: %v", err)
}
+ pool.Stop()
}
// Benchmarks the speed of validating the contents of the pending queue of the