File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -2456,15 +2456,41 @@ impl<E: EthSpec> BeaconState<E> {
24562456 . map_err ( Into :: into)
24572457 }
24582458
2459+ // TODO(EIP-7732): The consensus spec PR for this change mentions that some EF tests will be needed but haven't been created yet.
2460+ // We should integrate them once they are available.
2461+ // https://github.com/ethereum/consensus-specs/pull/4513
24592462 pub fn get_pending_balance_to_withdraw ( & self , validator_index : usize ) -> Result < u64 , Error > {
24602463 let mut pending_balance = 0 ;
2464+
2465+ // Sum pending partial withdrawals
24612466 for withdrawal in self
24622467 . pending_partial_withdrawals ( ) ?
24632468 . iter ( )
24642469 . filter ( |withdrawal| withdrawal. validator_index as usize == validator_index)
24652470 {
24662471 pending_balance. safe_add_assign ( withdrawal. amount ) ?;
24672472 }
2473+
2474+ // Sum builder pending withdrawals
2475+ if let Ok ( builder_pending_withdrawals) = self . builder_pending_withdrawals ( ) {
2476+ for withdrawal in builder_pending_withdrawals
2477+ . iter ( )
2478+ . filter ( |withdrawal| withdrawal. builder_index as usize == validator_index)
2479+ {
2480+ pending_balance. safe_add_assign ( withdrawal. amount ) ?;
2481+ }
2482+ }
2483+
2484+ // Sum builder pending payments
2485+ if let Ok ( builder_pending_payments) = self . builder_pending_payments ( ) {
2486+ for payment in builder_pending_payments
2487+ . iter ( )
2488+ . filter ( |payment| payment. withdrawal . builder_index as usize == validator_index)
2489+ {
2490+ pending_balance. safe_add_assign ( payment. withdrawal . amount ) ?;
2491+ }
2492+ }
2493+
24682494 Ok ( pending_balance)
24692495 }
24702496
You can’t perform that action at this time.
0 commit comments