Skip to content

fix(receivable): say when the node bound cut the list short - #109

Merged
pursekeeper merged 1 commit into
pursekeeper:mainfrom
manhliemcn4euwlu-source:fix/receivable-truncation
Oct 23, 2026
Merged

pursekeeper merged 1 commit into
pursekeeper:mainfrom
manhliemcn4euwlu-source:fix/receivable-truncation

Conversation

@manhliemcn4euwlu-source

Copy link
Copy Markdown
Contributor

What

/v1/receivable asked the node for a fixed count: '100' and said nothing about that bound, in the answer or in the README. A node answers at most count receivable hashes per call, so an account with more than 100 unpocketed sends read 100 of them as if that were the whole list. The route exists so a seller can find every payment; past 100 it silently stopped finding them.

This is the failure the README's own sentence invites: "Poll this for a per-order address instead of asking the payer for a hash." A per-order address with 100+ sends is not the shape anyone plans for, but it is the shape a busy seller gets, and nothing in the answer says the list was cut.

Evidence from the source

server.js receivable():

const r = await rpc({ action: 'receivable', account, count: '100', source: 'true', include_only_confirmed: 'true', ... });
const blocks = Object.entries(r.blocks ...).map(...);
return send(res, 200, { account, count: blocks.length, total_raw, total_nano, blocks, confirmed_only: true, note, checked_at, node });
  • The count is a literal, not a parameter and not an env var.
  • No truncated, hasMore, next, cursor or offset field anywhere in the route, and no pagination anywhere in the file (grep -i 'receivable.*cursor|offset|page' server.js finds nothing).
  • The README row for /v1/receivable (line 42) names min_raw and min_nano, the 2^128-1 ceiling, and the 60/min allowance, and never the 100-hash bound.
  • scripts/no-node.js receive loops over pend.blocks and pockets each one, so with the fix it keeps working and now prints how many were cut.

Fix

  • RECEIVABLE_MAX (default 100, the node default, overridable by env) replaces the literal.
  • When the answer holds RECEIVABLE_MAX rows it carries truncated: true and a next line saying to pocket these and poll again. Under the bound truncated is false and next is absent, so nothing changes for the normal case.
  • The README row says the bound and the new fields.

Test evidence

  • New test in test/free-limit.test.js: a mocked node returning 100 hashes answers count: 100, truncated: true with a next line; a node returning 1 answers truncated: false and no next.
  • Fails on the previous commit (git stash push -- server.js -> not ok 4, 3 pass 1 fail) and passes with the change (4/4).
  • Full suite: 219 tests, 214 pass, 0 fail, 5 skipped.

Scope

No change to the node call for any account under the bound, no change to min_raw/min_nano, no change to the 60/min allowance, no wire-format change beyond the two added fields on a full page.

Terms

Same class as api#103/#104 (merged, the free routes' counters) and api#105 (merged 2026-10-23, paid Ӿ4): a route that answers less than it promises, with the test that proves it. I am asking Ӿ2 on merge, or a refusal with the reason and the test left for the next person.

/v1/receivable asked the node for a fixed 100 hashes and said nothing
about the bound, in the answer or in the README. An account with more than
100 unpocketed sends read 100 of them as if that were the whole list, and
the poll that exists to find every payment silently stopped at 100.

The count is now RECEIVABLE_MAX (default 100, the node default), and the
answer carries truncated: true plus a next line naming the bound when it hits
it, so a seller pockets these and polls again. Under the bound nothing changes
and next is absent.

Regression test: 100 hashes -> truncated true with next; 1 hash -> truncated
false and no next. Fails on the previous commit (3 pass 1 fail), passes here
(4/4); full suite 219 tests, 214 pass, 0 fail, 5 skipped.
@pursekeeper
pursekeeper merged commit afc987a into pursekeeper:main Oct 23, 2026
pursekeeper pushed a commit that referenced this pull request Oct 23, 2026
…29 window + Retry-After), #109 (llmrt, receivable truncation flag), #110 (umpireboulianne-design, cohorts own-address row, repeat and funding after the fold); client-x402.js synced with skill 0.3.13 (cross-origin quote redirects refused, pyfile PR #7), the canonical-redirect case expects exit 6; test fixtures are synthetic accounts
@pursekeeper

Copy link
Copy Markdown
Owner

Merged as part of 407f273 (main 8cb92c0), live since 08:28:38Z: /v1/receivable carries truncated now (false on every account I read). Verified here: 223 tests, 218 pass, 0 fail, data md5 unchanged.

Ӿ1, ledger entry 458, block 8FACE72BFF242FB3F2D9E561109472883B914F9E12D20155E34B23E1A8CF1948, priced like #104: tested correctness fix, no Nano loss path (the sends past the bound stay on chain).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants