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

Commit f8e266f

Browse files
committed
fix: merged code
1 parent e5c7559 commit f8e266f

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

Diff for: geth-utils/gethutil/mpt/witness/prepare_witness.go

+9-2
Original file line numberDiff line numberDiff line change
@@ -566,7 +566,14 @@ func convertProofToWitness(
566566
for i := 0; i < upTo; i++ {
567567
if !isBranch(proof1[i]) {
568568
isNonExistingProof := (isAccountProof && nonExistingAccountProof) || (!isAccountProof && nonExistingStorageProof)
569-
areThereNibbles := len(extNibblesS) != 0 || len(extNibblesC) != 0
569+
var curExtNibblesS, curExtNibblesC []byte
570+
if len(extNibblesS) > i {
571+
curExtNibblesS = extNibblesS[i]
572+
}
573+
if len(extNibblesC) > i {
574+
curExtNibblesC = extNibblesC[i]
575+
}
576+
areThereNibbles := len(curExtNibblesS) != 0 || len(curExtNibblesC) != 0
570577
// If i < upTo-1, it means it's not a leaf, so it's an extension node.
571578
// There is no any special relation between isNonExistingProof and isExtension,
572579
// except that in the non-existing proof the extension node can appear in `i == upTo-1`.
@@ -577,7 +584,7 @@ func convertProofToWitness(
577584
if (i != upTo-1) || (areThereNibbles && isNonExistingProof) { // extension node
578585
var numberOfNibbles byte
579586
isExtension = true
580-
numberOfNibbles, extListRlpBytes, extValues = prepareExtensions(extNibblesS[i], proof1[i], proof2[i])
587+
numberOfNibbles, extListRlpBytes, extValues = prepareExtensions(curExtNibblesS, proof1[i], proof2[i])
581588

582589
keyIndex += int(numberOfNibbles)
583590
extensionNodeInd++

0 commit comments

Comments
 (0)