@@ -25,7 +25,6 @@ import (
2525
2626 "github.com/XinFinOrg/XDPoSChain/common"
2727 "github.com/XinFinOrg/XDPoSChain/core/rawdb"
28- "github.com/XinFinOrg/XDPoSChain/core/types"
2928 "github.com/XinFinOrg/XDPoSChain/crypto"
3029 "github.com/XinFinOrg/XDPoSChain/ethdb"
3130 "github.com/XinFinOrg/XDPoSChain/ethdb/memorydb"
@@ -298,7 +297,7 @@ func TestUnionIterator(t *testing.T) {
298297}
299298
300299func TestIteratorNoDups (t * testing.T ) {
301- tr , _ := New (common. Hash {}, NewDatabase (rawdb .NewMemoryDatabase ()))
300+ tr := NewEmpty ( NewDatabase (rawdb .NewMemoryDatabase ()))
302301 for _ , val := range testdata1 {
303302 tr .Update ([]byte (val .k ), []byte (val .v ))
304303 }
@@ -313,7 +312,7 @@ func testIteratorContinueAfterError(t *testing.T, memonly bool) {
313312 diskdb := memorydb .New ()
314313 triedb := NewDatabase (diskdb )
315314
316- tr , _ := New ( types . EmptyRootHash , triedb )
315+ tr := NewEmpty ( triedb )
317316 for _ , val := range testdata1 {
318317 tr .Update ([]byte (val .k ), []byte (val .v ))
319318 }
@@ -338,7 +337,7 @@ func testIteratorContinueAfterError(t *testing.T, memonly bool) {
338337 }
339338 for i := 0 ; i < 20 ; i ++ {
340339 // Create trie that will load all nodes from DB.
341- tr , _ := New (tr .Hash (), triedb )
340+ tr , _ := New (common. Hash {}, tr .Hash (), triedb )
342341
343342 // Remove a random Node from the database. It can't be the root Node
344343 // because that one is already loaded.
@@ -404,7 +403,7 @@ func testIteratorContinueAfterSeekError(t *testing.T, memonly bool) {
404403 diskdb := memorydb .New ()
405404 triedb := NewDatabase (diskdb )
406405
407- ctr , _ := New ( types . EmptyRootHash , triedb )
406+ ctr := NewEmpty ( triedb )
408407 for _ , val := range testdata1 {
409408 ctr .Update ([]byte (val .k ), []byte (val .v ))
410409 }
@@ -425,8 +424,8 @@ func testIteratorContinueAfterSeekError(t *testing.T, memonly bool) {
425424 diskdb .Delete (barNodeHash [:])
426425 }
427426 // Create a new iterator that seeks to "bars". Seeking can't proceed because
428- // the Node is missing.
429- tr , _ := New (root , triedb )
427+ // the node is missing.
428+ tr , _ := New (common. Hash {}, root , triedb )
430429 it := tr .NodeIterator ([]byte ("bars" ))
431430 missing , ok := it .Error ().(* MissingNodeError )
432431 if ! ok {
@@ -510,7 +509,7 @@ func makeLargeTestTrie() (*Database, *SecureTrie, *loggingDb) {
510509 // Create an empty trie
511510 logDb := & loggingDb {0 , memorydb .New ()}
512511 triedb := NewDatabase (logDb )
513- trie , _ := NewSecure (common.Hash {}, triedb )
512+ trie , _ := NewSecure (common.Hash {}, common. Hash {}, triedb )
514513
515514 // Fill it with some arbitrary data
516515 for i := 0 ; i < 10000 ; i ++ {
@@ -543,9 +542,9 @@ func TestNodeIteratorLargeTrie(t *testing.T) {
543542
544543func TestIteratorNodeBlob (t * testing.T ) {
545544 var (
546- db = memorydb .New ()
547- triedb = NewDatabase (db )
548- trie , _ = New (common. Hash {}, triedb )
545+ db = memorydb .New ()
546+ triedb = NewDatabase (db )
547+ trie = NewEmpty ( triedb )
549548 )
550549 vals := []struct { k , v string }{
551550 {"do" , "verb" },
0 commit comments