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

Commit dd04ccc

Browse files
committed
Fix in equipLeafWithModExtensionNode; go fmt
1 parent af3fd83 commit dd04ccc

File tree

3 files changed

+13
-13
lines changed

3 files changed

+13
-13
lines changed

geth-utils/gethutil/mpt/witness/branch.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ func getDriftedPosition(leafKeyRow []byte, numberOfNibbles int) byte {
174174
} else {
175175
keyLen = 1
176176
nibbles = append(nibbles, leafKeyRow[1]-16)
177-
}
177+
}
178178
} else {
179179
keyLen := int(leafKeyRow[2] - 128)
180180
if (leafKeyRow[3] != 32) && (leafKeyRow[3] != 0) { // second term is for extension node

geth-utils/gethutil/mpt/witness/gen_witness_from_local_blockchain_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -933,7 +933,7 @@ func TestExtensionIntoBranch(t *testing.T) {
933933
database := state.NewDatabase(blockHeaderParent)
934934
statedb, _ := state.New(blockHeaderParent.Root, database, nil)
935935
addr := common.HexToAddress("0x50efbf12580138bc623c95757286df4e24eb81c9")
936-
936+
937937
statedb.DisableLoadingRemoteAccounts()
938938

939939
statedb.CreateAccount(addr)

geth-utils/gethutil/mpt/witness/modified_extension_node.go

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -51,17 +51,6 @@ func equipLeafWithModExtensionNode(statedb *state.StateDB, leafNode Node, addr c
5151
longExtNodeKey[j] = longNibbles[j-byte(keyIndex)]
5252
}
5353

54-
k := trie.HexToKeybytes(longExtNodeKey)
55-
ky := common.BytesToHash(k)
56-
var proof [][]byte
57-
var err error
58-
if isAccountProof {
59-
proof, _, _, _, _, err = statedb.GetProof(addr)
60-
} else {
61-
proof, _, _, _, _, err = statedb.GetStorageProof(addr, ky)
62-
}
63-
check(err)
64-
6554
// There is no short extension node when `len(longNibbles) - numberOfNibbles = 1`, in this case there
6655
// is simply a branch instead.
6756
shortExtNodeIsBranch := len(longNibbles)-numberOfNibbles == 1
@@ -71,6 +60,17 @@ func equipLeafWithModExtensionNode(statedb *state.StateDB, leafNode Node, addr c
7160
var extValuesC [][]byte
7261

7362
if !shortExtNodeIsBranch {
63+
k := trie.HexToKeybytes(longExtNodeKey)
64+
ky := common.BytesToHash(k)
65+
var proof [][]byte
66+
var err error
67+
if isAccountProof {
68+
proof, _, _, _, _, err = statedb.GetProof(addr)
69+
} else {
70+
proof, _, _, _, _, err = statedb.GetStorageProof(addr, ky)
71+
}
72+
check(err)
73+
7474
if len2 > len1 {
7575
isItBranch := isBranch(proof[len(proof)-1])
7676

0 commit comments

Comments
 (0)