{"id":"XE-13251","kind":"bounty","visibility":"public","source":"github","source_repo":"xeprotocol/xe","source_ref":"382","source_url":"https://github.com/xeprotocol/xe/issues/382","reporter_id":1356,"title":"[Minor] GET /accounts/{address}/balance reports spendable from a node's local unconfirmed frontier with no unconfirmed flag","area":"node-api","claimed_tier":"minor","assessed_tier":null,"verdict":"invalid","duplicate_of":null,"tracked":false,"internal_ref":"","internal_url":"","status":"closed","closed_reason":"invalid","github_state":"closed","disclosed_at":null,"award_xe":null,"award_approved":false,"paid_ref":"","created_at":"2026-11-14T20:42:03.525979+00:00","updated_at":"2026-11-20T00:25:44.784129+00:00","source_created_at":"2026-11-11T12:37:54+00:00","told_at":"2026-11-20T00:24:45+00:00","status_changed_at":"2026-11-20T00:08:44.024333+00:00","url":"https://bounty.xe.network/XE-13251","body":"Suggested severity tier: Minor / Informational. This is not a double-spend and not a consensus break. A lagging or partitioned node can briefly serve a conflicting unconfirmed send as the account’s `balances` / `spendable`. Standard “wait for finality” guidance already mitigates it. Closest official class is Medium (“inconsistent API responses”); we ask for Minor because the `finalized` flag on `GET /blocks/{hash}` is correct, and the `/balance` body already carries `final_height`, which did not advance on the lagging node.\n\nAffected component:\n- HTTP API: `GET /accounts/{address}/balance` (`api/handler.go` `handleGetBalance`)\n- Network: testnet-0005\n- Reproduced 2026-11-11 (Asia/Jakarta) during a cross-node fork on our own wallets, submitting to `https://ldn.core.test.network` and `https://nyc.core.test.network`\n- Not Critical/Severe — no `security@` disclosure needed.\n\nSummary:\n`GET /accounts/{address}/balance` reports `balances` and `spendable` from the node’s **local, possibly unconfirmed** account frontier, with no “unconfirmed / conflicted frontier” indicator on those fields. During a ~1–3 minute sync lag, a partitioned node served a conflicting unfinalized send as the account’s spendable balance, while the main cluster had already finalized a different sibling. An integrator that trusts a single node’s `spendable` without checking per-block `finalized` (or comparing `final_height`) could briefly honor a payment that is later rolled back.\n\nConsensus itself held: exactly one of the two conflicting sends reached finality network-wide; the loser stayed `finalized: false` and never created a pending credit for its recipient. This report is about the `/balance` response shape, not about a ledger break.\n\nReproduction (own two wallets only; testnet-0005; 2026-11-11, times in Asia/Jakarta):\n\nWallet w1 `2dda1e8cead608801ed02791123da1e11bfc2b90862d68b2954e2995b7f57b18` had a finalized frontier `17f57de2bff381c0639be0b290c1aa1e789f5e3363cc4e4fafe92b1c2bc15368`. Two conflicting signed sends were built on that same `previous` and submitted concurrently:\n\n- Send A (0.1 XE to w2 `26cb43c666848a35b50ba5e85b8822a0019973bf578bba5f4fa5dc2100711505`, resulting balance 800000 micro-XE), hash `4f9eb3e00cba5d4bea2fc7fa4bde49860f53a109e8b2fa6b72bb6f300237197e`, POST to `https://ldn.core.test.network` — accepted (201) at 18:50:09.\n- Send B (0.3 XE to a fresh address `11112222333344445555666677778888aaaabbbbccccddddeeeeffff00001111`, resulting balance 600000 micro-XE), hash `237a18e1a24c66adca2889ad7484b09c510c618d4f69556c072183626d2c2c61`, POST to `https://nyc.core.test.network` — accepted (201) at 18:50:09.\n\n`GET /accounts/{w1}/balance` and `GET /blocks/{hash}` were then polled on both nodes. Observed at 18:50:17 (and still at every poll through 18:51:14):\n\nOn ldn (then, from 18:50:25, with A `finalized: true`):\n\n```json\n{\"address\":\"2dda1e8cead608801ed02791123da1e11bfc2b90862d68b2954e2995b7f57b18\",\"balances\":{\"XE\":800000},\"spendable\":{\"XE\":800000},\"final_height\":3}\n```\n\nOn nyc (B visible locally with `finalized: false`; A was 404):\n\n```json\n{\"address\":\"2dda1e8cead608801ed02791123da1e11bfc2b90862d68b2954e2995b7f57b18\",\"balances\":{\"XE\":600000},\"spendable\":{\"XE\":600000},\"final_height\":2}\n```\n\nSo for at least ~65 seconds (and, per the full probe write-up, for roughly 2–3 minutes before nyc caught up) a client that asked only nyc’s `/balance` was told w1’s spendable was 0.6 XE, which is the unconfirmed loser, not the finalized history. `final_height` on nyc stayed at 2 (it did not advance with the unconfirmed send), while `balances` / `spendable` followed the local unfinalized frontier. The response has no field that says “this spendable is unconfirmed.”\n\nA same-node variant (two siblings posted back-to-back to one node) also staged both blocks; ORV finalized exactly one (`3aa61d11f125f8f915e11f065960b13b0c2edc5e58ce8c6d33a7a905c7436624` `finalized: true`; sibling `9071ffadedf6d483e9ff57664dcc3f846d38a9a3b864aeeac3c3c6d2975fc1f6` stayed `finalized: false`); w1 was debited once. `/balance` on that node then matched the finalized winner, so the misleading case is the lagging/partitioned node, not a fully caught-up one.\n\nExpected vs actual:\n- Expected: `/balance` either reports only finalized balances (for example a `final_balance` / `final_spendable`), or it keeps serving the local frontier but marks it, e.g. `has_unconfirmed_frontier: true`, when `balances` / `spendable` include a block that is not yet `finalized`.\n- Actual: `balances` and `spendable` follow the local frontier with no such flag. (`final_height` does stay on the last finalized height, which is a partial hint if the client compares it, but that contract is not documented on the spendable fields.)\n\nImpact:\nLow / Informational. No double-spend, no fund theft, no finality reversal. The window is the lagging node’s sync delay (observed on the order of minutes on a node that was already behind, with a pre-existing `dropped_blocks` count of 1306). The worst case is an integrator that treats a single node’s `spendable` as final and briefly honors a payment that is later rolled back. Checking `GET /blocks/{hash}` for `finalized: true`, or treating `final_height` as the safety signal, already avoids this. This is arguably expected “wait for finality” behaviour; the gap is that `/balance` does not say so.\n\nSuggested fix:\nExpose a `has_unconfirmed_frontier` and/or `final_balance` / `final_spendable` field on `GET /accounts/{address}/balance`, and/or document in the API docs that `balances` / `spendable` are local-frontier views and that only blocks with `finalized: true` (and the account’s `final_height`) are safe to treat as settled.\n\nProposed tier: Minor / Informational (API hygiene / missing indicator). Not a consensus or funds bug.\n\nReporter:\n- XE address for reward: `2dda1e8cead608801ed02791123da1e11bfc2b90862d68b2954e2995b7f57b18`\n- Only my own two accounts were used; no third-party funds, keys, or workloads were targeted.\n","patch_refs":[{"id":732,"repo":"xeprotocol/xe","kind":"pr","ref":"881","title":"fix(xe): minor--get--accounts--address (fixes #382)","url":"https://github.com/xeprotocol/xe/pull/881","note":"","state":"open","author":"tipprb","added_by":"desk","created_at":"2026-11-19T18:46:29.438859+00:00"}],"thread":[{"id":13036,"source":"github","source_ref":"7026261245","author":"XE desk","team":true,"body":"Thanks for the report. We read it against the code and could not confirm a bug in what it describes.\n\nThis report is closed as invalid. If we have missed something, file a new report that links\nhttps://bounty.xe.network/XE-13251 and says what; it is read like any other.","created_at":"2026-11-20T00:24:45+00:00"}]}