Skip to content

Commit

Permalink
Add log when sending BOLT 12 invoice (#684)
Browse files Browse the repository at this point in the history
Log relevant fields when we send an invoice as a reply to an invoice request.
  • Loading branch information
thomash-acinq authored Jul 10, 2024
1 parent bdf5e4a commit efe0ac1
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,10 @@ class OfferManager(val nodeParams: NodeParams, val walletParams: WalletParams, v
logger.warning { "offerId:${offer.offerId} pathId:${decrypted.pathId} ignoring invoice request, could not build onion message: ${invoiceMessage.value}" }
sendInvoiceError("failed to build onion message", decrypted.content.replyPath)
}
is Right -> OnionMessageAction.SendMessage(invoiceMessage.value)
is Right -> {
logger.info { "sending BOLT 12 invoice with amount=${invoice.amount}, paymentHash=${invoice.paymentHash}, payerId=${invoice.invoiceRequest.payerId} to introduction node ${destination.route.introductionNodeId}" }
OnionMessageAction.SendMessage(invoiceMessage.value)
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1587,6 +1587,9 @@ data class OnionMessage(
OnionRoutingPacketSerializer(onionRoutingPacket.payload.size()).write(onionRoutingPacket, out)
}

override fun toString(): String =
"OnionMessage(blindingKey=$blindingKey, onionRoutingPacket=OnionRoutingPacket(version=${onionRoutingPacket.version}, publicKey=${onionRoutingPacket.publicKey.toHex()}, payload=<${onionRoutingPacket.payload.size()} bytes>, hmac=${onionRoutingPacket.hmac.toHex()}))"

companion object : LightningMessageReader<OnionMessage> {
const val type: Long = 513

Expand Down
6 changes: 3 additions & 3 deletions src/commonMain/kotlin/fr/acinq/lightning/wire/OnionRouting.kt
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ import fr.acinq.lightning.utils.toByteVector32

data class OnionRoutingPacket(
val version: Int,
val publicKey: ByteVector,
val payload: ByteVector,
val hmac: ByteVector32
val publicKey: ByteVector,
val payload: ByteVector,
val hmac: ByteVector32
) {
companion object {
const val PaymentPacketLength = 1300
Expand Down

0 comments on commit efe0ac1

Please sign in to comment.