Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
30 lines (24 sloc) 515 Bytes
package trie
import (
ethcommon "github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/trie"
"boscoin.io/sebak/lib/common"
)
type Trie struct {
trie.Trie
DB *trie.Database
}
func NewTrie(root common.Hash, db *EthDatabase) *Trie {
triedb := trie.NewDatabase(db)
tr, err := trie.New(ethcommon.Hash(root), triedb)
if err != nil {
panic(err)
}
return &Trie{
Trie: *tr,
DB: triedb,
}
}
func (t *Trie) CommitDB(root common.Hash) (err error) {
return t.DB.Commit(root, false)
}
You can’t perform that action at this time.