diff --git a/cmd/geth/chaincmd.go b/cmd/geth/chaincmd.go index 18f98423a74..28b376a9e60 100644 --- a/cmd/geth/chaincmd.go +++ b/cmd/geth/chaincmd.go @@ -300,7 +300,7 @@ func importPreimages(ctx *cli.Context) error { stack := makeFullNode(ctx) defer stack.Close() - diskdb := utils.MakeChainDatabase(ctx, stack).(*ethdb.LDBDatabase) + diskdb := utils.MakeChainDatabase(ctx, stack).(*ethdb.BoltDatabase) start := time.Now() if err := utils.ImportPreimages(diskdb, ctx.Args().First()); err != nil { @@ -318,7 +318,7 @@ func exportPreimages(ctx *cli.Context) error { stack := makeFullNode(ctx) defer stack.Close() - diskdb := utils.MakeChainDatabase(ctx, stack).(*ethdb.LDBDatabase) + diskdb := utils.MakeChainDatabase(ctx, stack).(*ethdb.BoltDatabase) start := time.Now() if err := utils.ExportPreimages(diskdb, ctx.Args().First()); err != nil { @@ -342,7 +342,7 @@ func copyDb(ctx *cli.Context) error { dl := downloader.New(syncmode, chainDb, new(event.TypeMux), chain, nil, nil) // Create a source peer to satisfy downloader requests from - db, err := ethdb.NewLDBDatabase(ctx.Args().First()) + db, err := ethdb.NewBoltDatabase(ctx.Args().First()) if err != nil { return err } diff --git a/cmd/geth/dao_test.go b/cmd/geth/dao_test.go index e6d19588b33..fea4cdfc384 100644 --- a/cmd/geth/dao_test.go +++ b/cmd/geth/dao_test.go @@ -121,7 +121,7 @@ func testDAOForkBlockNewChain(t *testing.T, test int, genesis string, expectBloc } // Retrieve the DAO config flag from the database path := filepath.Join(datadir, "geth", "chaindata") - db, err := ethdb.NewLDBDatabase(path) + db, err := ethdb.NewBoltDatabase(path) if err != nil { t.Fatalf("test %d: failed to open test database: %v", test, err) } diff --git a/cmd/hack/hack.go b/cmd/hack/hack.go index fec0556e26b..7a997c72e07 100644 --- a/cmd/hack/hack.go +++ b/cmd/hack/hack.go @@ -404,8 +404,8 @@ func printOccupancies(t *trie.Trie, db ethdb.Database, blockNr uint64) { } func trieStats() { - //db, err := ethdb.NewLDBDatabase("/home/akhounov/.ethereum/geth/chaindata") - db, err := ethdb.NewLDBDatabase("/Users/alexeyakhunov/Library/Ethereum/geth/chaindata") + //db, err := ethdb.NewBoltDatabase("/home/akhounov/.ethereum/geth/chaindata") + db, err := ethdb.NewBoltDatabase("/Users/alexeyakhunov/Library/Ethereum/geth/chaindata") if err != nil { panic(err) } @@ -679,15 +679,15 @@ func trieChart() { } func execToBlock(block int) { - blockDb, err := ethdb.NewLDBDatabase("/Users/alexeyakhunov/Library/Ethereum/testnet/geth/chaindata") - //ethDb, err := ethdb.NewLDBDatabase("/home/akhounov/.ethereum/geth/chaindata") + blockDb, err := ethdb.NewBoltDatabase("/Users/alexeyakhunov/Library/Ethereum/testnet/geth/chaindata") + //ethDb, err := ethdb.NewBoltDatabase("/home/akhounov/.ethereum/geth/chaindata") check(err) bcb, err := core.NewBlockChain(blockDb, nil, params.TestnetChainConfig, ethash.NewFaker(), vm.Config{}, nil) check(err) defer blockDb.Close() os.Remove("statedb") os.Remove("statedb.hash") - stateDb, err := ethdb.NewLDBDatabase("statedb") + stateDb, err := ethdb.NewBoltDatabase("statedb") check(err) defer stateDb.Close() _, _, _, err = core.SetupGenesisBlock(stateDb, core.DefaultTestnetGenesisBlock()) @@ -722,7 +722,7 @@ func execToBlock(block int) { } func extractTrie(block int) { - stateDb, err := ethdb.NewLDBDatabase("statedb") + stateDb, err := ethdb.NewBoltDatabase("statedb") check(err) defer stateDb.Close() bc, err := core.NewBlockChain(stateDb, nil, params.TestnetChainConfig, ethash.NewFaker(), vm.Config{}, nil) @@ -746,9 +746,9 @@ func extractTrie(block int) { } func testRewind(block, rewind int) { - ethDb, err := ethdb.NewLDBDatabase("/Users/alexeyakhunov/Library/Ethereum/testnet/geth/chaindata") - //ethDb, err := ethdb.NewLDBDatabase("/home/akhounov/.ethereum/geth/chaindata") - //ethDb, err := ethdb.NewLDBDatabase("statedb") + ethDb, err := ethdb.NewBoltDatabase("/Users/alexeyakhunov/Library/Ethereum/testnet/geth/chaindata") + //ethDb, err := ethdb.NewBoltDatabase("/home/akhounov/.ethereum/geth/chaindata") + //ethDb, err := ethdb.NewBoltDatabase("statedb") check(err) defer ethDb.Close() bc, err := core.NewBlockChain(ethDb, nil, params.TestnetChainConfig, ethash.NewFaker(), vm.Config{}, nil) @@ -814,8 +814,8 @@ func testRewind(block, rewind int) { func testStartup() { startTime := time.Now() - //ethDb, err := ethdb.NewLDBDatabase("/Users/alexeyakhunov/Library/Ethereum/geth/chaindata") - ethDb, err := ethdb.NewLDBDatabase("/home/akhounov/.ethereum/geth/chaindata") + //ethDb, err := ethdb.NewBoltDatabase("/Users/alexeyakhunov/Library/Ethereum/geth/chaindata") + ethDb, err := ethdb.NewBoltDatabase("/home/akhounov/.ethereum/geth/chaindata") check(err) defer ethDb.Close() bc, err := core.NewBlockChain(ethDb, nil, params.MainnetChainConfig, ethash.NewFaker(), vm.Config{}, nil) @@ -839,9 +839,9 @@ func testStartup() { func testResolve() { startTime := time.Now() - //ethDb, err := ethdb.NewLDBDatabase("/home/akhounov/.ethereum/geth/chaindata") - //ethDb, err := ethdb.NewLDBDatabase("/Users/alexeyakhunov/Library/Ethereum/geth/chaindata") - ethDb, err := ethdb.NewLDBDatabase("statedb") + //ethDb, err := ethdb.NewBoltDatabase("/home/akhounov/.ethereum/geth/chaindata") + //ethDb, err := ethdb.NewBoltDatabase("/Users/alexeyakhunov/Library/Ethereum/geth/chaindata") + ethDb, err := ethdb.NewBoltDatabase("statedb") check(err) defer ethDb.Close() //treePrefix := common.FromHex("1194e966965418c7d73a42cceeb254d875860356") @@ -950,7 +950,7 @@ func testDifficulty() { } func testBlockHashes() { - ethDb, err := ethdb.NewLDBDatabase("/Users/alexeyakhunov/Library/Ethereum/geth/chaindata") + ethDb, err := ethdb.NewBoltDatabase("/Users/alexeyakhunov/Library/Ethereum/geth/chaindata") check(err) hash := rawdb.ReadCanonicalHash(ethDb, 823144) fmt.Printf("Canonical hash: %x\n", hash) @@ -960,7 +960,7 @@ func testBlockHashes() { } func printTxHashes() { - ethDb, err := ethdb.NewLDBDatabase("/Users/alexeyakhunov/Library/Ethereum/geth/chaindata") + ethDb, err := ethdb.NewBoltDatabase("/Users/alexeyakhunov/Library/Ethereum/geth/chaindata") check(err) defer ethDb.Close() for b := uint64(0); b < uint64(100000); b++ { @@ -997,8 +997,8 @@ func relayoutKeys() { } func upgradeBlocks() { - //ethDb, err := ethdb.NewLDBDatabase("/Users/alexeyakhunov/Library/Ethereum/geth/chaindata") - ethDb, err := ethdb.NewLDBDatabase("/home/akhounov/.ethereum/geth/chaindata") + //ethDb, err := ethdb.NewBoltDatabase("/Users/alexeyakhunov/Library/Ethereum/geth/chaindata") + ethDb, err := ethdb.NewBoltDatabase("/home/akhounov/.ethereum/geth/chaindata") check(err) defer ethDb.Close() start := []byte{} @@ -1069,9 +1069,9 @@ func invTree(wrong, right, diff string, block int, encodeToBytes bool) { } func preimage() { - //ethDb, err := ethdb.NewLDBDatabase("/Users/alexeyakhunov/Library/Ethereum/geth/chaindata") - ethDb, err := ethdb.NewLDBDatabase("/Volumes/tb4/turbo-geth-10/geth/chaindata") - //ethDb, err := ethdb.NewLDBDatabase("/home/akhounov/.ethereum/geth/chaindata") + //ethDb, err := ethdb.NewBoltDatabase("/Users/alexeyakhunov/Library/Ethereum/geth/chaindata") + ethDb, err := ethdb.NewBoltDatabase("/Volumes/tb4/turbo-geth-10/geth/chaindata") + //ethDb, err := ethdb.NewBoltDatabase("/home/akhounov/.ethereum/geth/chaindata") check(err) defer ethDb.Close() p, err := ethDb.Get(trie.SecureKeyPrefix, common.FromHex("0x2a23229958e691340d70ce446e3f3986df5f5289bbe763257e9c2321f7404f87")) @@ -1109,9 +1109,9 @@ func decodeTimestamp(suffix []byte) (uint64, []byte) { } func loadAccount() { - ethDb, err := ethdb.NewLDBDatabase("/home/akhounov/.ethereum/geth/chaindata") - //ethDb, err := ethdb.NewLDBDatabase("/Users/alexeyakhunov/Library/Ethereum/geth/chaindata") - //ethDb, err := ethdb.NewLDBDatabase("/Volumes/tb4/turbo-geth/geth/chaindata") + ethDb, err := ethdb.NewBoltDatabase("/home/akhounov/.ethereum/geth/chaindata") + //ethDb, err := ethdb.NewBoltDatabase("/Users/alexeyakhunov/Library/Ethereum/geth/chaindata") + //ethDb, err := ethdb.NewBoltDatabase("/Volumes/tb4/turbo-geth/geth/chaindata") check(err) defer ethDb.Close() blockNr := uint64(*block) @@ -1290,8 +1290,8 @@ func loadAccount() { } func printBranches(block uint64) { - ethDb, err := ethdb.NewLDBDatabase("/Users/alexeyakhunov/Library/Ethereum/testnet/geth/chaindata") - //ethDb, err := ethdb.NewLDBDatabase("/home/akhounov/.ethereum/geth/chaindata") + ethDb, err := ethdb.NewBoltDatabase("/Users/alexeyakhunov/Library/Ethereum/testnet/geth/chaindata") + //ethDb, err := ethdb.NewBoltDatabase("/home/akhounov/.ethereum/geth/chaindata") check(err) defer ethDb.Close() fmt.Printf("All headers at the same height %d\n", block) @@ -1357,11 +1357,11 @@ func repair() { interruptCh <- true }() - //historyDb, err := ethdb.NewLDBDatabase("/home/akhounov/.ethereum/geth/chaindata") - historyDb, err := ethdb.NewLDBDatabase("/Volumes/tb4/turbo-geth-10/geth/chaindata") - //historyDb, err := ethdb.NewLDBDatabase("/Users/alexeyakhunov/Library/Ethereum/geth/chaindata") - //historyDb, err := ethdb.NewLDBDatabase("/Users/alexeyakhunov/Library/Ethereum/testnet/geth/chaindata") - //historyDb, err := ethdb.NewLDBDatabase("/Volumes/tb4/turbo-geth/ropsten/geth/chaindata") + //historyDb, err := ethdb.NewBoltDatabase("/home/akhounov/.ethereum/geth/chaindata") + historyDb, err := ethdb.NewBoltDatabase("/Volumes/tb4/turbo-geth-10/geth/chaindata") + //historyDb, err := ethdb.NewBoltDatabase("/Users/alexeyakhunov/Library/Ethereum/geth/chaindata") + //historyDb, err := ethdb.NewBoltDatabase("/Users/alexeyakhunov/Library/Ethereum/testnet/geth/chaindata") + //historyDb, err := ethdb.NewBoltDatabase("/Volumes/tb4/turbo-geth/ropsten/geth/chaindata") check(err) defer historyDb.Close() //if *block == 1 { @@ -1432,7 +1432,7 @@ func repair() { } func readAccount() { - ethDb, err := ethdb.NewLDBDatabase("statedb") + ethDb, err := ethdb.NewBoltDatabase("statedb") check(err) accountBytes := common.FromHex(*account) secKey := crypto.Keccak256(accountBytes) diff --git a/cmd/state/deps.go b/cmd/state/deps.go index 084579a337a..26bca9d3971 100644 --- a/cmd/state/deps.go +++ b/cmd/state/deps.go @@ -120,7 +120,7 @@ func dataDependencies() { interruptCh <- true }() - ethDb, err := ethdb.NewLDBDatabase("/Volumes/tb4/turbo-geth-10/geth/chaindata") + ethDb, err := ethdb.NewBoltDatabase("/Volumes/tb4/turbo-geth-10/geth/chaindata") check(err) defer ethDb.Close() chainConfig := params.MainnetChainConfig diff --git a/cmd/state/fee_market.go b/cmd/state/fee_market.go index eba7dbe4443..1f589dd66fe 100644 --- a/cmd/state/fee_market.go +++ b/cmd/state/fee_market.go @@ -26,9 +26,9 @@ func feemarket() { <-sigs interruptCh <- true }() - ethDb, err := ethdb.NewLDBDatabase("/Volumes/tb4/turbo-geth-10/geth/chaindata") - //ethDb, err := ethdb.NewLDBDatabase("/Users/alexeyakhunov/Library/Ethereum/geth/chaindata") - //ethDb, err := ethdb.NewLDBDatabase("/home/akhounov/.ethereum/geth/chaindata1") + ethDb, err := ethdb.NewBoltDatabase("/Volumes/tb4/turbo-geth-10/geth/chaindata") + //ethDb, err := ethdb.NewBoltDatabase("/Users/alexeyakhunov/Library/Ethereum/geth/chaindata") + //ethDb, err := ethdb.NewBoltDatabase("/home/akhounov/.ethereum/geth/chaindata1") check(err) defer ethDb.Close() chainConfig := params.MainnetChainConfig diff --git a/cmd/state/naked_accouts.go b/cmd/state/naked_accouts.go index 90de878a7c3..d9e9b8e2443 100644 --- a/cmd/state/naked_accouts.go +++ b/cmd/state/naked_accouts.go @@ -81,7 +81,7 @@ func accountsReadWrites() { interruptCh <- true }() - ethDb, err := ethdb.NewLDBDatabase("/Volumes/tb41/turbo-geth-10/geth/chaindata") + ethDb, err := ethdb.NewBoltDatabase("/Volumes/tb41/turbo-geth-10/geth/chaindata") check(err) defer ethDb.Close() chainConfig := params.MainnetChainConfig diff --git a/cmd/state/naked_storage.go b/cmd/state/naked_storage.go index 5b90ab0ec78..01eab6b9b3c 100644 --- a/cmd/state/naked_storage.go +++ b/cmd/state/naked_storage.go @@ -109,7 +109,7 @@ func storageReadWrites() { interruptCh <- true }() - ethDb, err := ethdb.NewLDBDatabase("/Volumes/tb41/turbo-geth-10/geth/chaindata") + ethDb, err := ethdb.NewBoltDatabase("/Volumes/tb41/turbo-geth-10/geth/chaindata") check(err) defer ethDb.Close() chainConfig := params.MainnetChainConfig diff --git a/cmd/state/spec_exec.go b/cmd/state/spec_exec.go index 1d07f676fcd..c34406aee33 100644 --- a/cmd/state/spec_exec.go +++ b/cmd/state/spec_exec.go @@ -156,7 +156,7 @@ func speculativeExecution() { interruptCh <- true }() - ethDb, err := ethdb.NewLDBDatabase("/Volumes/tb41/turbo-geth-10/geth/chaindata") + ethDb, err := ethdb.NewBoltDatabase("/Volumes/tb41/turbo-geth-10/geth/chaindata") check(err) defer ethDb.Close() chainConfig := params.MainnetChainConfig diff --git a/cmd/state/state.go b/cmd/state/state.go index 216de4b6720..8e0740fec10 100644 --- a/cmd/state/state.go +++ b/cmd/state/state.go @@ -1014,9 +1014,9 @@ func makeCreators() { interruptCh <- true }() - //ethDb, err := ethdb.NewLDBDatabase("/home/akhounov/.ethereum/geth/chaindata") - ethDb, err := ethdb.NewLDBDatabase("/Volumes/tb41/turbo-geth/geth/chaindata") - //ethDb, err := ethdb.NewLDBDatabase("/Users/alexeyakhunov/Library/Ethereum/geth/chaindata") + //ethDb, err := ethdb.NewBoltDatabase("/home/akhounov/.ethereum/geth/chaindata") + ethDb, err := ethdb.NewBoltDatabase("/Volumes/tb41/turbo-geth/geth/chaindata") + //ethDb, err := ethdb.NewBoltDatabase("/Users/alexeyakhunov/Library/Ethereum/geth/chaindata") check(err) defer ethDb.Close() f, err := os.OpenFile("/Volumes/tb41/turbo-geth/creators.csv", os.O_APPEND|os.O_WRONLY|os.O_CREATE, 0600) @@ -1617,9 +1617,9 @@ func makeSha3Preimages() { interruptCh <- true }() - //ethDb, err := ethdb.NewLDBDatabase("/home/akhounov/.ethereum/geth/chaindata") - ethDb, err := ethdb.NewLDBDatabase("/Volumes/tb4/turbo-geth/geth/chaindata") - //ethDb, err := ethdb.NewLDBDatabase("/Users/alexeyakhunov/Library/Ethereum/geth/chaindata") + //ethDb, err := ethdb.NewBoltDatabase("/home/akhounov/.ethereum/geth/chaindata") + ethDb, err := ethdb.NewBoltDatabase("/Volumes/tb4/turbo-geth/geth/chaindata") + //ethDb, err := ethdb.NewBoltDatabase("/Users/alexeyakhunov/Library/Ethereum/geth/chaindata") check(err) defer ethDb.Close() f, err := bolt.Open("/Volumes/tb4/turbo-geth/sha3preimages", 0600, &bolt.Options{}) diff --git a/cmd/state/state_snapshot.go b/cmd/state/state_snapshot.go index 8621463d7cf..97becc76130 100644 --- a/cmd/state/state_snapshot.go +++ b/cmd/state/state_snapshot.go @@ -411,9 +411,9 @@ func check_roots(stateDb ethdb.Database, db *bolt.DB, rootHash common.Hash, bloc func state_snapshot() { startTime := time.Now() var blockNum uint64 = uint64(*block) - //ethDb, err := ethdb.NewLDBDatabase("/Users/alexeyakhunov/Library/Ethereum/geth/chaindata") - //ethDb, err := ethdb.NewLDBDatabase("/Volumes/tb4/turbo-geth-10/geth/chaindata") - ethDb, err := ethdb.NewLDBDatabase("/home/akhounov/.ethereum/geth/chaindata1") + //ethDb, err := ethdb.NewBoltDatabase("/Users/alexeyakhunov/Library/Ethereum/geth/chaindata") + //ethDb, err := ethdb.NewBoltDatabase("/Volumes/tb4/turbo-geth-10/geth/chaindata") + ethDb, err := ethdb.NewBoltDatabase("/home/akhounov/.ethereum/geth/chaindata1") check(err) defer ethDb.Close() stateDb, db := ethdb.NewMemDatabase2() @@ -488,8 +488,8 @@ func state_snapshot() { } func verify_snapshot() { - //ethDb, err := ethdb.NewLDBDatabase("/Volumes/tb4/turbo-geth-10/geth/chaindata") - ethDb, err := ethdb.NewLDBDatabase("/home/akhounov/.ethereum/geth/chaindata") + //ethDb, err := ethdb.NewBoltDatabase("/Volumes/tb4/turbo-geth-10/geth/chaindata") + ethDb, err := ethdb.NewBoltDatabase("/home/akhounov/.ethereum/geth/chaindata") check(err) defer ethDb.Close() engine := ethash.NewFullFaker() diff --git a/cmd/state/stateless.go b/cmd/state/stateless.go index d41004815f2..64b2fb81957 100644 --- a/cmd/state/stateless.go +++ b/cmd/state/stateless.go @@ -120,9 +120,9 @@ func stateless(genLag, consLag int) { interruptCh <- true }() - //ethDb, err := ethdb.NewLDBDatabase("/Volumes/tb4/turbo-geth-10/geth/chaindata") - //ethDb, err := ethdb.NewLDBDatabase("/Users/alexeyakhunov/Library/Ethereum/geth/chaindata") - ethDb, err := ethdb.NewLDBDatabase("/home/akhounov/.ethereum/geth/chaindata1") + //ethDb, err := ethdb.NewBoltDatabase("/Volumes/tb4/turbo-geth-10/geth/chaindata") + //ethDb, err := ethdb.NewBoltDatabase("/Users/alexeyakhunov/Library/Ethereum/geth/chaindata") + ethDb, err := ethdb.NewBoltDatabase("/home/akhounov/.ethereum/geth/chaindata1") check(err) defer ethDb.Close() chainConfig := params.MainnetChainConfig diff --git a/cmd/state/tokens.go b/cmd/state/tokens.go index 936b5cf778b..56400805364 100644 --- a/cmd/state/tokens.go +++ b/cmd/state/tokens.go @@ -119,9 +119,9 @@ func makeTokens() { interruptCh <- true }() - //ethDb, err := ethdb.NewLDBDatabase("/home/akhounov/.ethereum/geth/chaindata") - ethDb, err := ethdb.NewLDBDatabase("/Volumes/tb41/turbo-geth/geth/chaindata") - //ethDb, err := ethdb.NewLDBDatabase("/Users/alexeyakhunov/Library/Ethereum/geth/chaindata") + //ethDb, err := ethdb.NewBoltDatabase("/home/akhounov/.ethereum/geth/chaindata") + ethDb, err := ethdb.NewBoltDatabase("/Volumes/tb41/turbo-geth/geth/chaindata") + //ethDb, err := ethdb.NewBoltDatabase("/Users/alexeyakhunov/Library/Ethereum/geth/chaindata") check(err) defer ethDb.Close() chainConfig := params.MainnetChainConfig @@ -182,9 +182,9 @@ func makeTokens() { } func makeTokenBalances() { - //ethDb, err := ethdb.NewLDBDatabase("/home/akhounov/.ethereum/geth/chaindata") - ethDb, err := ethdb.NewLDBDatabase("/Volumes/tb41/turbo-geth/geth/chaindata") - //ethDb, err := ethdb.NewLDBDatabase("/Users/alexeyakhunov/Library/Ethereum/geth/chaindata") + //ethDb, err := ethdb.NewBoltDatabase("/home/akhounov/.ethereum/geth/chaindata") + ethDb, err := ethdb.NewBoltDatabase("/Volumes/tb41/turbo-geth/geth/chaindata") + //ethDb, err := ethdb.NewBoltDatabase("/Users/alexeyakhunov/Library/Ethereum/geth/chaindata") check(err) defer ethDb.Close() bc, err := core.NewBlockChain(ethDb, nil, params.MainnetChainConfig, ethash.NewFaker(), vm.Config{}, nil) @@ -405,9 +405,9 @@ func tokenBalances() { } func makeTokenAllowances() { - //ethDb, err := ethdb.NewLDBDatabase("/home/akhounov/.ethereum/geth/chaindata") - ethDb, err := ethdb.NewLDBDatabase("/Volumes/tb41/turbo-geth/geth/chaindata") - //ethDb, err := ethdb.NewLDBDatabase("/Users/alexeyakhunov/Library/Ethereum/geth/chaindata") + //ethDb, err := ethdb.NewBoltDatabase("/home/akhounov/.ethereum/geth/chaindata") + ethDb, err := ethdb.NewBoltDatabase("/Volumes/tb41/turbo-geth/geth/chaindata") + //ethDb, err := ethdb.NewBoltDatabase("/Users/alexeyakhunov/Library/Ethereum/geth/chaindata") check(err) defer ethDb.Close() bc, err := core.NewBlockChain(ethDb, nil, params.MainnetChainConfig, ethash.NewFaker(), vm.Config{}, nil) diff --git a/cmd/state/transaction_stats.go b/cmd/state/transaction_stats.go index 571d1f36c80..a9a68606781 100644 --- a/cmd/state/transaction_stats.go +++ b/cmd/state/transaction_stats.go @@ -165,9 +165,9 @@ func transaction_stats() { interruptCh <- true }() - ethDb, err := ethdb.NewLDBDatabase("/home/akhounov/.ethereum/geth/chaindata") - //ethDb, err := ethdb.NewLDBDatabase("/Volumes/tb41/turbo-geth/geth/chaindata") - //ethDb, err := ethdb.NewLDBDatabase("/Users/alexeyakhunov/Library/Ethereum/geth/chaindata") + ethDb, err := ethdb.NewBoltDatabase("/home/akhounov/.ethereum/geth/chaindata") + //ethDb, err := ethdb.NewBoltDatabase("/Volumes/tb41/turbo-geth/geth/chaindata") + //ethDb, err := ethdb.NewBoltDatabase("/Users/alexeyakhunov/Library/Ethereum/geth/chaindata") check(err) defer ethDb.Close() f, err := os.OpenFile("txs.csv", os.O_APPEND|os.O_WRONLY|os.O_CREATE, 0600) diff --git a/cmd/utils/cmd.go b/cmd/utils/cmd.go index 847198e0bb4..5610e1e5ab1 100644 --- a/cmd/utils/cmd.go +++ b/cmd/utils/cmd.go @@ -238,7 +238,7 @@ func ExportAppendChain(blockchain *core.BlockChain, fn string, first uint64, las } // ImportPreimages imports a batch of exported hash preimages into the database. -func ImportPreimages(db *ethdb.LDBDatabase, fn string) error { +func ImportPreimages(db *ethdb.BoltDatabase, fn string) error { log.Info("Importing preimages", "file", fn) // Open the file handle and potentially unwrap the gzip stream @@ -285,7 +285,7 @@ func ImportPreimages(db *ethdb.LDBDatabase, fn string) error { // ExportPreimages exports all known hash preimages into the specified file, // truncating any data already present in the file. -func ExportPreimages(db *ethdb.LDBDatabase, fn string) error { +func ExportPreimages(db *ethdb.BoltDatabase, fn string) error { log.Info("Exporting preimages", "file", fn) // Open the file handle and potentially wrap with a gzip stream diff --git a/core/bench_test.go b/core/bench_test.go index 63ce61ef192..d076d0e0b48 100644 --- a/core/bench_test.go +++ b/core/bench_test.go @@ -157,7 +157,7 @@ func benchInsertChain(b *testing.B, disk bool, gen func(int, *BlockGen)) { b.Fatalf("cannot create temporary directory: %v", err) } defer os.RemoveAll(dir) - db, err = ethdb.NewLDBDatabase(dir) + db, err = ethdb.NewBoltDatabase(dir) if err != nil { b.Fatalf("cannot create temporary database: %v", err) } @@ -255,7 +255,7 @@ func benchWriteChain(b *testing.B, full bool, count uint64) { if err != nil { b.Fatalf("cannot create temporary directory: %v", err) } - db, err := ethdb.NewLDBDatabase(dir) + db, err := ethdb.NewBoltDatabase(dir) if err != nil { b.Fatalf("error opening database at %v: %v", dir, err) } @@ -272,7 +272,7 @@ func benchReadChain(b *testing.B, full bool, count uint64) { } defer os.RemoveAll(dir) - db, err := ethdb.NewLDBDatabase(dir) + db, err := ethdb.NewBoltDatabase(dir) if err != nil { b.Fatalf("error opening database at %v: %v", dir, err) } @@ -283,7 +283,7 @@ func benchReadChain(b *testing.B, full bool, count uint64) { b.ResetTimer() for i := 0; i < b.N; i++ { - db, err := ethdb.NewLDBDatabase(dir) + db, err := ethdb.NewBoltDatabase(dir) if err != nil { b.Fatalf("error opening database at %v: %v", dir, err) } diff --git a/eth/filters/bench_test.go b/eth/filters/bench_test.go index 2bf37beb131..7b50e3868b5 100644 --- a/eth/filters/bench_test.go +++ b/eth/filters/bench_test.go @@ -66,7 +66,7 @@ func benchmarkBloomBits(b *testing.B, sectionSize uint64) { benchDataDir := node.DefaultDataDir() + "/geth/chaindata" fmt.Println("Running bloombits benchmark section size:", sectionSize) - db, err := ethdb.NewLDBDatabase(benchDataDir) + db, err := ethdb.NewBoltDatabase(benchDataDir) if err != nil { b.Fatalf("error opening database at %v: %v", benchDataDir, err) } @@ -128,7 +128,7 @@ func benchmarkBloomBits(b *testing.B, sectionSize uint64) { for i := 0; i < benchFilterCnt; i++ { if i%20 == 0 { db.Close() - db, _ = ethdb.NewLDBDatabase(benchDataDir) + db, _ = ethdb.NewBoltDatabase(benchDataDir) backend = &testBackend{mux, db, cnt, new(event.Feed), new(event.Feed), new(event.Feed), new(event.Feed)} } var addr common.Address @@ -149,13 +149,13 @@ var bloomBitsPrefix = []byte("BloomBits") func clearBloomBits(db ethdb.Database) { fmt.Println("Clearing bloombits data...") - db.(*ethdb.LDBDatabase).DeleteBucket(bloomBitsPrefix) + db.(*ethdb.BoltDatabase).DeleteBucket(bloomBitsPrefix) } func BenchmarkNoBloomBits(b *testing.B) { benchDataDir := node.DefaultDataDir() + "/geth/chaindata" fmt.Println("Running benchmark without bloombits") - db, err := ethdb.NewLDBDatabase(benchDataDir) + db, err := ethdb.NewBoltDatabase(benchDataDir) if err != nil { b.Fatalf("error opening database at %v: %v", benchDataDir, err) } diff --git a/eth/filters/filter_test.go b/eth/filters/filter_test.go index abcb0ed3602..31f809ba366 100644 --- a/eth/filters/filter_test.go +++ b/eth/filters/filter_test.go @@ -51,7 +51,7 @@ func BenchmarkFilters(b *testing.B) { defer os.RemoveAll(dir) var ( - db, _ = ethdb.NewLDBDatabase(dir) + db, _ = ethdb.NewBoltDatabase(dir) mux = new(event.TypeMux) txFeed = new(event.Feed) rmLogsFeed = new(event.Feed) @@ -110,7 +110,7 @@ func TestFilters(t *testing.T) { defer os.RemoveAll(dir) var ( - db, _ = ethdb.NewLDBDatabase(dir) + db, _ = ethdb.NewBoltDatabase(dir) mux = new(event.TypeMux) txFeed = new(event.Feed) rmLogsFeed = new(event.Feed) diff --git a/eth/handler_test.go b/eth/handler_test.go index 3c6076ac479..802d26cf38c 100644 --- a/eth/handler_test.go +++ b/eth/handler_test.go @@ -27,7 +27,6 @@ import ( "github.com/ledgerwatch/turbo-geth/common" "github.com/ledgerwatch/turbo-geth/consensus/ethash" "github.com/ledgerwatch/turbo-geth/core" - "github.com/ledgerwatch/turbo-geth/core/state" "github.com/ledgerwatch/turbo-geth/core/types" "github.com/ledgerwatch/turbo-geth/core/vm" "github.com/ledgerwatch/turbo-geth/crypto" @@ -298,99 +297,6 @@ func testGetBlockBodies(t *testing.T, protocol int) { } } -// Tests that the node state database can be retrieved based on hashes. -//func TestGetNodeData63(t *testing.T) { testGetNodeData(t, 63) } - -func testGetNodeData(t *testing.T, protocol int) { - // Define three accounts to simulate transactions with - acc1Key, _ := crypto.HexToECDSA("8a1f9a8f95be41cd7ccb6168179afb4504aefe388d1e14474d32c45c72ce7b7a") - acc2Key, _ := crypto.HexToECDSA("49a7b37aa6f6645917e7b807e9d1c00d4fa71f18343b0d4122a4d2df64dd6fee") - acc1Addr := crypto.PubkeyToAddress(acc1Key.PublicKey) - acc2Addr := crypto.PubkeyToAddress(acc2Key.PublicKey) - - signer := types.HomesteadSigner{} - // Create a chain generator with some simple transactions (blatantly stolen from @fjl/chain_markets_test) - generator := func(i int, block *core.BlockGen) { - switch i { - case 0: - // In block 1, the test bank sends account #1 some ether. - tx, _ := types.SignTx(types.NewTransaction(block.TxNonce(testBank), acc1Addr, big.NewInt(10000), params.TxGas, nil, nil), signer, testBankKey) - block.AddTx(tx) - case 1: - // In block 2, the test bank sends some more ether to account #1. - // acc1Addr passes it on to account #2. - tx1, _ := types.SignTx(types.NewTransaction(block.TxNonce(testBank), acc1Addr, big.NewInt(1000), params.TxGas, nil, nil), signer, testBankKey) - tx2, _ := types.SignTx(types.NewTransaction(block.TxNonce(acc1Addr), acc2Addr, big.NewInt(1000), params.TxGas, nil, nil), signer, acc1Key) - block.AddTx(tx1) - block.AddTx(tx2) - case 2: - // Block 3 is empty but was mined by account #2. - block.SetCoinbase(acc2Addr) - block.SetExtra([]byte("yeehaw")) - case 3: - // Block 4 includes blocks 2 and 3 as uncle headers (with modified extra data). - b2 := block.PrevBlock(1).Header() - b2.Extra = []byte("foo") - block.AddUncle(b2) - b3 := block.PrevBlock(2).Header() - b3.Extra = []byte("foo") - block.AddUncle(b3) - } - } - // Assemble the test environment - pm, db := newTestProtocolManagerMust(t, downloader.FullSync, 4, generator, nil) - peer, _ := newTestPeer("peer", protocol, pm, true) - defer peer.close() - - // Fetch for now the entire chain db - hashes := []common.Hash{} - for _, key := range db.Keys() { - if len(key) == len(common.Hash{}) { - hashes = append(hashes, common.BytesToHash(key)) - } - } - p2p.Send(peer.app, 0x0d, hashes) - msg, err := peer.app.ReadMsg() - if err != nil { - t.Fatalf("failed to read node data response: %v", err) - } - if msg.Code != 0x0e { - t.Fatalf("response packet code mismatch: have %x, want %x", msg.Code, 0x0c) - } - var data [][]byte - if err := msg.Decode(&data); err != nil { - t.Fatalf("failed to decode response node data: %v", err) - } - // Verify that all hashes correspond to the requested data, and reconstruct a state tree - for i, want := range hashes { - if hash := crypto.Keccak256Hash(data[i]); hash != want { - t.Errorf("data hash mismatch: have %x, want %x", hash, want) - } - } - statedb := ethdb.NewMemDatabase() - for i := 0; i < len(data); i++ { - statedb.Put(nil, hashes[i].Bytes(), data[i]) - } - accounts := []common.Address{testBank, acc1Addr, acc2Addr} - for i := uint64(0); i <= pm.blockchain.CurrentBlock().NumberU64(); i++ { - tds, _ := state.NewTrieDbState(pm.blockchain.GetBlockByNumber(i).Root(), statedb, i) - trie := state.New(tds) - - for j, acc := range accounts { - state, _, _ := pm.blockchain.State() - bw := state.GetBalance(acc) - bh := trie.GetBalance(acc) - - if (bw != nil && bh == nil) || (bw == nil && bh != nil) { - t.Errorf("test %d, account %d: balance mismatch: have %v, want %v", i, j, bh, bw) - } - if bw != nil && bh != nil && bw.Cmp(bw) != 0 { - t.Errorf("test %d, account %d: balance mismatch: have %v, want %v", i, j, bh, bw) - } - } - } -} - // Tests that the transaction receipts can be retrieved based on hashes. func TestGetReceipt63(t *testing.T) { testGetReceipt(t, 63) } diff --git a/eth/helper_test.go b/eth/helper_test.go index b8fc736fad3..583fd2a1d18 100644 --- a/eth/helper_test.go +++ b/eth/helper_test.go @@ -49,7 +49,7 @@ var ( // newTestProtocolManager creates a new protocol manager for testing purposes, // with the given number of blocks already known, and potential notification // channels for different events. -func newTestProtocolManager(mode downloader.SyncMode, blocks int, generator func(int, *core.BlockGen), newtx chan<- []*types.Transaction) (*ProtocolManager, ethdb.Mutation, error) { +func newTestProtocolManager(mode downloader.SyncMode, blocks int, generator func(int, *core.BlockGen), newtx chan<- []*types.Transaction) (*ProtocolManager, ethdb.Database, error) { var ( evmux = new(event.TypeMux) engine = ethash.NewFaker() @@ -78,7 +78,7 @@ func newTestProtocolManager(mode downloader.SyncMode, blocks int, generator func // with the given number of blocks already known, and potential notification // channels for different events. In case of an error, the constructor force- // fails the test. -func newTestProtocolManagerMust(t *testing.T, mode downloader.SyncMode, blocks int, generator func(int, *core.BlockGen), newtx chan<- []*types.Transaction) (*ProtocolManager, ethdb.Mutation) { +func newTestProtocolManagerMust(t *testing.T, mode downloader.SyncMode, blocks int, generator func(int, *core.BlockGen), newtx chan<- []*types.Transaction) (*ProtocolManager, ethdb.Database) { pm, db, err := newTestProtocolManager(mode, blocks, generator, newtx) if err != nil { t.Fatalf("Failed to create protocol manager: %v", err) diff --git a/ethdb/database.go b/ethdb/database.go index 77e59119aa5..2766fb659dd 100644 --- a/ethdb/database.go +++ b/ethdb/database.go @@ -40,7 +40,7 @@ var SuffixBucket = []byte("SUFFIX") const HeapSize = 512 * 1024 * 1024 -type LDBDatabase struct { +type BoltDatabase struct { fn string // filename for reporting db *bolt.DB // BoltDB instance @@ -50,8 +50,8 @@ type LDBDatabase struct { log log.Logger // Contextual logger tracking the database path } -// NewLDBDatabase returns a LevelDB wrapped object. -func NewLDBDatabase(file string) (*LDBDatabase, error) { +// NewBoltDatabase returns a LevelDB wrapped object. +func NewBoltDatabase(file string) (*BoltDatabase, error) { logger := log.New("database", file) // Create necessary directories @@ -64,7 +64,7 @@ func NewLDBDatabase(file string) (*LDBDatabase, error) { if err != nil { return nil, err } - return &LDBDatabase{ + return &BoltDatabase{ fn: file, db: db, log: logger, @@ -72,12 +72,12 @@ func NewLDBDatabase(file string) (*LDBDatabase, error) { } // Path returns the path to the database directory. -func (db *LDBDatabase) Path() string { +func (db *BoltDatabase) Path() string { return db.fn } // Put puts the given key / value to the queue -func (db *LDBDatabase) Put(bucket, key []byte, value []byte) error { +func (db *BoltDatabase) Put(bucket, key []byte, value []byte) error { err := db.db.Update(func(tx *bolt.Tx) error { b, err := tx.CreateBucketIfNotExists(bucket, true) if err != nil { @@ -104,7 +104,7 @@ func historyBucket(bucket []byte) []byte { } // Put puts the given key / value to the queue -func (db *LDBDatabase) PutS(hBucket, key, value []byte, timestamp uint64) error { +func (db *BoltDatabase) PutS(hBucket, key, value []byte, timestamp uint64) error { composite, suffix := compositeKeySuffix(key, timestamp) suffixkey := make([]byte, len(suffix)+len(hBucket)) copy(suffixkey, suffix) @@ -137,7 +137,7 @@ func (db *LDBDatabase) PutS(hBucket, key, value []byte, timestamp uint64) error return err } -func (db *LDBDatabase) MultiPut(tuples ...[]byte) (uint64, error) { +func (db *BoltDatabase) MultiPut(tuples ...[]byte) (uint64, error) { var savedTx *bolt.Tx err := db.db.Update(func(tx *bolt.Tx) error { for bucketStart := 0; bucketStart < len(tuples); { @@ -168,7 +168,7 @@ func (db *LDBDatabase) MultiPut(tuples ...[]byte) (uint64, error) { return uint64(savedTx.Stats().Write), nil } -func (db *LDBDatabase) Has(bucket, key []byte) (bool, error) { +func (db *BoltDatabase) Has(bucket, key []byte) (bool, error) { var has bool err := db.db.View(func(tx *bolt.Tx) error { b := tx.Bucket(bucket) @@ -183,12 +183,12 @@ func (db *LDBDatabase) Has(bucket, key []byte) (bool, error) { return has, err } -func (db *LDBDatabase) Size() int { +func (db *BoltDatabase) Size() int { return db.db.Size() } // Get returns the given key if it's present. -func (db *LDBDatabase) Get(bucket, key []byte) ([]byte, error) { +func (db *BoltDatabase) Get(bucket, key []byte) ([]byte, error) { // Retrieve the key and increment the miss counter if not found var dat []byte err := db.db.View(func(tx *bolt.Tx) error { @@ -208,14 +208,14 @@ func (db *LDBDatabase) Get(bucket, key []byte) ([]byte, error) { return dat, err } -func (db *LDBDatabase) GetS(hBucket, key []byte, timestamp uint64) ([]byte, error) { +func (db *BoltDatabase) GetS(hBucket, key []byte, timestamp uint64) ([]byte, error) { composite, _ := compositeKeySuffix(key, timestamp) return db.Get(hBucket, composite) } // GetAsOf returns the first pair (k, v) where key is a prefix of k, or nil // if there are not such (k, v) -func (db *LDBDatabase) GetAsOf(bucket, hBucket, key []byte, timestamp uint64) ([]byte, error) { +func (db *BoltDatabase) GetAsOf(bucket, hBucket, key []byte, timestamp uint64) ([]byte, error) { composite, _ := compositeKeySuffix(key, timestamp) var dat []byte err := db.db.View(func(tx *bolt.Tx) error { @@ -260,7 +260,7 @@ func bytesmask(fixedbits uint) (fixedbytes int, mask byte) { return fixedbytes, mask } -func (db *LDBDatabase) Walk(bucket, startkey []byte, fixedbits uint, walker func(k, v []byte) (bool, error)) error { +func (db *BoltDatabase) Walk(bucket, startkey []byte, fixedbits uint, walker func(k, v []byte) (bool, error)) error { fixedbytes, mask := bytesmask(fixedbits) err := db.db.View(func(tx *bolt.Tx) error { b := tx.Bucket(bucket) @@ -284,7 +284,7 @@ func (db *LDBDatabase) Walk(bucket, startkey []byte, fixedbits uint, walker func return err } -func (db *LDBDatabase) MultiWalk(bucket []byte, startkeys [][]byte, fixedbits []uint, walker func(int, []byte, []byte) (bool, error)) error { +func (db *BoltDatabase) MultiWalk(bucket []byte, startkeys [][]byte, fixedbits []uint, walker func(int, []byte, []byte) (bool, error)) error { if len(startkeys) == 0 { return nil } @@ -356,7 +356,7 @@ func (db *LDBDatabase) MultiWalk(bucket []byte, startkeys [][]byte, fixedbits [] return nil } -func (db *LDBDatabase) WalkAsOf(bucket, hBucket, startkey []byte, fixedbits uint, timestamp uint64, walker func([]byte, []byte) (bool, error)) error { +func (db *BoltDatabase) WalkAsOf(bucket, hBucket, startkey []byte, fixedbits uint, timestamp uint64, walker func([]byte, []byte) (bool, error)) error { fixedbytes, mask := bytesmask(fixedbits) suffix := encodeTimestamp(timestamp) l := len(startkey) @@ -430,7 +430,7 @@ func (db *LDBDatabase) WalkAsOf(bucket, hBucket, startkey []byte, fixedbits uint return err } -func (db *LDBDatabase) MultiWalkAsOf(bucket, hBucket []byte, startkeys [][]byte, fixedbits []uint, timestamp uint64, walker func(int, []byte, []byte) (bool, error)) error { +func (db *BoltDatabase) MultiWalkAsOf(bucket, hBucket []byte, startkeys [][]byte, fixedbits []uint, timestamp uint64, walker func(int, []byte, []byte) (bool, error)) error { if len(startkeys) == 0 { return nil } @@ -585,12 +585,12 @@ func (db *LDBDatabase) MultiWalkAsOf(bucket, hBucket []byte, startkeys [][]byte, return nil } -func (db *LDBDatabase) RewindData(timestampSrc, timestampDst uint64, df func(hBucket, key, value []byte) error) error { +func (db *BoltDatabase) RewindData(timestampSrc, timestampDst uint64, df func(hBucket, key, value []byte) error) error { return rewindData(db, timestampSrc, timestampDst, df) } // Delete deletes the key from the queue and database -func (db *LDBDatabase) Delete(bucket, key []byte) error { +func (db *BoltDatabase) Delete(bucket, key []byte) error { // Execute the actual operation err := db.db.Update(func(tx *bolt.Tx) error { b := tx.Bucket(bucket) @@ -604,7 +604,7 @@ func (db *LDBDatabase) Delete(bucket, key []byte) error { } // Deletes all keys with specified suffix from all the buckets -func (db *LDBDatabase) DeleteTimestamp(timestamp uint64) error { +func (db *BoltDatabase) DeleteTimestamp(timestamp uint64) error { suffix := encodeTimestamp(timestamp) err := db.db.Update(func(tx *bolt.Tx) error { sb := tx.Bucket(SuffixBucket) @@ -642,7 +642,7 @@ func (db *LDBDatabase) DeleteTimestamp(timestamp uint64) error { return err } -func (db *LDBDatabase) DeleteBucket(bucket []byte) error { +func (db *BoltDatabase) DeleteBucket(bucket []byte) error { err := db.db.Update(func(tx *bolt.Tx) error { if err := tx.DeleteBucket(bucket); err != nil { return err @@ -652,7 +652,7 @@ func (db *LDBDatabase) DeleteBucket(bucket []byte) error { return err } -func (db *LDBDatabase) Close() { +func (db *BoltDatabase) Close() { // Stop the metrics collection to avoid internal database races db.quitLock.Lock() defer db.quitLock.Unlock() @@ -688,7 +688,7 @@ type mutation struct { db Database } -func (db *LDBDatabase) NewBatch() Mutation { +func (db *BoltDatabase) NewBatch() Mutation { m := &mutation{ db: db, puts: make(map[string]*llrb.LLRB), diff --git a/ethdb/database_js.go b/ethdb/database_js.go index ba6eeb5a237..3487a352577 100644 --- a/ethdb/database_js.go +++ b/ethdb/database_js.go @@ -24,45 +24,45 @@ import ( var errNotSupported = errors.New("ethdb: not supported") -type LDBDatabase struct { +type BoltDatabase struct { } -// NewLDBDatabase returns a LevelDB wrapped object. -func NewLDBDatabase(file string, cache int, handles int) (*LDBDatabase, error) { +// NewBoltDatabase returns a LevelDB wrapped object. +func NewBoltDatabase(file string, cache int, handles int) (*BoltDatabase, error) { return nil, errNotSupported } // Path returns the path to the database directory. -func (db *LDBDatabase) Path() string { +func (db *BoltDatabase) Path() string { return "" } // Put puts the given key / value to the queue -func (db *LDBDatabase) Put(key []byte, value []byte) error { +func (db *BoltDatabase) Put(key []byte, value []byte) error { return errNotSupported } -func (db *LDBDatabase) Has(key []byte) (bool, error) { +func (db *BoltDatabase) Has(key []byte) (bool, error) { return false, errNotSupported } // Get returns the given key if it's present. -func (db *LDBDatabase) Get(key []byte) ([]byte, error) { +func (db *BoltDatabase) Get(key []byte) ([]byte, error) { return nil, errNotSupported } // Delete deletes the key from the queue and database -func (db *LDBDatabase) Delete(key []byte) error { +func (db *BoltDatabase) Delete(key []byte) error { return errNotSupported } -func (db *LDBDatabase) Close() { +func (db *BoltDatabase) Close() { } // Meter configures the database metrics collectors and -func (db *LDBDatabase) Meter(prefix string) { +func (db *BoltDatabase) Meter(prefix string) { } -func (db *LDBDatabase) NewBatch() Batch { +func (db *BoltDatabase) NewBatch() Batch { return nil } diff --git a/ethdb/database_js_test.go b/ethdb/database_js_test.go index c6078a59734..e72e11867ad 100644 --- a/ethdb/database_js_test.go +++ b/ethdb/database_js_test.go @@ -22,4 +22,4 @@ import ( "github.com/ledgerwatch/turbo-geth/ethdb" ) -var _ ethdb.Database = ðdb.LDBDatabase{} +var _ ethdb.Database = ðdb.BoltDatabase{} diff --git a/ethdb/database_test.go b/ethdb/database_test.go index a1d153b9a11..df2cdfd6d5d 100644 --- a/ethdb/database_test.go +++ b/ethdb/database_test.go @@ -29,12 +29,12 @@ import ( "testing" ) -func newTestLDB() (*LDBDatabase, func()) { +func newTestLDB() (*BoltDatabase, func()) { dirname, err := ioutil.TempDir(os.TempDir(), "ethdb_test_") if err != nil { panic("failed to create test file: " + err.Error()) } - db, err := NewLDBDatabase(path.Join(dirname, "db")) + db, err := NewBoltDatabase(path.Join(dirname, "db")) if err != nil { panic("failed to create test database: " + err.Error()) } diff --git a/ethdb/memory_database.go b/ethdb/memory_database.go index f0570bf527e..816c1cdef62 100644 --- a/ethdb/memory_database.go +++ b/ethdb/memory_database.go @@ -22,7 +22,7 @@ import ( "github.com/ledgerwatch/turbo-geth/log" ) -func NewMemDatabase() *LDBDatabase { +func NewMemDatabase() *BoltDatabase { logger := log.New("database", "in-memory") // Open the db and recover any potential corruptions @@ -30,14 +30,14 @@ func NewMemDatabase() *LDBDatabase { if err != nil { panic(err) } - return &LDBDatabase{ + return &BoltDatabase{ fn: "in-memory", db: db, log: logger, } } -func NewMemDatabase2() (*LDBDatabase, *bolt.DB) { +func NewMemDatabase2() (*BoltDatabase, *bolt.DB) { logger := log.New("database", "in-memory") // Open the db and recover any potential corruptions @@ -45,7 +45,7 @@ func NewMemDatabase2() (*LDBDatabase, *bolt.DB) { if err != nil { panic(err) } - return &LDBDatabase{ + return &BoltDatabase{ fn: "in-memory", db: db, log: logger, diff --git a/node/node.go b/node/node.go index 5aba369b787..10de73abd6e 100644 --- a/node/node.go +++ b/node/node.go @@ -605,7 +605,7 @@ func (n *Node) OpenDatabase(name string) (ethdb.Database, error) { if n.config.DataDir == "" { return ethdb.NewMemDatabase(), nil } - return ethdb.NewLDBDatabase(n.config.ResolvePath(name)) + return ethdb.NewBoltDatabase(n.config.ResolvePath(name)) } // ResolvePath returns the absolute path of a resource in the instance directory. diff --git a/node/service.go b/node/service.go index bbb5ec7c0e5..c87f8392b6b 100644 --- a/node/service.go +++ b/node/service.go @@ -43,7 +43,7 @@ func (ctx *ServiceContext) OpenDatabase(name string) (ethdb.Database, error) { if ctx.config.DataDir == "" { return ethdb.NewMemDatabase(), nil } - db, err := ethdb.NewLDBDatabase(ctx.config.ResolvePath(name)) + db, err := ethdb.NewBoltDatabase(ctx.config.ResolvePath(name)) if err != nil { return nil, err } diff --git a/trie/trie_test.go b/trie/trie_test.go index 19a91f77079..5fc46efcb02 100644 --- a/trie/trie_test.go +++ b/trie/trie_test.go @@ -433,7 +433,7 @@ func benchGet(b *testing.B, commit bool) { b.StopTimer() if commit { - ldb := tmpdb.(*ethdb.LDBDatabase) + ldb := tmpdb.(*ethdb.BoltDatabase) ldb.Close() os.RemoveAll(ldb.Path()) } @@ -489,7 +489,7 @@ func tempDB() (string, ethdb.Database) { if err != nil { panic(fmt.Sprintf("can't create temporary directory: %v", err)) } - diskdb, err := ethdb.NewLDBDatabase(dir, 256) + diskdb, err := ethdb.NewBoltDatabase(dir, 256) if err != nil { panic(fmt.Sprintf("can't create temporary database: %v", err)) }