mirror of
https://github.com/lightningdevkit/rust-lightning.git
synced 2025-02-25 07:17:40 +01:00
Implement Hash
for Offer
and Refund
This commit is contained in:
parent
3eeb8b82a5
commit
47954e95df
2 changed files with 14 additions and 0 deletions
|
@ -80,6 +80,7 @@ use bitcoin::blockdata::constants::ChainHash;
|
|||
use bitcoin::network::constants::Network;
|
||||
use bitcoin::secp256k1::{KeyPair, PublicKey, Secp256k1, self};
|
||||
use core::convert::TryFrom;
|
||||
use core::hash::{Hash, Hasher};
|
||||
use core::num::NonZeroU64;
|
||||
use core::ops::Deref;
|
||||
use core::str::FromStr;
|
||||
|
@ -591,6 +592,12 @@ impl PartialEq for Offer {
|
|||
|
||||
impl Eq for Offer {}
|
||||
|
||||
impl Hash for Offer {
|
||||
fn hash<H: Hasher>(&self, state: &mut H) {
|
||||
self.bytes.hash(state);
|
||||
}
|
||||
}
|
||||
|
||||
impl OfferContents {
|
||||
pub fn chains(&self) -> Vec<ChainHash> {
|
||||
self.chains.as_ref().cloned().unwrap_or_else(|| vec![self.implied_chain()])
|
||||
|
|
|
@ -85,6 +85,7 @@ use bitcoin::blockdata::constants::ChainHash;
|
|||
use bitcoin::network::constants::Network;
|
||||
use bitcoin::secp256k1::{PublicKey, Secp256k1, self};
|
||||
use core::convert::TryFrom;
|
||||
use core::hash::{Hash, Hasher};
|
||||
use core::ops::Deref;
|
||||
use core::str::FromStr;
|
||||
use core::time::Duration;
|
||||
|
@ -546,6 +547,12 @@ impl PartialEq for Refund {
|
|||
|
||||
impl Eq for Refund {}
|
||||
|
||||
impl Hash for Refund {
|
||||
fn hash<H: Hasher>(&self, state: &mut H) {
|
||||
self.bytes.hash(state);
|
||||
}
|
||||
}
|
||||
|
||||
impl RefundContents {
|
||||
pub fn description(&self) -> PrintableString {
|
||||
PrintableString(&self.description)
|
||||
|
|
Loading…
Add table
Reference in a new issue