mirror of
https://github.com/sigp/lighthouse.git
synced 2026-07-01 20:04:41 +00:00
Fix builder top up bug
This commit is contained in:
@@ -1031,12 +1031,21 @@ pub fn apply_deposit_for_builder<E: EthSpec>(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
Some(builder_index) => {
|
Some(builder_index) => {
|
||||||
state
|
let current_epoch = state.current_epoch();
|
||||||
|
let builder = state
|
||||||
.builders_mut()?
|
.builders_mut()?
|
||||||
.get_mut(builder_index as usize)
|
.get_mut(builder_index as usize)
|
||||||
.ok_or(BeaconStateError::UnknownBuilder(builder_index))?
|
.ok_or(BeaconStateError::UnknownBuilder(builder_index))?;
|
||||||
.balance
|
|
||||||
.safe_add_assign(amount)?;
|
// Increase balance by deposit amount
|
||||||
|
builder.balance.safe_add_assign(amount)?;
|
||||||
|
|
||||||
|
// If exited, reset the withdrawable epoch
|
||||||
|
if builder.withdrawable_epoch != spec.far_future_epoch {
|
||||||
|
builder.withdrawable_epoch =
|
||||||
|
current_epoch.safe_add(spec.min_builder_withdrawability_delay)?;
|
||||||
|
}
|
||||||
|
|
||||||
Ok(Some(builder_index))
|
Ok(Some(builder_index))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user