-
Notifications
You must be signed in to change notification settings - Fork 31
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
Open
lukegao209
wants to merge
4
commits into
RGB-Tools:master
Choose a base branch
from
lukegao209:feature_show_preimage_listpayments_getpayment
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
f0fa409
add preimage field to /listpayments and /getpayment response
c73f9f8
Merge pull request #7 from free-free-6/feature_show_preimage_listpaym…
lukegao209 1cabca1
add test for get_payment APIs
0536773
Merge pull request #12 from free-free-6/feature_show_preimage_listpay…
lukegao209 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -1892,6 +1892,10 @@ components: | |||||
| payee_pubkey: | ||||||
| type: string | ||||||
| example: 03b79a4bc1ec365524b4fab9a39eb133753646babb5a1da5c4bc94c53110b7795d | ||||||
| preimage: | ||||||
| type: string | ||||||
| description: Optional custom payment preimage (hex string, 32 bytes) | ||||||
| example: "1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef" | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| Peer: | ||||||
| type: object | ||||||
| properties: | ||||||
|
|
||||||
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
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
| Original file line number | Diff line number | Diff line change | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -63,10 +63,18 @@ async fn success() { | |||||||||||||||||
| assert_eq!(payment.asset_id, Some(asset_id.clone())); | ||||||||||||||||||
| assert_eq!(payment.asset_amount, asset_amount); | ||||||||||||||||||
| assert_eq!(payment.status, HTLCStatus::Succeeded); | ||||||||||||||||||
| assert!( | ||||||||||||||||||
| payment.preimage.is_some(), | ||||||||||||||||||
| "Payment preimage should be present for successful payment" | ||||||||||||||||||
| ); | ||||||||||||||||||
|
Comment on lines
+66
to
+69
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
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; |
||||||||||||||||||
| let payment = get_payment(node2_addr, &decoded.payment_hash).await; | ||||||||||||||||||
| assert_eq!(payment.asset_id, Some(asset_id.clone())); | ||||||||||||||||||
| assert_eq!(payment.asset_amount, asset_amount); | ||||||||||||||||||
| assert_eq!(payment.status, HTLCStatus::Succeeded); | ||||||||||||||||||
| assert!( | ||||||||||||||||||
| payment.preimage.is_some(), | ||||||||||||||||||
| "Payment preimage should be present for successful payment" | ||||||||||||||||||
| ); | ||||||||||||||||||
|
|
||||||||||||||||||
| let asset_amount = Some(50); | ||||||||||||||||||
| let LNInvoiceResponse { invoice } = | ||||||||||||||||||
|
|
@@ -85,10 +93,18 @@ async fn success() { | |||||||||||||||||
| assert_eq!(payment.asset_id, Some(asset_id.clone())); | ||||||||||||||||||
| assert_eq!(payment.asset_amount, asset_amount); | ||||||||||||||||||
| assert_eq!(payment.status, HTLCStatus::Succeeded); | ||||||||||||||||||
| assert!( | ||||||||||||||||||
| payment.preimage.is_some(), | ||||||||||||||||||
| "Payment preimage should be present for successful payment" | ||||||||||||||||||
| ); | ||||||||||||||||||
| let payment = get_payment(node2_addr, &decoded.payment_hash).await; | ||||||||||||||||||
| assert_eq!(payment.asset_id, Some(asset_id.clone())); | ||||||||||||||||||
| assert_eq!(payment.asset_amount, asset_amount); | ||||||||||||||||||
| assert_eq!(payment.status, HTLCStatus::Succeeded); | ||||||||||||||||||
| assert!( | ||||||||||||||||||
| payment.preimage.is_some(), | ||||||||||||||||||
| "Payment preimage should be present for successful payment" | ||||||||||||||||||
| ); | ||||||||||||||||||
|
|
||||||||||||||||||
| let LNInvoiceResponse { invoice } = | ||||||||||||||||||
| ln_invoice(node2_addr, None, Some(&asset_id), asset_amount, 900).await; | ||||||||||||||||||
|
|
@@ -99,10 +115,18 @@ async fn success() { | |||||||||||||||||
| assert_eq!(payment.asset_id, Some(asset_id.clone())); | ||||||||||||||||||
| assert_eq!(payment.asset_amount, asset_amount); | ||||||||||||||||||
| assert_eq!(payment.status, HTLCStatus::Succeeded); | ||||||||||||||||||
| assert!( | ||||||||||||||||||
| payment.preimage.is_some(), | ||||||||||||||||||
| "Payment preimage should be present for successful payment" | ||||||||||||||||||
| ); | ||||||||||||||||||
| let payment = get_payment(node2_addr, &decoded.payment_hash).await; | ||||||||||||||||||
| assert_eq!(payment.asset_id, Some(asset_id.clone())); | ||||||||||||||||||
| assert_eq!(payment.asset_amount, asset_amount); | ||||||||||||||||||
| assert_eq!(payment.status, HTLCStatus::Succeeded); | ||||||||||||||||||
| assert!( | ||||||||||||||||||
| payment.preimage.is_some(), | ||||||||||||||||||
| "Payment preimage should be present for successful payment" | ||||||||||||||||||
| ); | ||||||||||||||||||
|
|
||||||||||||||||||
| let LNInvoiceResponse { invoice } = | ||||||||||||||||||
| ln_invoice(node1_addr, None, Some(&asset_id), asset_amount, 900).await; | ||||||||||||||||||
|
|
@@ -113,10 +137,18 @@ async fn success() { | |||||||||||||||||
| assert_eq!(payment.asset_id, Some(asset_id.clone())); | ||||||||||||||||||
| assert_eq!(payment.asset_amount, asset_amount); | ||||||||||||||||||
| assert_eq!(payment.status, HTLCStatus::Succeeded); | ||||||||||||||||||
| assert!( | ||||||||||||||||||
| payment.preimage.is_some(), | ||||||||||||||||||
| "Payment preimage should be present for successful payment" | ||||||||||||||||||
| ); | ||||||||||||||||||
| let payment = get_payment(node2_addr, &decoded.payment_hash).await; | ||||||||||||||||||
| assert_eq!(payment.asset_id, Some(asset_id.clone())); | ||||||||||||||||||
| assert_eq!(payment.asset_amount, asset_amount); | ||||||||||||||||||
| assert_eq!(payment.status, HTLCStatus::Succeeded); | ||||||||||||||||||
| assert!( | ||||||||||||||||||
| payment.preimage.is_some(), | ||||||||||||||||||
| "Payment preimage should be present for successful payment" | ||||||||||||||||||
| ); | ||||||||||||||||||
|
|
||||||||||||||||||
| let channels_1 = list_channels(node1_addr).await; | ||||||||||||||||||
| let channels_2 = list_channels(node2_addr).await; | ||||||||||||||||||
|
|
||||||||||||||||||
Oops, something went wrong.
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.
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.