From aa109eb33dd87a31995a53654590e7d05202dd1c Mon Sep 17 00:00:00 2001 From: dcccrypto Date: Mon, 6 Apr 2026 06:37:19 +0100 Subject: [PATCH] fix: rename duplicate charge_fee_to_insurance (1-arg) to sweep_fee_debt_to_insurance The squash of PR #82 landed two definitions with the same name: - 2-arg: charge_fee_to_insurance(idx, fee) -> Result<(u128,u128)> [new, from fix/PERC-8463] - 1-arg: charge_fee_to_insurance(idx) -> u128 [old sweep-debt helper] Rename the 1-arg variant to sweep_fee_debt_to_insurance (matching its actual role: sweeping existing negative fee_credits into insurance). Update its two call sites in settle_maintenance_fee and settle_maintenance_fee_best_effort_for_crank. Co-Authored-By: Claude Sonnet 4.6 --- src/percolator.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/percolator.rs b/src/percolator.rs index 610788a01..bdbbb5738 100644 --- a/src/percolator.rs +++ b/src/percolator.rs @@ -4046,7 +4046,7 @@ impl RiskEngine { .saturating_sub(due as i128); // If fee_credits is negative, pay from capital using set_capital helper (spec §4.1) - let paid_from_capital = self.charge_fee_to_insurance(idx as usize); + let paid_from_capital = self.sweep_fee_debt_to_insurance(idx as usize); // Check maintenance margin if account has a position (MTM check) if self.accounts[idx as usize].position_size != 0 { @@ -4094,7 +4094,7 @@ impl RiskEngine { .saturating_sub(due as i128); // If negative, pay what we can from capital using set_capital helper (spec §4.1) - let paid_from_capital = self.charge_fee_to_insurance(idx as usize); + let paid_from_capital = self.sweep_fee_debt_to_insurance(idx as usize); Ok(paid_from_capital) // Return actual amount paid into insurance } @@ -4107,7 +4107,7 @@ impl RiskEngine { /// - Uses `set_capital` to maintain `c_tot` aggregate /// - Only touches capital when `fee_credits` is already negative /// - Pay = min(owed, current_cap); never underflows capital - fn charge_fee_to_insurance(&mut self, idx: usize) -> u128 { + fn sweep_fee_debt_to_insurance(&mut self, idx: usize) -> u128 { let mut paid_from_capital = 0u128; if self.accounts[idx].fee_credits.is_negative() { let owed = neg_i128_to_u128(self.accounts[idx].fee_credits.get());