Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add log when sending BOLT 12 invoice #684

Merged
merged 2 commits into from
Jul 10, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 for ${invoice.amount} to introduction node ${destination.route.introductionNodeId}" }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we also log the whole invoice? This way we have everything we need to troubleshoot potential issues.
It shouldn't be too spammy.

Suggested change
logger.info { "sending BOLT 12 invoice for ${invoice.amount} to introduction node ${destination.route.introductionNodeId}" }
logger.info { "sending BOLT 12 invoice for ${invoice.amount} to introduction node ${destination.route.introductionNodeId} (invoice=${invoice.toString()})" }

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought about it but the invoice can be very big as we copy all fields from the invoice request. An attacker could make the invoice as large as the largest onion message. Do you still think we should log it?
I would be more comfortable adding specific fields.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I hesitated exactly because of that...it's true that the invoice_request can be arbitrarily big because of the padding TLV. Let me check what other fields may be useful for debugging.

Copy link
Member

@t-bast t-bast Jul 10, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right, there are a lot of things that aren't very useful for debugging, let's just also include paymentHash and payerId and we should have the most useful fields!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we can just truncate the invoice at a fixed length? That should be enough for debugging normal users

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That wouldn't be useful, if we truncate it we can't decode it...

OnionMessageAction.SendMessage(invoiceMessage.value)
}
}
}
}
Expand Down
Loading