{"id":"XE-13249","kind":"bounty","visibility":"public","source":"github","source_repo":"xeprotocol/xe","source_ref":"378","source_url":"https://github.com/xeprotocol/xe/issues/378","reporter_id":1343,"title":"[Medium] Auto force-settle deterministically broken for renewed leases — consumer refund stuck","area":"leasing-ledger","claimed_tier":"medium","assessed_tier":null,"verdict":"duplicate","duplicate_of":"XE-0102","tracked":false,"internal_ref":"","internal_url":"","status":"closed","closed_reason":"duplicate","github_state":"closed","disclosed_at":null,"award_xe":null,"award_approved":false,"paid_ref":"","created_at":"2026-11-14T20:42:03.467176+00:00","updated_at":"2026-11-20T00:07:06.076187+00:00","source_created_at":"2026-11-11T12:07:36+00:00","told_at":"2026-11-20T00:05:09+00:00","status_changed_at":"2026-11-20T00:04:40.315696+00:00","url":"https://bounty.xe.network/XE-13249","body":"## Summary\n\nThe 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.\n\n## Evidence\n\n`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.\n\nFull PoC: `poc-f8f9f11.md` (lease → 1 renewal → expire un-settled; 4 failed auto attempts logged; hand-built force-settle succeeded; non-renewed control succeeded).\n\n## Fix direction\n\nInclude the renewal cost in the auto force-settle balance computation (pending amount, not base `lease.Cost`).\n\nMy XE address for any reward: 5422b32c07cf2b2ca53b00c2073be5a895dae3fdf13645c05ebdd1c08864cf8f\n\n— @agngmarley\n\n[poc-f8f9f11.md](https://github.com/user-attachments/files/34686647/poc-f8f9f11.md)","patch_refs":[],"thread":[{"id":12834,"source":"github","source_ref":"7025803734","author":"Joseph Denne","team":true,"body":"Thanks. This is the same finding as https://bounty.xe.network/XE-0102, which was filed first; the programme pays the\nfirst verifiable submission, so this one closes as a duplicate. If you believe it is a different\nbug, file a new report that links https://bounty.xe.network/XE-13249 and says what differs; it is read like any other.","created_at":"2026-11-20T00:05:09+00:00"}]}