mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 10:22:23 +00:00
* init * add trie/database_types.go * update params/config.go * update les/server.go * update core/types/state_account_marshalling.go * add core/types/state_account_marshalling_test.go * update eth/backend.go * update trie/zk_trie.go * update trie/zk_trie_database.go * update trie/zk_trie_database_test.go * update trie/zk_trie_impl_test.go * update trie/zk_trie_proof_test.go * update trie/zk_trie_test.go * minor * init database_supplement.go * minor * add some supplements * fix * fix * add `zkproof` package * add trie/zktrie_deletionproof.go * init core/state/state_prove.go * fix * fix `(t *ZkTrie) Commit` * fix * update trie/proof.go * fix trie/zk_trie_database.go * update core/blockchain.go * update core/genesis.go * fix init trie_db (#639) * add config * update cmd/evm/internal/t8ntool/execution.go * update core/chain_makers.go * update cmd/evm/runner.go fix cmd/evm/runner.go * update core/chain_makers.go * refactor `triedbConfig` * update core/genesis.go * refactor `genesis.ToBlock()` * fix core/genesis_test.go * update core/state/database.go * update trie/database.go * update core/state/state_object.go * clean up * fix tests * fix `TestDump` & `TestIterativeDump` (#651) * fix `TestDump` * fix `compareStateObjects` * fix `TestIterativeDump` * fix `TestTinyTrie` & `TestCommitSequence` (#652) * zktrie: fix tests (#656) * fix `TestOdrContractCallLes2` * fix `internal/ethapi` tests * fix `TestFilters` * fix `core/state/snapshot/generate_test.go * update core/genesis_test.go (#658)
32 lines
717 B
Go
32 lines
717 B
Go
package trie
|
|
|
|
import (
|
|
"sync"
|
|
|
|
"github.com/VictoriaMetrics/fastcache"
|
|
|
|
"github.com/ethereum/go-ethereum/common"
|
|
"github.com/ethereum/go-ethereum/core/types"
|
|
"github.com/ethereum/go-ethereum/trie/triedb/hashdb"
|
|
)
|
|
|
|
func (db *Database) GetLock() *sync.RWMutex {
|
|
return db.backend.GetLock()
|
|
}
|
|
|
|
func (db *Database) GetCleans() *fastcache.Cache {
|
|
hdb, ok := db.backend.(*hashdb.Database)
|
|
if !ok {
|
|
panic("only hashdb supported")
|
|
}
|
|
return hdb.GetCleans()
|
|
}
|
|
|
|
// EmptyRoot indicate what root is for an empty trie, it depends on its underlying implement (zktrie or common trie)
|
|
func (db *Database) EmptyRoot() common.Hash {
|
|
if db.IsUsingZktrie() {
|
|
return common.Hash{}
|
|
} else {
|
|
return types.EmptyRootHash
|
|
}
|
|
}
|