File tree Expand file tree Collapse file tree 2 files changed +8
-10
lines changed Expand file tree Collapse file tree 2 files changed +8
-10
lines changed Original file line number Diff line number Diff line change @@ -2113,17 +2113,15 @@ impl<E: EthSpec> BeaconState<E> {
2113
2113
}
2114
2114
2115
2115
pub fn get_pending_balance_to_withdraw ( & self , validator_index : usize ) -> Result < u64 , Error > {
2116
- Ok ( self
2116
+ let mut pending_balance = 0 ;
2117
+ for withdrawal in self
2117
2118
. pending_partial_withdrawals ( ) ?
2118
2119
. iter ( )
2119
- . filter_map ( |withdrawal| {
2120
- if withdrawal. index as usize == validator_index {
2121
- Some ( withdrawal. amount )
2122
- } else {
2123
- None
2124
- }
2125
- } )
2126
- . sum ( ) )
2120
+ . filter ( |withdrawal| withdrawal. index as usize == validator_index)
2121
+ {
2122
+ pending_balance. safe_add_assign ( withdrawal. amount ) ?;
2123
+ }
2124
+ Ok ( pending_balance)
2127
2125
}
2128
2126
2129
2127
// ******* Electra mutators *******
Original file line number Diff line number Diff line change @@ -153,7 +153,7 @@ impl Validator {
153
153
}
154
154
155
155
/// Returns `true` if the validator if fully withdrawable.
156
- ///
156
+ ///
157
157
/// Modified in electra.
158
158
pub fn is_fully_withdrawable_validator (
159
159
& self ,
You can’t perform that action at this time.
0 commit comments