Repository navigation
feat(payments): reuse cached credentials in send [AMB-3309] - #57
Merged
Merged
Conversation
…AMB-3309] Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…e [AMB-3309] Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
A send that joined another caller's in-flight derivation inherited that caller's failure, so a wrong-password send (or a passwordless prepare) could fail a concurrent send with the right password. A joiner now derives with its own credentials when the derivation it joined rejects. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
bufo24
force-pushed
the
feat/AMB-3309-reuse-cached-send-credentials
branch
from
October 2, 2026 16:16
067132b to
694cc81
Compare
wthrajat
approved these changes
Oct 2, 2026
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.
Problem
Transactions.send()derives node credentials on every call when apasswordis passed: two GraphQL round trips plus two Argon2id passes (m=64 MiB, t=3, p=4). OnlyprepareSend()filled the cache, and only asend()without a password read it.Measurement (litd-mainnet-144d77c6, 100 sat payments to one Lightning address, one at a time)
Time from the
send()call to the REST request reaching the node:send()with password (derives every time)prepareSend()once, thensend()without passwordChange
send()andprepareSend()now share one private path (#prepare). A cache hit is used even when apasswordis passed. A miss derives once and stores the result, so the first payment warms the cache.#pending).forgetSend()during a derivation stops the result from being stored (that onesend()still pays with what it derived); sandbox wallets work;retryPaymentreads the same cache.docs/INTEGRATION.md,AGENTS.md, JSDoc onsend,prepareSend,isSendReady,forgetSend,PaymentsConfig.sendandSendParams.password.Behavior changes to review
send(), with no expiry. Before, this happened only after an explicitprepareSend().send()when credentials are already cached. It still must be non-empty.forgetSend(walletId).Also: a
teamIdoverride passed tosend()is ignored on a cache hit.Open question
Do we want an opt-out (for example a per-call flag to skip the cache) for callers that must not keep the macaroon in memory? Not added here;
forgetSend()after a run of sends is the current way.Test plan
pnpm buildpassespnpm typecheckpasses (the repo has no lint script)pnpm format:checkpassespnpm test: core 11/11, payments 82/82 passprepareSendshare one, failed derivation not cached,forgetSendmid-derivation not stored, second sandbox send skips the wallet lookup.Linear: https://linear.app/amboss/issue/AMB-3309
🤖 Generated with Claude Code