diff options
author | gary rong <garyrong0905@gmail.com> | 2018-05-09 20:24:25 +0800 |
---|---|---|
committer | Péter Szilágyi <peterke@gmail.com> | 2018-05-09 20:24:25 +0800 |
commit | 7beccb29becf439df7bf4c033a94c019ad25bead (patch) | |
tree | 5d8581c15f3f110c765c6383e0c4c7724418d6f0 /light | |
parent | 5dbd8b42a90779bd4269012c1336679fd4ca9824 (diff) | |
download | dexon-7beccb29becf439df7bf4c033a94c019ad25bead.tar.gz dexon-7beccb29becf439df7bf4c033a94c019ad25bead.tar.zst dexon-7beccb29becf439df7bf4c033a94c019ad25bead.zip |
all: get rid of error when creating memory database (#16716)
* all: get rid of error when create mdb
* core: clean up variables definition
* all: inline mdb definition
Diffstat (limited to 'light')
-rw-r--r-- | light/lightchain_test.go | 4 | ||||
-rw-r--r-- | light/odr_test.go | 4 | ||||
-rw-r--r-- | light/trie_test.go | 8 | ||||
-rw-r--r-- | light/txpool_test.go | 4 |
4 files changed, 10 insertions, 10 deletions
diff --git a/light/lightchain_test.go b/light/lightchain_test.go index b8ab1c51c..c0aa51da2 100644 --- a/light/lightchain_test.go +++ b/light/lightchain_test.go @@ -52,7 +52,7 @@ func makeHeaderChain(parent *types.Header, n int, db ethdb.Database, seed int) [ // chain. Depending on the full flag, if creates either a full block chain or a // header only chain. func newCanonical(n int) (ethdb.Database, *LightChain, error) { - db, _ := ethdb.NewMemDatabase() + db := ethdb.NewMemDatabase() gspec := core.Genesis{Config: params.TestChainConfig} genesis := gspec.MustCommit(db) blockchain, _ := NewLightChain(&dummyOdr{db: db}, gspec.Config, ethash.NewFaker()) @@ -69,7 +69,7 @@ func newCanonical(n int) (ethdb.Database, *LightChain, error) { // newTestLightChain creates a LightChain that doesn't validate anything. func newTestLightChain() *LightChain { - db, _ := ethdb.NewMemDatabase() + db := ethdb.NewMemDatabase() gspec := &core.Genesis{ Difficulty: big.NewInt(1), Config: params.TestChainConfig, diff --git a/light/odr_test.go b/light/odr_test.go index cc7475df3..3e7ac1011 100644 --- a/light/odr_test.go +++ b/light/odr_test.go @@ -245,8 +245,8 @@ func testChainGen(i int, block *core.BlockGen) { func testChainOdr(t *testing.T, protocol int, fn odrTestFn) { var ( - sdb, _ = ethdb.NewMemDatabase() - ldb, _ = ethdb.NewMemDatabase() + sdb = ethdb.NewMemDatabase() + ldb = ethdb.NewMemDatabase() gspec = core.Genesis{Alloc: core.GenesisAlloc{testBankAddress: {Balance: testBankFunds}}} genesis = gspec.MustCommit(sdb) ) diff --git a/light/trie_test.go b/light/trie_test.go index 0d6b2cc1d..84c6f162f 100644 --- a/light/trie_test.go +++ b/light/trie_test.go @@ -34,10 +34,10 @@ import ( func TestNodeIterator(t *testing.T) { var ( - fulldb, _ = ethdb.NewMemDatabase() - lightdb, _ = ethdb.NewMemDatabase() - gspec = core.Genesis{Alloc: core.GenesisAlloc{testBankAddress: {Balance: testBankFunds}}} - genesis = gspec.MustCommit(fulldb) + fulldb = ethdb.NewMemDatabase() + lightdb = ethdb.NewMemDatabase() + gspec = core.Genesis{Alloc: core.GenesisAlloc{testBankAddress: {Balance: testBankFunds}}} + genesis = gspec.MustCommit(fulldb) ) gspec.MustCommit(lightdb) blockchain, _ := core.NewBlockChain(fulldb, nil, params.TestChainConfig, ethash.NewFullFaker(), vm.Config{}) diff --git a/light/txpool_test.go b/light/txpool_test.go index 13d7d3ceb..ccbd83a94 100644 --- a/light/txpool_test.go +++ b/light/txpool_test.go @@ -81,8 +81,8 @@ func TestTxPool(t *testing.T) { } var ( - sdb, _ = ethdb.NewMemDatabase() - ldb, _ = ethdb.NewMemDatabase() + sdb = ethdb.NewMemDatabase() + ldb = ethdb.NewMemDatabase() gspec = core.Genesis{Alloc: core.GenesisAlloc{testBankAddress: {Balance: testBankFunds}}} genesis = gspec.MustCommit(sdb) ) |