Skip to content

Commit

Permalink
Don't send payment secret when using keysend (#2574)
Browse files Browse the repository at this point in the history
Apparently lnd rejects keysend payments that contain a payment secret,
instead of simply ignoring that field.

The blip doesn't mention this requirement:
https://github.com/lightning/blips/blob/master/blip-0003.md

But we don't have a strong reason to send it either, so let's remove that.
  • Loading branch information
t-bast authored Jan 23, 2023
1 parent 8084f3c commit d52e869
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ case class SpontaneousRecipient(nodeId: PublicKey,

override def buildPayloads(paymentHash: ByteVector32, route: Route): Either[OutgoingPaymentError, PaymentPayloads] = {
ClearRecipient.validateRoute(nodeId, route).map(_ => {
val finalPayload = NodePayload(nodeId, FinalPayload.Standard.createKeySendPayload(route.amount, totalAmount, expiry, preimage, customTlvs))
val finalPayload = NodePayload(nodeId, FinalPayload.Standard.createKeySendPayload(route.amount, expiry, preimage, customTlvs))
Recipient.buildPayloads(totalAmount, expiry, Seq(finalPayload), route.hops)
})
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -386,11 +386,10 @@ object PaymentOnion {
Standard(TlvStream(tlvs, customTlvs))
}

def createKeySendPayload(amount: MilliSatoshi, totalAmount: MilliSatoshi, expiry: CltvExpiry, preimage: ByteVector32, customTlvs: Seq[GenericTlv] = Nil): Standard = {
def createKeySendPayload(amount: MilliSatoshi, expiry: CltvExpiry, preimage: ByteVector32, customTlvs: Seq[GenericTlv] = Nil): Standard = {
val tlvs = Seq(
AmountToForward(amount),
OutgoingCltv(expiry),
PaymentData(preimage, totalAmount),
KeySend(preimage)
)
Standard(TlvStream(tlvs, customTlvs))
Expand Down

0 comments on commit d52e869

Please sign in to comment.