Documentation ¶
Index ¶
- type Forest
- func (f *Forest) GetProof(rootHash primitives.MerkleSha256, contract string, key string) (Proof, error)
- func (f *Forest) Update(baseHash primitives.MerkleSha256, diffs []*protocol.ContractStateDiff) (primitives.MerkleSha256, error)
- func (f *Forest) Verify(rootHash primitives.MerkleSha256, proof Proof, contract string, key string, ...) (bool, error)
- type Node
- type Proof
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Forest ¶
type Forest struct {
// contains filtered or unexported fields
}
func NewForest ¶
func NewForest() (*Forest, primitives.MerkleSha256)
return the merkle trie & the trie root hash for the empty default trie
func (*Forest) GetProof ¶
func (f *Forest) GetProof(rootHash primitives.MerkleSha256, contract string, key string) (Proof, error)
extract and return a verifiable proof for the value of key in the state snapshot reflected by trieId (corresponding to some block height)
func (*Forest) Update ¶
func (f *Forest) Update(baseHash primitives.MerkleSha256, diffs []*protocol.ContractStateDiff) (primitives.MerkleSha256, error)
appends diffs starting at requested trie node (hash) and returns new trie node hash NOTE: typical use is baseHash is the newest root hash and return value is new root.
func (*Forest) Verify ¶
func (f *Forest) Verify(rootHash primitives.MerkleSha256, proof Proof, contract string, key string, value string) (bool, error)
return true if proof and merkle rootHash validate value for key. false if it confirms value does not match key return an error if the proof is inconsistent internally, or, with key, value or rootHash
Click to show internal directories.
Click to hide internal directories.