-
Notifications
You must be signed in to change notification settings - Fork 45
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
Validate amount parameter #525
Conversation
libs/sdk-core/src/breez_services.rs
Outdated
@@ -235,6 +235,23 @@ impl BreezServices { | |||
) -> SdkResult<Payment> { | |||
self.start_node().await?; | |||
let parsed_invoice = parse_invoice(bolt11.as_str())?; | |||
let invoice_amount_msat = parsed_invoice.amount_msat.unwrap_or_default(); | |||
let provided_amount_msat = amount_sats.unwrap_or_default() * 1000; |
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.
Maybe this is a good time to change the method signature to amount_msat? I think we'd want to do that anyway?
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.
I agree, changing to msat
is a step towards #417.
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.
I agree with both of you. I did change this method signature to msat. Not all other methods.
I think we have 2 more methods where we should change (I am not sure the onchain methods should use msat).
I suggest to do it in a separate PR.
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.
LGTM!
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. Just a comment about log filters below. As you're changing the send_payment interface, you could also move to a SendPaymentRequest struct
info, | ||
debug, | ||
breez_sdk_core::input_parser=warn, | ||
breez_sdk_core::backup=info, | ||
breez_sdk_core::persist::reverseswap=info, | ||
breez_sdk_core::reverseswap=info, | ||
gl_client=warn, | ||
gl_client=debug, |
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.
Did you mean to include log filter changes?
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.
Good catch! Actually I didn't but I find myself always change that when I need to debug, I think we can push this change as it enables logging the signer and gl-client node logs.
What do you think?
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.
👍 just making sure
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.
Should SendPaymentRequest struct changes be included to
?
fixed #522