@@ -454,19 +454,16 @@ proc computeTransactionsTrieRoot*(
454454 raiseAssert " HexaryTrie.put failed: " & $ exc.msg
455455 tr.rootHash ()
456456
457- func toExecutionWithdrawal * (
457+ func toExecutionWithdrawal (
458458 withdrawal: capella.Withdrawal ): ExecutionWithdrawal =
459459 ExecutionWithdrawal (
460460 index: withdrawal.index,
461461 validatorIndex: withdrawal.validator_index,
462462 address: EthAddress withdrawal.address.data,
463463 amount: distinctBase (withdrawal.amount))
464464
465- proc append (w: var RlpWriter , val: EthAddress ) =
466- # TODO for some reason, the same implementation from addresses_rlp isn't
467- # picked up, so we need to repeat it here - odd.
468- mixin append
469- w.append (val.data ())
465+ proc rlpEncode (withdrawal: capella.Withdrawal ): seq [byte ] =
466+ rlp.encode (toExecutionWithdrawal (withdrawal))
470467
471468# https://eips.ethereum.org/EIPS/eip-4895
472469proc computeWithdrawalsTrieRoot * (
@@ -478,7 +475,7 @@ proc computeWithdrawalsTrieRoot*(
478475 var tr = initHexaryTrie (newMemoryDB ())
479476 for i, withdrawal in payload.withdrawals:
480477 try :
481- tr.put (rlp.encode (i.uint ), rlp. encode ( toExecutionWithdrawal ( withdrawal) ))
478+ tr.put (rlp.encode (i.uint ), rlpEncode ( withdrawal))
482479 except RlpError as exc:
483480 raiseAssert " HexaryTrie.put failed: " & $ exc.msg
484481 tr.rootHash ()
0 commit comments