Feature show preimage listpayments getpayment#64
Open
lukegao209 wants to merge 4 commits intoRGB-Tools:masterfrom
Open
Feature show preimage listpayments getpayment#64lukegao209 wants to merge 4 commits intoRGB-Tools:masterfrom
lukegao209 wants to merge 4 commits intoRGB-Tools:masterfrom
Conversation
…ents_getpayment add preimage field to /listpayments and /getpayment response
…ments_getpayment add test for get_payment APIs
zoedberg
requested changes
Jul 30, 2025
Member
zoedberg
left a comment
There was a problem hiding this comment.
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" |
Member
There was a problem hiding this comment.
Suggested change
| example: "1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef" | |
| example: 89d28bd306aa9bb906fd0ac31092d04c37c919a171b343083167e2a3cdc60578 |
| example: 03b79a4bc1ec365524b4fab9a39eb133753646babb5a1da5c4bc94c53110b7795d | ||
| preimage: | ||
| type: string | ||
| description: Optional custom payment preimage (hex string, 32 bytes) |
Member
There was a problem hiding this comment.
Suggested change
| description: Optional custom payment preimage (hex string, 32 bytes) |
Comment on lines
+66
to
+69
| assert!( | ||
| payment.preimage.is_some(), | ||
| "Payment preimage should be present for successful payment" | ||
| ); |
Member
There was a problem hiding this comment.
Suggested change
| 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;
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.