diff options
author | obscuren <geffobscura@gmail.com> | 2015-01-07 20:17:48 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2015-01-07 20:17:48 +0800 |
commit | fed3e6a808921fb8274b50043c5c39a24a1bbccf (patch) | |
tree | d632e95cfce78bd9a99a52bf7f30ee3ff980dfd3 /core/transaction_pool_test.go | |
parent | 032ab665299d75bffc25260e8fa477ace19db06a (diff) | |
download | dexon-fed3e6a808921fb8274b50043c5c39a24a1bbccf.tar.gz dexon-fed3e6a808921fb8274b50043c5c39a24a1bbccf.tar.zst dexon-fed3e6a808921fb8274b50043c5c39a24a1bbccf.zip |
Refactored ethutil.Config.Db out
Diffstat (limited to 'core/transaction_pool_test.go')
-rw-r--r-- | core/transaction_pool_test.go | 14 |
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()) } |