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 fee_paid_msat to PaymentSuccessful event #271

Merged

Conversation

jbesraa
Copy link
Contributor

@jbesraa jbesraa commented Mar 5, 2024

Resolves the first part of #255 adding the paid fee to the PaymentSuccessful event.

@@ -133,8 +133,28 @@ fn multi_hop_sending() {
let invoice = nodes[4].receive_payment(2_500_000, &"asdf", 9217).unwrap();
nodes[0].send_payment(&invoice).unwrap();

expect_event!(nodes[4], PaymentReceived);
expect_event!(nodes[0], PaymentSuccessful);
let payment_hash = match nodes[4].wait_next_event() {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Rather than breaking the macros here, can we add expect_payment_received_event and expect_payment_successful_event macros?

src/event.rs Outdated
@@ -47,6 +47,8 @@ pub enum Event {
PaymentSuccessful {
/// The hash of the payment.
payment_hash: PaymentHash,
/// Paid fee in milli-satoshis.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Let's borrow a bit more verbose description from PaymentSent:

Suggested change
/// Paid fee in milli-satoshis.
/// The total fee which was spent at intermediate hops in this payment.

  The fee as returned from `PaymentSent` event generated by LDK and is
  saved in `PaymentSuccessful` event.
@jbesraa jbesraa force-pushed the paid-fee-in-paymentsuccess-event branch from 53f91ba to e20557c Compare March 6, 2024 15:41
@@ -80,6 +80,43 @@ macro_rules! expect_channel_ready_event {

pub(crate) use expect_channel_ready_event;

macro_rules! expect_payment_received_event {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@tnull I added the following macros following the pattern in the file. for some reason, the macros I added are marked as "unused" although they are used in the multihop test. what am i missing?
Also, should I split the commit for adding those two, or its ok to be in the same commit?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

"unused_macros: unused macro definition: expect_payment_successful_event"

Copy link
Collaborator

Choose a reason for hiding this comment

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

Ah, yeah, that's because the file is included individually in all integration tests but not all will use this. No worries, you can just leave it as is and I'll clean up in a follow-up.

@tnull tnull merged commit 02f0000 into lightningdevkit:main Mar 7, 2024
13 checks passed
@tnull tnull mentioned this pull request Mar 7, 2024
tnull added a commit that referenced this pull request Mar 7, 2024
@jbesraa jbesraa deleted the paid-fee-in-paymentsuccess-event branch April 27, 2024 17:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants