Skip to content

Support CTID matching in acquire/extend response (#184) + optimize getURITokens (#191)#243

Open
xrplto wants to merge 4 commits into
EvernodeXRPL:mainfrom
xrplto:main
Open

Support CTID matching in acquire/extend response (#184) + optimize getURITokens (#191)#243
xrplto wants to merge 4 commits into
EvernodeXRPL:mainfrom
xrplto:main

Conversation

@xrplto

@xrplto xrplto commented Apr 12, 2026

Copy link
Copy Markdown

Two improvements:

CTID matching (#184)

watchAcquireResponse and watchExtendResponse now match the host's response against both the tx hash and CTID. This enables future hosts to use compact CTIDs in response memos (16 chars vs 64), reducing on-chain memo cost. Backwards compatible — still matches full hash.

getURITokens server-side filter (#191)

getURITokens now passes type: 'uri_token' to getAccountObjects so the server filters instead of fetching all account objects and filtering client-side. Reduces response payload for accounts with many objects.

Testing

  • All core tests pass (acquire, extend, timeout, error handling, concurrency)
  • getURITokens returns correct results with server-side filter
  • CTID matching is backwards compatible with existing hash-based responses

xrplto added 4 commits April 12, 2026 08:50
Three bugs that cause process crashes in long-running daemon scenarios:

1. Double-settle race condition: watchAcquireResponse and
   watchExtendResponse could call both resolve() and reject()
   on the same promise when the timeout fires after the polling loop
   already settled. Added settled guard with safeResolve/safeReject
   helpers.

2. Single error = immediate abort: Any transient error in
   getAccountTrx (WebSocket reconnect, network hiccup) would
   immediately reject with reason: 'UNKNOWN' and abort the entire
   acquire/extend. Changed to retry up to 10 times with 3s backoff
   before giving up.

3. Malformed tx crashes polling loop: If deserializeMemos or
   extractEvernodeEvent throws on a single transaction, it would
   crash the entire polling loop. Added per-transaction try/catch
   that skips malformed entries and continues scanning.

4. acquireLease wrapper: The .catch() on acquireLeaseSubmit called
   reject() but execution continued, potentially leading to a second
   reject() from the watchAcquireResponse path. Replaced with explicit
   try/catch and early return via safeReject.

Tested in production with 30+ concurrent leases over 24 hours — zero
process crashes after these fixes.
- xrpl: 2.2.1 → 4.6.0 (better WebSocket stability)
- ripple-address-codec: 4.2.0 → 5.0.0 (fixes base-x vulnerability)
- ripple-keypairs: 1.1.0 → 2.0.0
- libsodium-wrappers: 0.7.10 → 0.8.3
- xrpl-accountlib: 3.2.9 → 9.2.0
- Force apiVersion: 1 for Xahau compatibility (v2 not supported)
- Patch xrpl Client constructor to accept apiVersion option
Pass type: 'uri_token' to getAccountObjects so the server filters
instead of fetching all account objects and filtering client-side.
Reduces response payload significantly for accounts with many objects.
watchAcquireResponse and watchExtendResponse now match the host's
response against both the tx hash and CTID. This enables future
hosts to use compact CTIDs in response memos (16 chars vs 64),
reducing on-chain memo cost. Backwards compatible — still matches
full hash.
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.

1 participant