diff --git a/blockchain/storagev2/leveldb/leveldb.go b/blockchain/storagev2/leveldb/leveldb.go index 73f1e05784..ff56ebd2f0 100644 --- a/blockchain/storagev2/leveldb/leveldb.go +++ b/blockchain/storagev2/leveldb/leveldb.go @@ -13,19 +13,16 @@ type levelDB struct { } var tableMapper = map[uint8][]byte{ - // Main DB - storagev2.BODY: []byte("b"), // DB key = block number + block hash + mapper, value = block body - storagev2.DIFFICULTY: []byte("d"), // DB key = block number + block hash + mapper, value = block total diffculty - storagev2.HEADER: []byte("h"), // DB key = block number + block hash + mapper, value = block header - storagev2.RECEIPTS: []byte("r"), // DB key = block number + block hash + mapper, value = block receipts - storagev2.CANONICAL: {}, // DB key = block number + mapper, value = block hash - - // Lookup DB - storagev2.FORK: {}, // DB key = FORK_KEY + mapper, value = fork hashes - storagev2.HEAD_HASH: {}, // DB key = HEAD_HASH_KEY + mapper, value = head hash - storagev2.HEAD_NUMBER: {}, // DB key = HEAD_NUMBER_KEY + mapper, value = head number - storagev2.BLOCK_LOOKUP: {}, // DB key = block hash + mapper, value = block number - storagev2.TX_LOOKUP: {}, // DB key = tx hash + mapper, value = block number + storagev2.BODY: []byte("b"), // DB key = block number + block hash + mapper, value = block body + storagev2.DIFFICULTY: []byte("d"), // DB key = block number + block hash + mapper, value = block total diffculty + storagev2.HEADER: []byte("h"), // DB key = block number + block hash + mapper, value = block header + storagev2.RECEIPTS: []byte("r"), // DB key = block number + block hash + mapper, value = block receipts + storagev2.CANONICAL: {}, // DB key = block number + mapper, value = block hash + storagev2.FORK: {}, // DB key = FORK_KEY + mapper, value = fork hashes + storagev2.HEAD_HASH: {}, // DB key = HEAD_HASH_KEY + mapper, value = head hash + storagev2.HEAD_NUMBER: {}, // DB key = HEAD_NUMBER_KEY + mapper, value = head number + storagev2.BLOCK_LOOKUP: {}, // DB key = block hash + mapper, value = block number + storagev2.TX_LOOKUP: {}, // DB key = tx hash + mapper, value = block number } // NewLevelDBStorage creates the new storage reference with leveldb default options @@ -44,21 +41,8 @@ func NewLevelDBStorage(path string, logger hclog.Logger) (*storagev2.Storage, er return nil, err } - // Open Lookup - // Set default options - options = &opt.Options{ - BlockCacheCapacity: 64 * opt.MiB, - WriteBuffer: opt.DefaultWriteBuffer, - } - path += "/lookup" - - lookup, err := openLevelDBStorage(path, options) - if err != nil { - return nil, err - } - ldbs[0] = &levelDB{maindb} - ldbs[1] = &levelDB{lookup} + ldbs[1] = nil return storagev2.Open(logger.Named("leveldb"), ldbs) } diff --git a/blockchain/storagev2/storage.go b/blockchain/storagev2/storage.go index eff6aada80..7a60ddf7fe 100644 --- a/blockchain/storagev2/storage.go +++ b/blockchain/storagev2/storage.go @@ -1,4 +1,3 @@ -//nolint:stylecheck package storagev2 import ( @@ -39,6 +38,8 @@ const ( ) // Lookup tables +// +//nolint:stylecheck // needed because linter considers _ in name as an error const ( FORK = uint8(0) | LOOKUP_INDEX HEAD_HASH = uint8(2) | LOOKUP_INDEX @@ -47,14 +48,18 @@ const ( TX_LOOKUP = uint8(8) | LOOKUP_INDEX ) +//nolint:stylecheck // needed because linter considers _ in name as an error const MAX_TABLES = uint8(20) // Database indexes +// +//nolint:stylecheck // needed because linter considers _ in name as an error const ( MAINDB_INDEX = uint8(0) LOOKUP_INDEX = uint8(1) ) +//nolint:stylecheck // needed because linter considers _ in name as an error var ( FORK_KEY = []byte("0000000f") HEAD_HASH_KEY = []byte("0000000h")