pub struct PaymentHash(/* private fields */);Expand description
A 32-byte payment hash.
The payment hash is the SHA256 hash of the preimage and is used to identify payments in the Lightning Network.
Implementations§
Source§impl PaymentHash
impl PaymentHash
Sourcepub fn from_bytes(bytes: [u8; 32]) -> Self
pub fn from_bytes(bytes: [u8; 32]) -> Self
Create a new payment hash from bytes.
Sourcepub fn from_hex(hex: &str) -> Result<Self, LightningError>
pub fn from_hex(hex: &str) -> Result<Self, LightningError>
Create a new payment hash from a hex string.
Sourcepub fn verify(&self, preimage: &PaymentPreimage) -> bool
pub fn verify(&self, preimage: &PaymentPreimage) -> bool
Verify that a preimage matches this payment hash.
Trait Implementations§
Source§impl Clone for PaymentHash
impl Clone for PaymentHash
Source§fn clone(&self) -> PaymentHash
fn clone(&self) -> PaymentHash
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for PaymentHash
impl Debug for PaymentHash
Source§impl Display for PaymentHash
impl Display for PaymentHash
Source§impl Hash for PaymentHash
impl Hash for PaymentHash
Source§impl PartialEq for PaymentHash
impl PartialEq for PaymentHash
impl Copy for PaymentHash
impl Eq for PaymentHash
impl StructuralPartialEq for PaymentHash
Auto Trait Implementations§
impl Freeze for PaymentHash
impl RefUnwindSafe for PaymentHash
impl Send for PaymentHash
impl Sync for PaymentHash
impl Unpin for PaymentHash
impl UnwindSafe for PaymentHash
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more