fix: always update total backing collateral in withdraw_collateral
@@ -249,9 +249,10 @@ impl<T: Config> Pallet<T> {
ensure!(Self::is_nomination_enabled(), Error::<T>::VaultNominationDisabled);
ensure!(Self::is_opted_in(vault_id)?, Error::<T>::VaultNotOptedInToNomination);
}
- ext::vault_registry::decrease_total_backing_collateral(&vault_id.currencies, &amount)?;
}
+ ext::vault_registry::decrease_total_backing_collateral(&vault_id.currencies, &amount)?;
+
// withdraw `amount` of stake from the vault staking pool
ext::vault_registry::pool_manager::withdraw_collateral::<T>(vault_id, nominator_id, &amount, Some(index))?;
amount.unlock_on(&vault_id.account_id)?;
