Support CTID matching in acquire/extend response (#184) + optimize getURITokens (#191)#243
Open
xrplto wants to merge 4 commits into
Open
Support CTID matching in acquire/extend response (#184) + optimize getURITokens (#191)#243xrplto wants to merge 4 commits into
xrplto wants to merge 4 commits into
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two improvements:
CTID matching (#184)
watchAcquireResponseandwatchExtendResponsenow 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)
getURITokensnow passestype: 'uri_token'togetAccountObjectsso the server filters instead of fetching all account objects and filtering client-side. Reduces response payload for accounts with many objects.Testing