aboutsummaryrefslogtreecommitdiffstats
path: root/core/transaction_pool_test.go
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2015-01-02 19:18:23 +0800
committerobscuren <geffobscura@gmail.com>2015-01-02 19:18:23 +0800
commit6cf61039cfdac2595528adb86978465881838c7f (patch)
treeb3bd494265e45d2aec88c472e4501da47a1426d0 /core/transaction_pool_test.go
parent48d2a8b8ee9621810a988e3561e4213749c54da7 (diff)
downloadgo-tangerine-6cf61039cfdac2595528adb86978465881838c7f.tar
go-tangerine-6cf61039cfdac2595528adb86978465881838c7f.tar.gz
go-tangerine-6cf61039cfdac2595528adb86978465881838c7f.tar.bz2
go-tangerine-6cf61039cfdac2595528adb86978465881838c7f.tar.lz
go-tangerine-6cf61039cfdac2595528adb86978465881838c7f.tar.xz
go-tangerine-6cf61039cfdac2595528adb86978465881838c7f.tar.zst
go-tangerine-6cf61039cfdac2595528adb86978465881838c7f.zip
Added tests for valid transactions
Diffstat (limited to 'core/transaction_pool_test.go')
-rw-r--r--core/transaction_pool_test.go21
1 files changed, 10 insertions, 11 deletions
diff --git a/core/transaction_pool_test.go b/core/transaction_pool_test.go
index 296c6bd8a..1214ad903 100644
--- a/core/transaction_pool_test.go
+++ b/core/transaction_pool_test.go
@@ -18,15 +18,6 @@ func (self stateQuery) GetAccount(addr []byte) *state.StateObject {
return state.NewStateObject(addr)
}
-// State query interface
-type invalidStateQuery struct{}
-
-func (self invalidStateQuery) GetAccount(addr []byte) *state.StateObject {
- o := state.NewStateObject(addr)
- o.Nonce++
- return o
-}
-
func transaction() *types.Transaction {
return types.NewTransactionMessage(make([]byte, 20), ethutil.Big0, ethutil.Big0, ethutil.Big0, nil)
}
@@ -72,11 +63,19 @@ func TestRemoveSet(t *testing.T) {
}
func TestRemoveInvalid(t *testing.T) {
- pool, _ := setup()
+ pool, key := setup()
tx1 := transaction()
pool.pool.Add(tx1)
- pool.RemoveInvalid(invalidStateQuery{})
+ pool.RemoveInvalid(stateQuery{})
if pool.Size() > 0 {
t.Error("expected pool size to be 0")
}
+
+ tx1.SetNonce(1)
+ tx1.SignECDSA(key)
+ pool.pool.Add(tx1)
+ pool.RemoveInvalid(stateQuery{})
+ if pool.Size() != 1 {
+ t.Error("expected pool size to be 1, is", pool.Size())
+ }
}