From 8a42d555086a89274fa90f1e667a17eea62555ab Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Tue, 26 Sep 2023 20:41:49 +0000 Subject: [PATCH] Derive `Hash` for `SpendableOutputDescriptor` This allows for easy descriptor de-duplication before building a claiming transaction. --- lightning/src/sign/mod.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lightning/src/sign/mod.rs b/lightning/src/sign/mod.rs index f25c94764..5b42796a9 100644 --- a/lightning/src/sign/mod.rs +++ b/lightning/src/sign/mod.rs @@ -68,7 +68,7 @@ pub struct KeyMaterial(pub [u8; 32]); /// Information about a spendable output to a P2WSH script. /// /// See [`SpendableOutputDescriptor::DelayedPaymentOutput`] for more details on how to spend this. -#[derive(Clone, Debug, PartialEq, Eq)] +#[derive(Clone, Debug, Hash, PartialEq, Eq)] pub struct DelayedPaymentOutputDescriptor { /// The outpoint which is spendable. pub outpoint: OutPoint, @@ -110,7 +110,7 @@ impl_writeable_tlv_based!(DelayedPaymentOutputDescriptor, { /// Information about a spendable output to our "payment key". /// /// See [`SpendableOutputDescriptor::StaticPaymentOutput`] for more details on how to spend this. -#[derive(Clone, Debug, PartialEq, Eq)] +#[derive(Clone, Debug, Hash, PartialEq, Eq)] pub struct StaticPaymentOutputDescriptor { /// The outpoint which is spendable. pub outpoint: OutPoint, @@ -146,7 +146,7 @@ impl_writeable_tlv_based!(StaticPaymentOutputDescriptor, { /// at that `txid`/`index`, and any keys or other information required to sign. /// /// [`SpendableOutputs`]: crate::events::Event::SpendableOutputs -#[derive(Clone, Debug, PartialEq, Eq)] +#[derive(Clone, Debug, Hash, PartialEq, Eq)] pub enum SpendableOutputDescriptor { /// An output to a script which was provided via [`SignerProvider`] directly, either from /// [`get_destination_script`] or [`get_shutdown_scriptpubkey`], thus you should already -- 2.39.5