Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ pub(crate) fn account_still_undelegating_on_chain(
.as_ref()
.map(|d| d.delegation_slot)
.unwrap_or_default();
if delegation_slot < remote_slot_in_bank {
if delegation_slot <= remote_slot_in_bank {
// The last update of the account was after the last delegation
// Therefore the account was not redelegated which indicates
// that the undelegation is still not completed. Case (D))
Expand Down Expand Up @@ -132,14 +132,17 @@ mod tests {
// Case B: The account was undelegated and was re-delegated to us.
// Conditions:
// - is_delegated: true (account is delegated to us on chain)
// - delegation_slot >= remote_slot (delegation happend after we last updated the account)
// - delegation_slot > remote_slot (delegation happend after we last updated the account)
// Expected: true (should override/update)

let pubkey = Pubkey::default();
let is_delegated = true;
let remote_slot = 100;

// NOTE: this case led to incorrect unborking if delegation + undelegation + redelegation
// happend all in the same slot
// Subcase B1: delegation_slot == remote_slot
/*
let delegation_slot = 100;
let deleg_record = Some(create_delegation_record(delegation_slot));
assert!(!account_still_undelegating_on_chain(
Expand All @@ -149,6 +152,7 @@ mod tests {
deleg_record,
&Pubkey::default(),
));
*/

// Subcase B2: delegation_slot > remote_slot
let delegation_slot = 101;
Expand Down