@@ -65,14 +65,15 @@ func GetWitness(nodeUrl string, blockNum int, trieModifications []TrieModificati
65
65
return obtainTwoProofsAndConvertToWitness (trieModifications , statedb , 0 )
66
66
}
67
67
68
- func obtainAccountProofAndConvertToWitness (i int , tMod TrieModification , tModsLen int , statedb * state.StateDB , specialTest byte ) []Node {
68
+ func obtainAccountProofAndConvertToWitness (tMod TrieModification , statedb * state.StateDB , specialTest byte ) []Node {
69
69
statedb .IntermediateRoot (false )
70
70
71
71
addr := tMod .Address
72
72
addrh := crypto .Keccak256 (addr .Bytes ())
73
73
if oracle .PreventHashingInSecureTrie {
74
74
addrh = addr .Bytes ()
75
- addrh = append (addrh , []byte {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 }... )
75
+ addrh = append (addrh , []byte {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 }... )
76
+ addr = common .BytesToAddress (addrh )
76
77
}
77
78
accountAddr := trie .KeybytesToHex (addrh )
78
79
@@ -82,7 +83,7 @@ func obtainAccountProofAndConvertToWitness(i int, tMod TrieModification, tModsLe
82
83
// for cases when statedb.loadRemoteAccountsIntoStateObjects = false.
83
84
statedb .SetStateObjectIfExists (tMod .Address )
84
85
85
- oracle .PrefetchAccount (statedb .Db .BlockNumber , tMod . Address , nil )
86
+ oracle .PrefetchAccount (statedb .Db .BlockNumber , addr , nil )
86
87
accountProof , aNeighbourNode1 , aExtNibbles1 , isLastLeaf1 , aIsNeighbourNodeHashed1 , err := statedb .GetProof (addr )
87
88
check (err )
88
89
@@ -182,10 +183,11 @@ func obtainTwoProofsAndConvertToWitness(trieModifications []TrieModification, st
182
183
if oracle .PreventHashingInSecureTrie {
183
184
addrh = addr .Bytes ()
184
185
addrh = append (addrh , []byte {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 }... )
186
+ addr = common .BytesToAddress (addrh )
185
187
}
186
188
accountAddr := trie .KeybytesToHex (addrh )
187
189
188
- oracle .PrefetchAccount (statedb .Db .BlockNumber , tMod . Address , nil )
190
+ oracle .PrefetchAccount (statedb .Db .BlockNumber , addr , nil )
189
191
oracle .PrefetchStorage (statedb .Db .BlockNumber , addr , tMod .Key , nil )
190
192
191
193
if specialTest == 1 {
@@ -282,7 +284,7 @@ func obtainTwoProofsAndConvertToWitness(trieModifications []TrieModification, st
282
284
nodes = append (nodes , nodesStorage ... )
283
285
nodes = append (nodes , GetEndNode ())
284
286
} else {
285
- accountNodes := obtainAccountProofAndConvertToWitness (i , tMod , len ( trieModifications ) , statedb , specialTest )
287
+ accountNodes := obtainAccountProofAndConvertToWitness (tMod , statedb , specialTest )
286
288
nodes = append (nodes , accountNodes ... )
287
289
}
288
290
}
0 commit comments