<!-- XE-13348 · Bug report · testnet -->
*Markdown view of <https://bounty.xe.network/XE-13348>. The page is the record; this is the same page for reading.*

XE-13348 · Bounty

# Bug report

Closed · duplicate
—
[xe#493](https://github.com/xeprotocol/xe/issues/493)
filed 2026-11-12 03:08 UTC
by Gib230223

Verdict
:   Duplicate

Tier
:   —

Claimed
:   —

Area
:   Node / API

Duplicate of
:   —

Tracked
:   —

Updated
:   2026-11-20 00:38 UTC

Told
:   2026-11-20 00:34 UTC

### Patches

- [xe#518](https://github.com/xeprotocol/xe/pull/518) open by arturbarszcz78
  fix(node): compare LeaseAcceptPolicy cost thresholds against micro-XUSD amounts (fixes #493)

### History

- [554065](https://bounty.xe.network/log/554065) 2026-11-20 00:35 UTC github.state\_pushed
- [554064](https://bounty.xe.network/log/554064) 2026-11-20 00:35 UTC github.labels
- [554024](https://bounty.xe.network/log/554024) 2026-11-20 00:34 UTC reply.mirrored
- [552816](https://bounty.xe.network/log/552816) 2026-11-20 00:33 UTC proposal.adopted
- [552815](https://bounty.xe.network/log/552815) 2026-11-20 00:33 UTC reply.sent
- [552814](https://bounty.xe.network/log/552814) 2026-11-20 00:33 UTC ticket.status new → closed
- [552264](https://bounty.xe.network/log/552264) 2026-11-20 00:33 UTC proposal.adopted
- [552263](https://bounty.xe.network/log/552263) 2026-11-20 00:33 UTC ticket.facts area
- [552262](https://bounty.xe.network/log/552262) 2026-11-20 00:33 UTC proposal.adopted
- [552261](https://bounty.xe.network/log/552261) 2026-11-20 00:33 UTC ticket.facts
- [552260](https://bounty.xe.network/log/552260) 2026-11-20 00:33 UTC proposal.adopted
- [552259](https://bounty.xe.network/log/552259) 2026-11-20 00:33 UTC ticket.facts

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

### Report

# XE Bounty — Laporan siap file (temuan pass 3 #1)

File issue baru di: https://github.com/xeprotocol/xe/issues/new
Paste judul \+ isi di bawah. Akun GitHub: Gib230223.

---

## Judul

\[Bug\] LeaseAcceptPolicy cost thresholds off by 1,000,000× — whole-XUSD flags compared against micro-XUSD amounts

## Isi

## Summary

The provider `--min-lease-cost` / `--max-lease-cost` flags are documented as "whole XUSD", but the values are compared directly against `Block.Amount`, which is in micro-XUSD (1 XUSD \= 1,000,000 µXUSD). The thresholds are therefore off by a factor of 1,000,000: a min floor accepts almost everything, and a max cap rejects every lease.

## Evidence

- `cmd/xe/main.go:1309-1310` — flags documented as whole XUSD, passed through raw:

  ```
  provMinCost := flags.Uint64("min-lease-cost", 0, "Reject leases below this cost in whole XUSD. 0 = no min.")
  provMaxCost := flags.Uint64("max-lease-cost", 0, "Reject leases above this cost in whole XUSD. 0 = no max.")
  ```
- `cmd/xe/main.go:1357-1358` — no conversion:

  ```
  policy := node.LeaseAcceptPolicy{
      MinCostXUSD: *provMinCost,
      MaxCostXUSD: *provMaxCost,
      ...
  }
  ```
- `node/policy.go:40-45` (`Allow`) — compares the raw value against `b.Amount` and prints micro-units as "XUSD":

  ```
  if p.MinCostXUSD > 0 && b.Amount < p.MinCostXUSD {
      return fmt.Errorf("cost %d XUSD < policy min %d XUSD", b.Amount, p.MinCostXUSD)
  }
  if p.MaxCostXUSD > 0 && b.Amount > p.MaxCostXUSD {
      return fmt.Errorf("cost %d XUSD > policy max %d XUSD", b.Amount, p.MaxCostXUSD)
  }
  ```
- `core/amount.go:18`: `AssetXUSD = AssetConfig{Symbol: "XUSD", Decimals: 6, UnitsPerToken: 1_000_000}` — `b.Amount` is micro-XUSD. `core/ledger.go:55` `LeaseCost` returns micro-XUSD. No ×10⁶ conversion exists anywhere on the flag → policy → `Allow` path.

## Impact

- `--min-lease-cost 5` (intended 5 XUSD floor) enforces a 5 µXUSD floor — accepts essentially every lease.
- `--max-lease-cost 100` (intended 100 XUSD cap) enforces a 100 µXUSD cap — rejects every lease, bricking auto-accept for that provider.
- The duration thresholds in the same policy are correct (seconds vs seconds), which is why the cost bug is easy to miss. The error message also mislabels micro-units as "XUSD".

## Reproduction (PoC)

Test against `node.LeaseAcceptPolicy.Allow` with a minimal lease (1 vCPU / 1024 MB / 1 GB / 60 s, multiplier 1000). Minimal lease cost \= 517 µXUSD \= 0.000517 XUSD:

```
BUG: min-cost 5 (whole XUSD) ACCEPTED a 0.000517 XUSD lease (Amount=517 uXUSD)
BUG: max-cost 100 (whole XUSD) REJECTED a 0.000517 XUSD lease: cost 517 XUSD > policy max 100 XUSD
```

## Suggested fix

Multiply the flag values by 1,000,000 (or `core.AssetXUSD.UnitsPerToken`) at the flag boundary in `cmd/xe/main.go`, or convert inside `LeaseAcceptPolicy.Allow`. Also fix the error message to print the amount in whole XUSD (or label it µXUSD).

## Novelty note

This is the cost *units*, not the policy *scope*: XE-0104 covers `LeaseAcceptPolicy` only being consulted for `lease_open` (a unilateral `lease_renew` bypasses it). No bounty-board ticket covers the units mismatch (checked the live board, High\+Medium and Minor views, 2026-11-12).

Repo: github.com/xeprotocol/xe, HEAD 89a542e, testnet-0005.

### Thread

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

Thanks. This is the same finding as an earlier report that is not public, 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-13348 and says what differs; it is read like any other.
