@@ -55,7 +55,7 @@ pub(crate) fn account_still_undelegating_on_chain(
5555 . as_ref ( )
5656 . map ( |d| d. delegation_slot )
5757 . unwrap_or_default ( ) ;
58- if delegation_slot < remote_slot_in_bank {
58+ if delegation_slot <= remote_slot_in_bank {
5959 // The last update of the account was after the last delegation
6060 // Therefore the account was not redelegated which indicates
6161 // that the undelegation is still not completed. Case (D))
@@ -132,14 +132,17 @@ mod tests {
132132 // Case B: The account was undelegated and was re-delegated to us.
133133 // Conditions:
134134 // - is_delegated: true (account is delegated to us on chain)
135- // - delegation_slot >= remote_slot (delegation happend after we last updated the account)
135+ // - delegation_slot > remote_slot (delegation happend after we last updated the account)
136136 // Expected: true (should override/update)
137137
138138 let pubkey = Pubkey :: default ( ) ;
139139 let is_delegated = true ;
140140 let remote_slot = 100 ;
141141
142+ // NOTE: this case led to incorrect unborking if delegation + undelegation + redelegation
143+ // happend all in the same slot
142144 // Subcase B1: delegation_slot == remote_slot
145+ /*
143146 let delegation_slot = 100;
144147 let deleg_record = Some(create_delegation_record(delegation_slot));
145148 assert!(!account_still_undelegating_on_chain(
@@ -149,6 +152,7 @@ mod tests {
149152 deleg_record,
150153 &Pubkey::default(),
151154 ));
155+ */
152156
153157 // Subcase B2: delegation_slot > remote_slot
154158 let delegation_slot = 101 ;
0 commit comments