Closed slanesuke closed 3 weeks ago
Seems some tests are failing currently
For now, I removed the payer_id
fields. I also ended up adding a quantity
parameter that's set by the user in the BOLT 12 send
method.
rebased
@tnull I pushed an updated simple_bolt12_send_receive
unit test where I added a quantity
and payer_note
to send
, send_using_amount
, and initiate_refund
. Unfortunately initiate_refund
is the only Bolt12Payment method that was successful when the quantity
was Some
. Otherwise, the send methods failed due to unexpected/undetermined behavior. Do you think you can spot the problem? It seems to be failing when we call pay_for_offer
but I'm unsure..
@tnull I pushed an updated
simple_bolt12_send_receive
unit test where I added aquantity
andpayer_note
tosend
,send_using_amount
, andinitiate_refund
. Unfortunatelyinitiate_refund
is the only Bolt12Payment method that was successful when thequantity
wasSome
. Otherwise, the send methods failed due to unexpected/undetermined behavior. Do you think you can spot the problem? It seems to be failing when we callpay_for_offer
but I'm unsure..
Ah, this seems to be a bug (?), i.e. the Offer
's default Quantity::One
variant being incompatible with setting quantity: Some(1)
, which is rather confusing: https://github.com/lightningdevkit/rust-lightning/issues/3233.
I think for now we just want to set the supported_quantity
in the offer to fix our tests. Btw, this also shows we still need to add a supported_quantity
field to receive
to allow setting a quantity when generating the offer. I'm a bit on the fence right now if we need to create our own Quantity
enum for this (to make it bindings-compatible) or simply have it be an Option<u64>
(which would require not covering the Unbounded
variant and erroring if the given quantity is 0). I think we still should do the latter (i.e., taking it as an Option<u64>
) and possibly reconsider if a user complains that they require the Unbounded
case.
@tnull I pushed an updated
simple_bolt12_send_receive
unit test where I added aquantity
andpayer_note
tosend
,send_using_amount
, andinitiate_refund
. Unfortunatelyinitiate_refund
is the only Bolt12Payment method that was successful when thequantity
wasSome
. Otherwise, the send methods failed due to unexpected/undetermined behavior. Do you think you can spot the problem? It seems to be failing when we callpay_for_offer
but I'm unsure..Ah, this seems to be a bug (?), i.e. the
Offer
's defaultQuantity::One
variant being incompatible with settingquantity: Some(1)
, which is rather confusing: lightningdevkit/rust-lightning#3233.I think for now we just want to set the
supported_quantity
in the offer to fix our tests. Btw, this also shows we still need to add asupported_quantity
field toreceive
to allow setting a quantity when generating the offer. I'm a bit on the fence right now if we need to create our ownQuantity
enum for this (to make it bindings-compatible) or simply have it be anOption<u64>
(which would require not covering theUnbounded
variant and erroring if the given quantity is 0). I think we still should do the latter (i.e., taking it as anOption<u64>
) and possibly reconsider if a user complains that they require theUnbounded
case.
Thanks for pointing that out! But, I noticed that it's not just Some(1)
that fails, the send methods fail regardless of the value set for quantity. It seems like the issue could be something else maybe?
Thanks for pointing that out! But, I noticed that it's not just
Some(1)
that fails, the send methods fail regardless of the value set for quantity. It seems like the issue could be something else maybe?
Well this is expected: if you don't set a supported_quantity
during offer generation, anything >1 would also fail. IMO it's just confusing that it also fails for 1
. But, yeah, hence we should allow setting supported_quantity
in this PR as mentioned above.
Thanks for pointing that out! But, I noticed that it's not just
Some(1)
that fails, the send methods fail regardless of the value set for quantity. It seems like the issue could be something else maybe?Well this is expected: if you don't set a
supported_quantity
during offer generation, anything >1 would also fail. IMO it's just confusing that it also fails for1
. But, yeah, hence we should allow settingsupported_quantity
in this PR as mentioned above.
Ah okay! Makes sense
rebased
Mh, I think you'll need another rebase, seems the CI caching issue wasn't fully fixed afterall. Sorry!
So while setting the quantity to None
when sending a payment via the bolt12 send
results in a an InvoiceRequestCreationFailed
. The only way I was able to get around it was defaulting the quantity to 1 when the user sets it to None
. I know this isn't ideal though
LGTM
One tiny nit, feel free to address it while squashing in the (last) fixup commit, so we can land this PR ASAP.
Okay, squashed!
Resolves #320
This PR adds support for including the
payer_note
field inPaymentKind::Bolt12
. It also updates the relevant parts of the code to handle wherepayer_note
is required.