diff options
author | Péter Szilágyi <peterke@gmail.com> | 2018-05-07 19:35:06 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-05-07 19:35:06 +0800 |
commit | 6cf0ab38bd0af77d81aad4c104979cebee9e3e63 (patch) | |
tree | 142d6f965c44dcf9e2182da67b7bbc978c573448 /cmd | |
parent | 5463ed99968bf71685a2a8ee9dbf8705912f00cb (diff) | |
download | go-tangerine-6cf0ab38bd0af77d81aad4c104979cebee9e3e63.tar go-tangerine-6cf0ab38bd0af77d81aad4c104979cebee9e3e63.tar.gz go-tangerine-6cf0ab38bd0af77d81aad4c104979cebee9e3e63.tar.bz2 go-tangerine-6cf0ab38bd0af77d81aad4c104979cebee9e3e63.tar.lz go-tangerine-6cf0ab38bd0af77d81aad4c104979cebee9e3e63.tar.xz go-tangerine-6cf0ab38bd0af77d81aad4c104979cebee9e3e63.tar.zst go-tangerine-6cf0ab38bd0af77d81aad4c104979cebee9e3e63.zip |
core/rawdb: separate raw database access to own package (#16666)
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/geth/dao_test.go | 6 | ||||
-rw-r--r-- | cmd/utils/cmd.go | 7 |
2 files changed, 6 insertions, 7 deletions
diff --git a/cmd/geth/dao_test.go b/cmd/geth/dao_test.go index a8dbc5163..52983ff2a 100644 --- a/cmd/geth/dao_test.go +++ b/cmd/geth/dao_test.go @@ -24,7 +24,7 @@ import ( "testing" "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core" + "github.com/ethereum/go-ethereum/core/rawdb" "github.com/ethereum/go-ethereum/ethdb" "github.com/ethereum/go-ethereum/params" ) @@ -131,8 +131,8 @@ func testDAOForkBlockNewChain(t *testing.T, test int, genesis string, expectBloc if genesis != "" { genesisHash = daoGenesisHash } - config, err := core.GetChainConfig(db, genesisHash) - if err != nil { + config := rawdb.ReadChainConfig(db, genesisHash) + if config == nil { t.Errorf("test %d: failed to retrieve chain config: %v", test, err) return // we want to return here, the other checks can't make it past this point (nil panic). } diff --git a/cmd/utils/cmd.go b/cmd/utils/cmd.go index c0af4c13e..58d72f32b 100644 --- a/cmd/utils/cmd.go +++ b/cmd/utils/cmd.go @@ -29,6 +29,7 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core" + "github.com/ethereum/go-ethereum/core/rawdb" "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/ethdb" @@ -271,15 +272,13 @@ func ImportPreimages(db *ethdb.LDBDatabase, fn string) error { // Accumulate the preimages and flush when enough ws gathered preimages[crypto.Keccak256Hash(blob)] = common.CopyBytes(blob) if len(preimages) > 1024 { - if err := core.WritePreimages(db, 0, preimages); err != nil { - return err - } + rawdb.WritePreimages(db, 0, preimages) preimages = make(map[common.Hash][]byte) } } // Flush the last batch preimage data if len(preimages) > 0 { - return core.WritePreimages(db, 0, preimages) + rawdb.WritePreimages(db, 0, preimages) } return nil } |