Skip to content

Commit

Permalink
fix: copy balance leaf to new buffer in TryGetAccount (#217)
Browse files Browse the repository at this point in the history
  • Loading branch information
gballet authored Jun 13, 2023
1 parent 14ceeb4 commit 192fcb2
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions trie/verkle.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,10 @@ func (t *VerkleTrie) TryGetAccount(key []byte) (*types.StateAccount, error) {
if len(values[utils.NonceLeafKey]) > 0 {
acc.Nonce = binary.LittleEndian.Uint64(values[utils.NonceLeafKey])
}
balance := values[utils.BalanceLeafKey]
if len(balance) > 0 {
for i := 0; i < len(balance)/2; i++ {
balance[len(balance)-i-1], balance[i] = balance[i], balance[len(balance)-i-1]
var balance [32]byte
if len(values[utils.BalanceLeafKey]) > 0 {
for i := 0; i < len(balance); i++ {
balance[len(balance)-i-1] = values[utils.BalanceLeafKey][i]
}
}
acc.Balance = new(big.Int).SetBytes(balance[:])
Expand Down

0 comments on commit 192fcb2

Please sign in to comment.