Convert to Wei before multiply

This commit is contained in:
Etan Kissling 2022-11-24 15:16:59 +01:00
parent 0bb3470352
commit f8041091e4
No known key found for this signature in database
GPG Key ID: B21DA824C5A3D03D
1 changed files with 3 additions and 3 deletions

View File

@ -95,7 +95,7 @@ def compute_el_header_block_hash(spec,
# https://eips.ethereum.org/EIPS/eip-4895
def get_withdrawal_rlp(withdrawal):
def get_withdrawal_rlp(spec, withdrawal):
withdrawal_rlp = [
# index
(big_endian_int, withdrawal.index),
@ -104,7 +104,7 @@ def get_withdrawal_rlp(withdrawal):
# address
(Binary(20, 20), withdrawal.address),
# amount
(big_endian_int, withdrawal.amount * (10**9)),
(big_endian_int, spec.uint256(withdrawal.amount) * (10**9)),
]
sedes = List([schema for schema, _ in withdrawal_rlp])
@ -116,7 +116,7 @@ def compute_el_block_hash(spec, payload):
transactions_trie_root = compute_trie_root_from_indexed_data(payload.transactions)
if is_post_capella(spec):
withdrawals_encoded = map(get_withdrawal_rlp, payload.withdrawals)
withdrawals_encoded = [get_withdrawal_rlp(spec, withdrawal) for withdrawal in payload.withdrawals]
withdrawals_trie_root = compute_trie_root_from_indexed_data(withdrawals_encoded)
else:
withdrawals_trie_root = None