forked from cerc-io/plugeth
trie: remove parameter 'fromLevel' in Prove (#27512)
This removes the feature where top nodes of the proof can be elided. It was intended to be used by the LES server, to save bandwidth when the client had already fetched parts of the state and only needed some extra nodes to complete the proof. Alas, it never got implemented in the client.
This commit is contained in:
@@ -123,7 +123,7 @@ type Trie interface {
|
||||
// If the trie does not contain a value for key, the returned proof contains all
|
||||
// nodes of the longest existing prefix of the key (at least the root), ending
|
||||
// with the node that proves the absence of the key.
|
||||
Prove(key []byte, fromLevel uint, proofDb ethdb.KeyValueWriter) error
|
||||
Prove(key []byte, proofDb ethdb.KeyValueWriter) error
|
||||
}
|
||||
|
||||
// NewDatabase creates a backing store for state. The returned database is safe for
|
||||
|
||||
@@ -256,7 +256,7 @@ func (dl *diskLayer) proveRange(ctx *generatorContext, trieId *trie.ID, prefix [
|
||||
if origin == nil {
|
||||
origin = common.Hash{}.Bytes()
|
||||
}
|
||||
if err := tr.Prove(origin, 0, proof); err != nil {
|
||||
if err := tr.Prove(origin, proof); err != nil {
|
||||
log.Debug("Failed to prove range", "kind", kind, "origin", origin, "err", err)
|
||||
return &proofResult{
|
||||
keys: keys,
|
||||
@@ -267,7 +267,7 @@ func (dl *diskLayer) proveRange(ctx *generatorContext, trieId *trie.ID, prefix [
|
||||
}, nil
|
||||
}
|
||||
if last != nil {
|
||||
if err := tr.Prove(last, 0, proof); err != nil {
|
||||
if err := tr.Prove(last, proof); err != nil {
|
||||
log.Debug("Failed to prove range", "kind", kind, "last", last, "err", err)
|
||||
return &proofResult{
|
||||
keys: keys,
|
||||
|
||||
@@ -332,7 +332,7 @@ func (s *StateDB) GetProof(addr common.Address) ([][]byte, error) {
|
||||
// GetProofByHash returns the Merkle proof for a given account.
|
||||
func (s *StateDB) GetProofByHash(addrHash common.Hash) ([][]byte, error) {
|
||||
var proof proofList
|
||||
err := s.trie.Prove(addrHash[:], 0, &proof)
|
||||
err := s.trie.Prove(addrHash[:], &proof)
|
||||
return proof, err
|
||||
}
|
||||
|
||||
@@ -346,7 +346,7 @@ func (s *StateDB) GetStorageProof(a common.Address, key common.Hash) ([][]byte,
|
||||
return nil, errors.New("storage trie for requested address does not exist")
|
||||
}
|
||||
var proof proofList
|
||||
err = trie.Prove(crypto.Keccak256(key.Bytes()), 0, &proof)
|
||||
err = trie.Prove(crypto.Keccak256(key.Bytes()), &proof)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user