-
Notifications
You must be signed in to change notification settings - Fork 28
Feature show preimage listpayments getpayment #64
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
base: master
Are you sure you want to change the base?
Feature show preimage listpayments getpayment #64
Conversation
…ents_getpayment add preimage field to /listpayments and /getpayment response
…ments_getpayment add test for get_payment APIs
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.
Thank you!
Requested some small changes. Please also squash into a single signed commit saying add preimage to Payment
and then rebase on top of the updated master.
Finally check lint and format with the latest stable rust
preimage: | ||
type: string | ||
description: Optional custom payment preimage (hex string, 32 bytes) | ||
example: "1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef" |
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.
example: "1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef" | |
example: 89d28bd306aa9bb906fd0ac31092d04c37c919a171b343083167e2a3cdc60578 |
example: 03b79a4bc1ec365524b4fab9a39eb133753646babb5a1da5c4bc94c53110b7795d | ||
preimage: | ||
type: string | ||
description: Optional custom payment preimage (hex string, 32 bytes) |
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.
description: Optional custom payment preimage (hex string, 32 bytes) |
assert!( | ||
payment.preimage.is_some(), | ||
"Payment preimage should be present for successful payment" | ||
); |
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.
assert!( | |
payment.preimage.is_some(), | |
"Payment preimage should be present for successful payment" | |
); | |
let payment_preimage_hash = hex_str( | |
&Sha256::hash(&hex_str_to_vec(&payment.preimage.unwrap()).unwrap()).to_byte_array(), | |
); | |
assert_eq!(payment_preimage_hash, decoded.payment_hash); |
please do this in this entire test, instead of checking that it's some.
you will also need to modify the top of the file like this:
+use bitcoin::hashes::sha256::Hash as Sha256;
+use bitcoin::hashes::Hash;
+
use crate::routes::{BitcoinNetwork, TransactionType, TransferKind, TransferStatus};
+use crate::utils::hex_str;
No description provided.