aboutsummaryrefslogtreecommitdiffstats
path: root/core/transaction_pool_test.go
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2015-01-07 20:17:48 +0800
committerobscuren <geffobscura@gmail.com>2015-01-07 20:17:48 +0800
commitfed3e6a808921fb8274b50043c5c39a24a1bbccf (patch)
treed632e95cfce78bd9a99a52bf7f30ee3ff980dfd3 /core/transaction_pool_test.go
parent032ab665299d75bffc25260e8fa477ace19db06a (diff)
downloadgo-tangerine-fed3e6a808921fb8274b50043c5c39a24a1bbccf.tar
go-tangerine-fed3e6a808921fb8274b50043c5c39a24a1bbccf.tar.gz
go-tangerine-fed3e6a808921fb8274b50043c5c39a24a1bbccf.tar.bz2
go-tangerine-fed3e6a808921fb8274b50043c5c39a24a1bbccf.tar.lz
go-tangerine-fed3e6a808921fb8274b50043c5c39a24a1bbccf.tar.xz
go-tangerine-fed3e6a808921fb8274b50043c5c39a24a1bbccf.tar.zst
go-tangerine-fed3e6a808921fb8274b50043c5c39a24a1bbccf.zip
Refactored ethutil.Config.Db out
Diffstat (limited to 'core/transaction_pool_test.go')
-rw-r--r--core/transaction_pool_test.go14
1 files changed, 10 insertions, 4 deletions
diff --git a/core/transaction_pool_test.go b/core/transaction_pool_test.go
index 2e1debfbe..7f192fc4d 100644
--- a/core/transaction_pool_test.go
+++ b/core/transaction_pool_test.go
@@ -6,16 +6,22 @@ import (
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/crypto"
+ "github.com/ethereum/go-ethereum/ethdb"
"github.com/ethereum/go-ethereum/ethutil"
"github.com/ethereum/go-ethereum/event"
"github.com/ethereum/go-ethereum/state"
)
// State query interface
-type stateQuery struct{}
+type stateQuery struct{ db ethutil.Database }
+
+func SQ() stateQuery {
+ db, _ := ethdb.NewMemDatabase()
+ return stateQuery{db: db}
+}
func (self stateQuery) GetAccount(addr []byte) *state.StateObject {
- return state.NewStateObject(addr)
+ return state.NewStateObject(addr, self.db)
}
func transaction() *types.Transaction {
@@ -66,7 +72,7 @@ func TestRemoveInvalid(t *testing.T) {
pool, key := setup()
tx1 := transaction()
pool.addTx(tx1)
- pool.RemoveInvalid(stateQuery{})
+ pool.RemoveInvalid(SQ())
if pool.Size() > 0 {
t.Error("expected pool size to be 0")
}
@@ -74,7 +80,7 @@ func TestRemoveInvalid(t *testing.T) {
tx1.SetNonce(1)
tx1.SignECDSA(key)
pool.addTx(tx1)
- pool.RemoveInvalid(stateQuery{})
+ pool.RemoveInvalid(SQ())
if pool.Size() != 1 {
t.Error("expected pool size to be 1, is", pool.Size())
}