diff options
author | Felix Lange <fjl@twurst.com> | 2015-06-03 20:06:20 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2015-06-04 04:43:23 +0800 |
commit | 08befff8f168f0fd59a3ff36a7205ba44fb82540 (patch) | |
tree | 01a9cf1193a1a9c2108f1a3b835c462f2da22932 /core/transaction_pool_test.go | |
parent | 770a0e78396d66dc0b15a267891ed69be1414f52 (diff) | |
download | dexon-08befff8f168f0fd59a3ff36a7205ba44fb82540.tar.gz dexon-08befff8f168f0fd59a3ff36a7205ba44fb82540.tar.zst dexon-08befff8f168f0fd59a3ff36a7205ba44fb82540.zip |
core: compute less transaction hashes in TxPool
Diffstat (limited to 'core/transaction_pool_test.go')
-rw-r--r-- | core/transaction_pool_test.go | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/core/transaction_pool_test.go b/core/transaction_pool_test.go index d6ea4a2a9..600fd9b4f 100644 --- a/core/transaction_pool_test.go +++ b/core/transaction_pool_test.go @@ -68,7 +68,7 @@ func TestTransactionQueue(t *testing.T) { tx.SignECDSA(key) from, _ := tx.From() pool.currentState().AddBalance(from, big.NewInt(1)) - pool.queueTx(tx) + pool.queueTx(tx.Hash(), tx) pool.checkQueue() if len(pool.txs) != 1 { @@ -80,7 +80,7 @@ func TestTransactionQueue(t *testing.T) { from, _ = tx.From() pool.currentState().SetNonce(from, 10) tx.SetNonce(1) - pool.queueTx(tx) + pool.queueTx(tx.Hash(), tx) pool.checkQueue() if _, ok := pool.txs[tx.Hash()]; ok { t.Error("expected transaction to be in tx pool") @@ -97,18 +97,18 @@ func TestTransactionQueue(t *testing.T) { tx1.SignECDSA(key) tx2.SignECDSA(key) tx3.SignECDSA(key) - pool.queueTx(tx1) - pool.queueTx(tx2) - pool.queueTx(tx3) + pool.queueTx(tx1.Hash(), tx1) + pool.queueTx(tx2.Hash(), tx2) + pool.queueTx(tx3.Hash(), tx3) from, _ = tx1.From() + pool.checkQueue() if len(pool.txs) != 1 { t.Error("expected tx pool to be 1 =") } - - if len(pool.queue[from]) != 3 { - t.Error("expected transaction queue to be empty. is", len(pool.queue[from])) + if len(pool.queue[from]) != 2 { + t.Error("expected len(queue) == 2, got", len(pool.queue[from])) } } @@ -118,8 +118,8 @@ func TestRemoveTx(t *testing.T) { tx.SignECDSA(key) from, _ := tx.From() pool.currentState().AddBalance(from, big.NewInt(1)) - pool.queueTx(tx) - pool.addTx(tx) + pool.queueTx(tx.Hash(), tx) + pool.addTx(tx.Hash(), tx) if len(pool.queue) != 1 { t.Error("expected queue to be 1, got", len(pool.queue)) } |