{"id":"XE-16975","kind":"bounty","visibility":"public","source":"github","source_repo":"xeprotocol/xe","source_ref":"690","source_url":"https://github.com/xeprotocol/xe/issues/690","reporter_id":2920,"title":"[Low] CLI/SDK ignore spendable — balance display, send gating, and provider stake checks use unfinalized totals","area":"sdk-docs-web","claimed_tier":null,"assessed_tier":null,"verdict":"duplicate","duplicate_of":null,"tracked":false,"internal_ref":"","internal_url":"","status":"closed","closed_reason":"duplicate","github_state":"open","disclosed_at":null,"award_xe":null,"award_approved":false,"paid_ref":"","created_at":"2026-11-17T08:11:51.844867+00:00","updated_at":"2026-11-22T23:26:11.812084+00:00","source_created_at":"2026-11-17T08:11:35+00:00","told_at":"2026-11-22T23:26:11.828949+00:00","status_changed_at":"2026-11-22T23:26:11.817774+00:00","url":"https://bounty.xe.network/XE-16975","body":"## Summary\n\nThe API already returns `spendable` and `final_height` alongside `balances`, but the Go SDK's `GetBalances` decodes only `balances` — so the CLI balance display, the CLI send sufficiency check, and the provider stake check all operate on unfinalized totals. CLI users cannot distinguish confirmed from unconfirmed funds, and sends built on unfinalized funds are accepted then reorgable. The web wallet, against the same API, does it right.\n\n## Root Cause\n\n- Server `handleGetBalance` (`api/handler.go:453-478`) returns `balances` + `spendable` + `final_height`.\n- SDK `GetBalances` (`client/client.go:61-77`) decodes only `balances` (struct `:69-71`) — `spendable` and `final_height` are silently dropped.\n- `cmdWalletBalance` (`cmd/xe/main.go:642-663`) therefore prints totals only; `cmdSend`'s sufficiency check (`:700-702`, `bals[asset] < amount`) passes against funds that may be unwound in a fork; `pickProvider`'s stake check (`:1732-1733`, `bals[\"XCU\"] >= stake`) passes a provider whose stake funds may be locked/unspendable.\n- Contrast — the web wallet, same API: loads spendable (`web/assets/wallet.js:699`), displays a spendable column (`:737`), shows spendable in the asset dropdown (`:799`), and blocks sends above spendable (`:827-829`).\n\n## Verification\n\nExecuted PoC against the real `api.Handler` (httptest + fake backend):\n\n```\nGetBalances raw server body: {\"balances\":{\"XCU\":500,\"XE\":1000},\"spendable\":{\"XCU\":50,\"XE\":100},\"final_height\":2}\nSDK returned: map[XCU:500 XE:1000]   (spendable + final_height dropped)\n```\n\n## Note on related reports\n\nSearched \"spendable\" — #382 is server-side (API serving spendable from an unconfirmed frontier during sync lag), a different component and root cause; cite as related, not a dup.\n\n## Suggested fix\n\nDecode `spendable` and `final_height` in `GetBalances` (new return type or accessor), have the CLI display spendable alongside totals, and gate `cmdSend` and `pickProvider` on spendable.\n","patch_refs":[],"thread":[{"id":18799,"source":"desk","source_ref":"reply:16476","author":"Joseph Denne","team":true,"body":"Thanks. This is the same finding as an earlier report that is not public, 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-16975 and says what differs; it is read like any other.","created_at":"2026-11-22T23:26:11.812084+00:00"}]}