<!-- XE-13249 · [Medium] Auto force-settle deterministically broken for renewed leases — consumer refund stuck · testnet -->
*Markdown view of <https://bounty.xe.network/XE-13249>. The page is the record; this is the same page for reading.*

XE-13249 · Bounty

# \[Medium\] Auto force-settle deterministically broken for renewed leases — consumer refund stuck

Closed · duplicate
—claimed Medium
[xe#378](https://github.com/xeprotocol/xe/issues/378)
filed 2026-11-11 12:07 UTC
by agung marley

Verdict
:   Duplicate

Tier
:   —

Claimed
:   Medium

Area
:   Leasing / ledger

Duplicate of
:   [XE-0102](https://bounty.xe.network/XE-0102) triaging

Tracked
:   —

Updated
:   2026-11-20 00:07 UTC

Told
:   2026-11-20 00:05 UTC

### Patches

None linked.

### History

- [543914](https://bounty.xe.network/log/543914) 2026-11-20 00:06 UTC github.state\_pushed
- [543910](https://bounty.xe.network/log/543910) 2026-11-20 00:06 UTC github.labels
- [543768](https://bounty.xe.network/log/543768) 2026-11-20 00:05 UTC reply.mirrored
- [543584](https://bounty.xe.network/log/543584) 2026-11-20 00:04 UTC proposal.adopted
- [543583](https://bounty.xe.network/log/543583) 2026-11-20 00:04 UTC reply.sent
- [543582](https://bounty.xe.network/log/543582) 2026-11-20 00:04 UTC ticket.status new → closed
- [542202](https://bounty.xe.network/log/542202) 2026-11-20 00:04 UTC proposal.adopted
- [542201](https://bounty.xe.network/log/542201) 2026-11-20 00:04 UTC ticket.facts area
- [542200](https://bounty.xe.network/log/542200) 2026-11-20 00:04 UTC proposal.adopted
- [542199](https://bounty.xe.network/log/542199) 2026-11-20 00:04 UTC ticket.facts
- [542198](https://bounty.xe.network/log/542198) 2026-11-20 00:04 UTC proposal.adopted
- [542197](https://bounty.xe.network/log/542197) 2026-11-20 00:04 UTC ticket.facts

[Full history](https://bounty.xe.network/log?ref=XE-13249) · [JSON](https://bounty.xe.network/v1/tickets/XE-13249) · [markdown](https://bounty.xe.network/XE-13249.md)

### 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

[poc-f8f9f11.md](https://github.com/user-attachments/files/34686647/poc-f8f9f11.md)

### Thread

**Joseph Denne**team2026-11-20 00:05 UTCgithub

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.
