Lightning swaps
The reviewed Lightning-receive path validates the inbound transfer before releasing an Operator's preimage share
The pinned receive handler checks receiver identity, invoice data, refund destinations, transaction structure, duplicates, and signatures before an Operator releases its preimage share. Operators therefore enforce the inbound exchange, while the same checks protect the receiver and do not establish custodial control. 12
What the evidence shows
Technical and product details
- Documented behavior
For a receive request, the pinned Operator handler parses the receiver identity, checks any stored preimage share belongs to that identity, and derives the invoice amount from the stored invoice when available. 1
Supporting material shown on this page
receive request and preimage-share validationPinned source code · github.com · checked 2026-08-24 Relevant lines from the pinned source · open raw file 1334 err = h.validatePackageOnlySendRequest(validateCtx, req, inputs, invoiceAmount, receiverIdentityPubKey, false) 1335 } else { 1336 err = h.validateGetPreimageRequest( 1337 validateCtx, 1338 req.GetPaymentHash(), 1339 inputs.validationCpfp, 1340 inputs.validationDirect, - Documented behavior
Before continuing, the handler validates the supplied transfer package. Its destination checks require the refund output to pay the expected receiver key and reject missing, mismatched, or unexpected outputs. 12
Supporting material shown on this page
receive request and preimage-share validationPinned source code · github.com · checked 2026-08-24 Relevant lines from the pinned source · open raw file 1334 err = h.validatePackageOnlySendRequest(validateCtx, req, inputs, invoiceAmount, receiverIdentityPubKey, false) 1335 } else { 1336 err = h.validateGetPreimageRequest( 1337 validateCtx, 1338 req.GetPaymentHash(), 1339 inputs.validationCpfp, 1340 inputs.validationDirect,refund destination validationPinned source code · github.com · checked 2026-08-24 Relevant lines from the pinned source · open raw file 485 } 486 return h.validateGetPreimageRequestWithFrostServiceClientFactory(ctx, &defaultFrostServiceClientConnection{}, paymentHash, cpfpTransactions, directTransactions, directFromCpfpTransactions, invoiceAmountSats, counterpartyPubKey, destinations, feeSats, reason, validateNodeOwnership) 487} 488 489// leafDestinations answers which key a given leaf's refund output must pay. v3 pays one 490// counterparty for the whole swap; v4 may pay different receivers per leaf. 491// Exactly one field carries the answer, and which one is set decides the mode: an unset single is - Documented behavior
The validation path also checks transaction identifiers, duplicate operations, limits, and signature shares before the receive flow continues. 2
Supporting material shown on this page
refund destination validationPinned source code · github.com · checked 2026-08-24 Relevant lines from the pinned source · open raw file 485 } 486 return h.validateGetPreimageRequestWithFrostServiceClientFactory(ctx, &defaultFrostServiceClientConnection{}, paymentHash, cpfpTransactions, directTransactions, directFromCpfpTransactions, invoiceAmountSats, counterpartyPubKey, destinations, feeSats, reason, validateNodeOwnership) 487} 488 489// leafDestinations answers which key a given leaf's refund output must pay. v3 pays one 490// counterparty for the whole swap; v4 may pay different receivers per leaf. 491// Exactly one field carries the answer, and which one is set decides the mode: an unset single is
Interpretation
Why this matters for Spark's trust model
Receiving over Lightning is not a direct handoff between payer and wallet. Operators participate in an escrow-like exchange: their preimage shares are released only after the inbound Spark transfer package satisfies the reviewed checks. 12
This section states the trust-model consequence of the cited evidence. Conditional or inferred claims remain bounded by the next section.
Scope control
What this does not establish
Sources and excerpts
Primary sources
The relevant details and available source-code excerpts appear alongside the claims above. This list preserves the complete original-source trail for independent verification.
receive request and preimage-share validation
Pinned source code · github.com · Pinned or archival · checked 2026-08-24
refund destination validation
Pinned source code · github.com · Pinned or archival · checked 2026-08-24
How sources, absence findings, and limitations were evaluated