Skip to content

Conversation

lukegao209
Copy link
Contributor

No description provided.

Copy link
Member

@zoedberg zoedberg left a 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"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
example: "1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef"
example: 89d28bd306aa9bb906fd0ac31092d04c37c919a171b343083167e2a3cdc60578

example: 03b79a4bc1ec365524b4fab9a39eb133753646babb5a1da5c4bc94c53110b7795d
preimage:
type: string
description: Optional custom payment preimage (hex string, 32 bytes)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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"
);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants