[Medium] Auto force-settle deterministically broken for renewed leases — consumer refund stuck
Report
Summary
The consumer node's auto force-settle retries every ~10 s and always fails for renewed leases with balance mismatch: expected 49981983, got 49981466 (diff = exactly the 517 mXUSD renewal cost). A hand-built lease_force_settle with Balance = old + (cost + renewalCost) succeeded immediately and refunded 1,034 mXUSD. Control: auto force-settle of a non-renewed lease on the same node succeeded.
Evidence
forceSettleLease (node/node.go:1901-1935) builds Balance: oldXUSD + lease.Cost (base cost only). validateAndAddLeaseForceSettle (core/ledger.go:1879+) requires b.Balance == oldBal + pending.Amount, where pending includes renewals (core/lease_renew.go:~130 sets commit.TopUpPendingAmount = b.Amount; store/badger_store.go:~676 adds it to the pending send). So with ≥1 renewal, lease.Cost < pending.Amount and every auto attempt is rejected with "balance mismatch". The Amount field can't save it — the ledger never checks b.Amount on force-settle. tryForceSettleStaleLeases (node/node.go:1836-1851) retries every 10 s indefinitely. The refund window then closes at expiry + LeaseEscrowExpiry (1 year, core/ledger.go:151), after which archiveExpiredLease (node/node.go:1886-1900) deletes the pending and burns the escrow.
Full PoC: poc-f8f9f11.md (lease → 1 renewal → expire un-settled; 4 failed auto attempts logged; hand-built force-settle succeeded; non-renewed control succeeded).
Fix direction
Include the renewal cost in the auto force-settle balance computation (pending amount, not base lease.Cost).
My XE address for any reward: 5422b32c07cf2b2ca53b00c2073be5a895dae3fdf13645c05ebdd1c08864cf8f
— @agngmarley
Thread
Thanks. This is the same finding as https://bounty.xe.network/XE-0102, which was filed first; the programme pays the first verifiable submission, so this one closes as a duplicate. If you believe it is a different bug, file a new report that links https://bounty.xe.network/XE-13249 and says what differs; it is read like any other.