Skip to content

Commit

Permalink
trie: apply fastNodeEncoder to StackTrie
Browse files Browse the repository at this point in the history
  • Loading branch information
qianbin committed Jan 11, 2022
1 parent db9a648 commit 7486437
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions trie/stacktrie.go
Expand Up @@ -376,7 +376,7 @@ func (st *StackTrie) hash() {

switch st.nodeType {
case branchNode:
var nodes [17]node
var nodes rawFullNode
for i, child := range st.children {
if child == nil {
nodes[i] = nilValueNode
Expand All @@ -395,7 +395,7 @@ func (st *StackTrie) hash() {
h = newHasher(false)
defer returnHasherToPool(h)
h.tmp.Reset()
if err := rlp.Encode(&h.tmp, nodes); err != nil {
if err := frlp.Encode(&h.tmp, nodes); err != nil {
panic(err)
}
case extNode:
Expand All @@ -409,14 +409,11 @@ func (st *StackTrie) hash() {
} else {
valuenode = hashNode(st.children[0].val)
}
n := struct {
Key []byte
Val node
}{
n := &rawShortNode{
Key: hexToCompact(st.key),
Val: valuenode,
}
if err := rlp.Encode(&h.tmp, n); err != nil {
if err := frlp.Encode(&h.tmp, n); err != nil {
panic(err)
}
returnToPool(st.children[0])
Expand Down

0 comments on commit 7486437

Please sign in to comment.