-
Notifications
You must be signed in to change notification settings - Fork 906
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
Annotate payments initiated using sendonion with the amount at the destination #3881
Conversation
I agree with changs inside this PR, the normal user (like me) can feel a little confused when see the amount propriety null. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some style nits.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, though i did not follow the latest change to our pay logic closely enough to ack :-)
159d4bd
to
e36840e
Compare
I should probably add a bit more context: since we switched from the One of the things we broke downstream was spark-wallet (shesek/spark-wallet#146) which uses |
I can share a my generic think, I'm working to test it but I think is a good idea share it in this PR. @cdecker mentioned the command My complete idea shared here |
plugins/pay.c
Outdated
|
||
if (pm->amount != NULL) | ||
json_add_string(ret, "amount_msat", | ||
fmt_amount_msat(tmpctx, &pm->amount_sent)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, this will print 0 for failed payments (since it's allocated and never updated).
Probably need to gate this on "status" != "failed"?
We also need to stage the removal of the null field, since it's an API break... I can do this too. |
lightningd/pay.c
Outdated
@@ -97,9 +97,6 @@ void json_add_payment_fields(struct json_stream *response, | |||
if (amount_msat_greater(t->msatoshi, AMOUNT_MSAT(0))) | |||
json_add_amount_msat_compat(response, t->msatoshi, "msatoshi", | |||
"amount_msat"); | |||
else | |||
json_add_null(response, "amount_msat"); | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needs a compat gate, and 6 month deprecation cycle.
@rustyrussell if you mean the bolt11 null, I wrote a little code and I'm waiting to make a test with my testnet network. vincenzopalazzo@b59f72b |
That's different (though a good idea for next release): I was referring to the old Thanks! |
e36840e
to
3a846c1
Compare
OK, I dropped the commit which removed the ": null" ( json-rpc: Do not return a null amount_msat to listpays ) because it really should be done via a deprecation cycle, which means we should really pass "allow-deprecated-apis" to getmanifest, and that's too big a change for an -rc. I'll queue as a separate PR... |
Also, I prefer not to push to branches on this repo, because Travis tests them twice... |
Since we started using `sendonion` in the `pay` plugin we no longer automatically have the `amount` annotation on (partial) payments. This replicates the issue so we can fix it. Reported-by: Rusty Russell <@rustyrussell>
These were spamming my logs and could result in misleading results being returned on `listpays` and `listsendpays`.
While not directly necessary, it still feeds the `listpays` result, and so we should pass it along if we can, so we don't have to rely solely on the `amount_sent` field, which includes the fees. Reported-by: Rusty Russell <@rustyrussell>
We sum up the amounts just like we do with `amount_sent`, however we may have parts that don't have that annotation, so make it optional. Suggested-by: Rusty Russell <@rustyrussell>
3a846c1
to
315f1d3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK 315f1d3
Hello all... So to my understanding, sendpay is being used instead of pay call for the forseeable future? or temporarily? (This has also broken my front end for my app in development) |
No, |
resolved issue with pay plugin but...... |
Ok, so new node. Neither listsendpays nor listpays give complete payment info...now missing bolt11 invoice on listpays....and on listsendpays also no bolt 11 invoice?? minipc@minipc-desktop:$ lightning-cli listsendpays Either listsendpays or listpays MUST include bolt11,destination and payment hash. App is using listsendpays to list all payments sent...cannot identify without any identifiers. Need to call listsendpays or listpays with bolt 11 parameter....neither tracks so how can lookup particular invoice? (used by app to confirm payments after executing pay call) |
This should have been fixed by #3878 which was merged into master two days ago. What version are you using? |
0.9.0 rc3 |
rc3 is known to be buggy. It seems the bug you are reporting is already fixed in master. Can you try uninstalling and reinstalling again with master? |
Since we use
sendonion
in the new payment flow we end up not knowing the amount received by the destination, only the amount we sent (which includes fees).This PR adds an optional annotation that tells us what the intended amount to be sent is.
Notice that it is still possible to call
sendonion
without the annotation and readers callinglistpays
orlistsendpays
should fall back to the amount being sent if the amount at the destination is unknown. The amount_sent is always guaranteed to be known and set.Closes shesek/spark-wallet#146
Changelog-None