aboutsummaryrefslogtreecommitdiffstats
path: root/core/state/statedb_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'core/state/statedb_test.go')
-rw-r--r--core/state/statedb_test.go15
1 files changed, 6 insertions, 9 deletions
diff --git a/core/state/statedb_test.go b/core/state/statedb_test.go
index 420ca745c..e2b349de8 100644
--- a/core/state/statedb_test.go
+++ b/core/state/statedb_test.go
@@ -39,7 +39,7 @@ import (
// actually committing the state.
func TestUpdateLeaks(t *testing.T) {
// Create an empty state database
- db, _ := ethdb.NewMemDatabase()
+ db := ethdb.NewMemDatabase()
state, _ := New(common.Hash{}, NewDatabase(db))
// Update it with some accounts
@@ -66,8 +66,8 @@ func TestUpdateLeaks(t *testing.T) {
// only the one right before the commit.
func TestIntermediateLeaks(t *testing.T) {
// Create two state databases, one transitioning to the final state, the other final from the beginning
- transDb, _ := ethdb.NewMemDatabase()
- finalDb, _ := ethdb.NewMemDatabase()
+ transDb := ethdb.NewMemDatabase()
+ finalDb := ethdb.NewMemDatabase()
transState, _ := New(common.Hash{}, NewDatabase(transDb))
finalState, _ := New(common.Hash{}, NewDatabase(finalDb))
@@ -122,8 +122,7 @@ func TestIntermediateLeaks(t *testing.T) {
// https://github.com/ethereum/go-ethereum/pull/15549.
func TestCopy(t *testing.T) {
// Create a random state test to copy and modify "independently"
- db, _ := ethdb.NewMemDatabase()
- orig, _ := New(common.Hash{}, NewDatabase(db))
+ orig, _ := New(common.Hash{}, NewDatabase(ethdb.NewMemDatabase()))
for i := byte(0); i < 255; i++ {
obj := orig.GetOrNewStateObject(common.BytesToAddress([]byte{i}))
@@ -334,8 +333,7 @@ func (test *snapshotTest) String() string {
func (test *snapshotTest) run() bool {
// Run all actions and create snapshots.
var (
- db, _ = ethdb.NewMemDatabase()
- state, _ = New(common.Hash{}, NewDatabase(db))
+ state, _ = New(common.Hash{}, NewDatabase(ethdb.NewMemDatabase()))
snapshotRevs = make([]int, len(test.snapshots))
sindex = 0
)
@@ -426,8 +424,7 @@ func (s *StateSuite) TestTouchDelete(c *check.C) {
// TestCopyOfCopy tests that modified objects are carried over to the copy, and the copy of the copy.
// See https://github.com/ethereum/go-ethereum/pull/15225#issuecomment-380191512
func TestCopyOfCopy(t *testing.T) {
- db, _ := ethdb.NewMemDatabase()
- sdb, _ := New(common.Hash{}, NewDatabase(db))
+ sdb, _ := New(common.Hash{}, NewDatabase(ethdb.NewMemDatabase()))
addr := common.HexToAddress("aaaa")
sdb.SetBalance(addr, big.NewInt(42))