github.com/theQRL/go-zond@v0.1.1/trie/triedb/pathdb/errors.go (about) 1 // Copyright 2023 The go-ethereum Authors 2 // This file is part of the go-ethereum library. 3 // 4 // The go-ethereum library is free software: you can redistribute it and/or modify 5 // it under the terms of the GNU Lesser General Public License as published by 6 // the Free Software Foundation, either version 3 of the License, or 7 // (at your option) any later version. 8 // 9 // The go-ethereum library is distributed in the hope that it will be useful, 10 // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 // GNU Lesser General Public License for more details. 13 // 14 // You should have received a copy of the GNU Lesser General Public License 15 // along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/> 16 17 package pathdb 18 19 import ( 20 "errors" 21 "fmt" 22 23 "github.com/theQRL/go-zond/common" 24 ) 25 26 var ( 27 // errSnapshotReadOnly is returned if the database is opened in read only mode 28 // and mutation is requested. 29 errSnapshotReadOnly = errors.New("read only") 30 31 // errSnapshotStale is returned from data accessors if the underlying layer 32 // layer had been invalidated due to the chain progressing forward far enough 33 // to not maintain the layer's original state. 34 errSnapshotStale = errors.New("layer stale") 35 36 // errUnexpectedHistory is returned if an unmatched state history is applied 37 // to the database for state rollback. 38 errUnexpectedHistory = errors.New("unexpected state history") 39 40 // errStateUnrecoverable is returned if state is required to be reverted to 41 // a destination without associated state history available. 42 errStateUnrecoverable = errors.New("state is unrecoverable") 43 44 // errUnexpectedNode is returned if the requested node with specified path is 45 // not hash matched with expectation. 46 errUnexpectedNode = errors.New("unexpected node") 47 ) 48 49 func newUnexpectedNodeError(loc string, expHash common.Hash, gotHash common.Hash, owner common.Hash, path []byte) error { 50 return fmt.Errorf("%w, loc: %s, node: (%x %v), %x!=%x", errUnexpectedNode, loc, owner, path, expHash, gotHash) 51 }