aboutsummaryrefslogtreecommitdiffstats
path: root/core/transaction_pool_test.go
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2015-04-30 06:20:59 +0800
committerobscuren <geffobscura@gmail.com>2015-04-30 06:20:59 +0800
commit88292f35db656fe0677a3d7cf9be3a78f507699d (patch)
treea5f5fd0ebcc01453d0f7e64a84881bd0753a53e1 /core/transaction_pool_test.go
parent2590a7dabbf6781734be0c388b46ecd53ece6155 (diff)
downloadgo-tangerine-88292f35db656fe0677a3d7cf9be3a78f507699d.tar
go-tangerine-88292f35db656fe0677a3d7cf9be3a78f507699d.tar.gz
go-tangerine-88292f35db656fe0677a3d7cf9be3a78f507699d.tar.bz2
go-tangerine-88292f35db656fe0677a3d7cf9be3a78f507699d.tar.lz
go-tangerine-88292f35db656fe0677a3d7cf9be3a78f507699d.tar.xz
go-tangerine-88292f35db656fe0677a3d7cf9be3a78f507699d.tar.zst
go-tangerine-88292f35db656fe0677a3d7cf9be3a78f507699d.zip
core: remove txs from queue in addition to removal of pending
Diffstat (limited to 'core/transaction_pool_test.go')
-rw-r--r--core/transaction_pool_test.go27
1 files changed, 27 insertions, 0 deletions
diff --git a/core/transaction_pool_test.go b/core/transaction_pool_test.go
index 4d66776f0..49224be5b 100644
--- a/core/transaction_pool_test.go
+++ b/core/transaction_pool_test.go
@@ -111,3 +111,30 @@ func TestTransactionQueue(t *testing.T) {
t.Error("expected transaction queue to be empty. is", len(pool.queue[from]))
}
}
+
+func TestRemoveTx(t *testing.T) {
+ pool, key := setupTxPool()
+ tx := transaction()
+ tx.SignECDSA(key)
+ from, _ := tx.From()
+ pool.currentState().AddBalance(from, big.NewInt(1))
+ pool.queueTx(tx)
+ pool.addTx(tx)
+ if len(pool.queue) != 1 {
+ t.Error("expected queue to be 1, got", len(pool.queue))
+ }
+
+ if len(pool.txs) != 1 {
+ t.Error("expected txs to be 1, got", len(pool.txs))
+ }
+
+ pool.removeTx(tx.Hash())
+
+ if len(pool.queue) > 0 {
+ t.Error("expected queue to be 0, got", len(pool.queue))
+ }
+
+ if len(pool.txs) > 0 {
+ t.Error("expected txs to be 0, got", len(pool.txs))
+ }
+}