unified_cache_provider.go 663 B

123456789101112131415161718192021222324252627
  1. package privatecache
  2. import (
  3. "github.com/ethereum/go-ethereum/common"
  4. "github.com/ethereum/go-ethereum/core/state"
  5. )
  6. type unifiedCacheProvider struct {
  7. cache state.Database
  8. }
  9. func (p *unifiedCacheProvider) GetCache() state.Database {
  10. return p.cache
  11. }
  12. func (p *unifiedCacheProvider) GetCacheWithConfig() state.Database {
  13. return p.cache
  14. }
  15. func (p *unifiedCacheProvider) Commit(db state.Database, hash common.Hash) error {
  16. // do nothing since the references will handle the actual commit (when the public root is committed)
  17. return nil
  18. }
  19. func (p *unifiedCacheProvider) Reference(child, parent common.Hash) {
  20. p.cache.TrieDB().Reference(child, parent)
  21. }