Skip to content
This repository has been archived by the owner on Jul 5, 2024. It is now read-only.

Commit

Permalink
fix: merged code
Browse files Browse the repository at this point in the history
  • Loading branch information
KimiWu123 committed Apr 16, 2024
1 parent e5c7559 commit f8e266f
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions geth-utils/gethutil/mpt/witness/prepare_witness.go
Original file line number Diff line number Diff line change
Expand Up @@ -566,7 +566,14 @@ func convertProofToWitness(
for i := 0; i < upTo; i++ {
if !isBranch(proof1[i]) {
isNonExistingProof := (isAccountProof && nonExistingAccountProof) || (!isAccountProof && nonExistingStorageProof)
areThereNibbles := len(extNibblesS) != 0 || len(extNibblesC) != 0
var curExtNibblesS, curExtNibblesC []byte
if len(extNibblesS) > i {
curExtNibblesS = extNibblesS[i]
}
if len(extNibblesC) > i {
curExtNibblesC = extNibblesC[i]
}
areThereNibbles := len(curExtNibblesS) != 0 || len(curExtNibblesC) != 0
// If i < upTo-1, it means it's not a leaf, so it's an extension node.
// There is no any special relation between isNonExistingProof and isExtension,
// except that in the non-existing proof the extension node can appear in `i == upTo-1`.
Expand All @@ -577,7 +584,7 @@ func convertProofToWitness(
if (i != upTo-1) || (areThereNibbles && isNonExistingProof) { // extension node
var numberOfNibbles byte
isExtension = true
numberOfNibbles, extListRlpBytes, extValues = prepareExtensions(extNibblesS[i], proof1[i], proof2[i])
numberOfNibbles, extListRlpBytes, extValues = prepareExtensions(curExtNibblesS, proof1[i], proof2[i])

keyIndex += int(numberOfNibbles)
extensionNodeInd++
Expand Down

0 comments on commit f8e266f

Please sign in to comment.