forked from cerc-io/plugeth
all: use rlp.DecodeBytes instead of rlp.Decode where possible (#27994)
This commit is contained in:
@@ -112,7 +112,7 @@ func (it *nodeIterator) step() error {
|
||||
}
|
||||
// Otherwise we've reached an account node, initiate data iteration
|
||||
var account types.StateAccount
|
||||
if err := rlp.Decode(bytes.NewReader(it.stateIt.LeafBlob()), &account); err != nil {
|
||||
if err := rlp.DecodeBytes(it.stateIt.LeafBlob(), &account); err != nil {
|
||||
return err
|
||||
}
|
||||
// Lookup the preimage of account hash
|
||||
|
||||
+1
-3
@@ -17,8 +17,6 @@
|
||||
package state
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ethereum/go-ethereum/core/types"
|
||||
"github.com/ethereum/go-ethereum/ethdb"
|
||||
@@ -45,7 +43,7 @@ func NewStateSync(root common.Hash, database ethdb.KeyValueReader, onLeaf func(k
|
||||
}
|
||||
}
|
||||
var obj types.StateAccount
|
||||
if err := rlp.Decode(bytes.NewReader(leaf), &obj); err != nil {
|
||||
if err := rlp.DecodeBytes(leaf, &obj); err != nil {
|
||||
return err
|
||||
}
|
||||
syncer.AddSubTrie(obj.Root, path, parent, parentPath, onSlot)
|
||||
|
||||
Reference in New Issue
Block a user