forked from cerc-io/plugeth
core, eth, les, tests, trie: abstract node scheme (#25532)
This PR introduces a node scheme abstraction. The interface is only implemented by `hashScheme` at the moment, but will be extended by `pathScheme` very soon. Apart from that, a few changes are also included which is worth mentioning: - port the changes in the stacktrie, tracking the path prefix of nodes during commit - use ethdb.Database for constructing trie.Database. This is not necessary right now, but it is required for path-based used to open reverse diff freezer
This commit is contained in:
@@ -327,7 +327,7 @@ func TestIteratorContinueAfterErrorDisk(t *testing.T) { testIteratorContinueA
|
||||
func TestIteratorContinueAfterErrorMemonly(t *testing.T) { testIteratorContinueAfterError(t, true) }
|
||||
|
||||
func testIteratorContinueAfterError(t *testing.T, memonly bool) {
|
||||
diskdb := memorydb.New()
|
||||
diskdb := rawdb.NewMemoryDatabase()
|
||||
triedb := NewDatabase(diskdb)
|
||||
|
||||
tr := NewEmpty(triedb)
|
||||
@@ -419,7 +419,7 @@ func TestIteratorContinueAfterSeekErrorMemonly(t *testing.T) {
|
||||
|
||||
func testIteratorContinueAfterSeekError(t *testing.T, memonly bool) {
|
||||
// Commit test trie to db, then remove the node containing "bars".
|
||||
diskdb := memorydb.New()
|
||||
diskdb := rawdb.NewMemoryDatabase()
|
||||
triedb := NewDatabase(diskdb)
|
||||
|
||||
ctr := NewEmpty(triedb)
|
||||
@@ -532,7 +532,7 @@ func (l *loggingDb) Close() error {
|
||||
func makeLargeTestTrie() (*Database, *StateTrie, *loggingDb) {
|
||||
// Create an empty trie
|
||||
logDb := &loggingDb{0, memorydb.New()}
|
||||
triedb := NewDatabase(logDb)
|
||||
triedb := NewDatabase(rawdb.NewDatabase(logDb))
|
||||
trie, _ := NewStateTrie(TrieID(common.Hash{}), triedb)
|
||||
|
||||
// Fill it with some arbitrary data
|
||||
@@ -567,7 +567,7 @@ func TestNodeIteratorLargeTrie(t *testing.T) {
|
||||
|
||||
func TestIteratorNodeBlob(t *testing.T) {
|
||||
var (
|
||||
db = memorydb.New()
|
||||
db = rawdb.NewMemoryDatabase()
|
||||
triedb = NewDatabase(db)
|
||||
trie = NewEmpty(triedb)
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user