From: Matt Corallo Date: Mon, 1 Feb 2021 01:12:50 +0000 (-0500) Subject: Make ChannelMonitor always clonable X-Git-Url: http://git.bitcoin.ninja/?a=commitdiff_plain;h=5f526f820e2621607e993dcd5507904e549ba672;p=rust-lightning Make ChannelMonitor always clonable Rather than `ChannelMonitor` only being clonable when the signer is clonable, we require all signers to be clonable and then make all `ChannelMonitor`s clonable. --- diff --git a/lightning/src/chain/channelmonitor.rs b/lightning/src/chain/channelmonitor.rs index 693e1dda5..464ad5040 100644 --- a/lightning/src/chain/channelmonitor.rs +++ b/lightning/src/chain/channelmonitor.rs @@ -850,7 +850,7 @@ pub struct ChannelMonitor { pub(super) inner: Mutex>, } -impl Clone for ChannelMonitor where Signer: Clone { +impl Clone for ChannelMonitor { fn clone(&self) -> Self { let inner = self.inner.lock().unwrap().clone(); ChannelMonitor::from_impl(inner) diff --git a/lightning/src/sign/ecdsa.rs b/lightning/src/sign/ecdsa.rs index ecdd45aa3..c6df3344c 100644 --- a/lightning/src/sign/ecdsa.rs +++ b/lightning/src/sign/ecdsa.rs @@ -24,7 +24,7 @@ use crate::sign::{ChannelSigner, HTLCDescriptor}; /// policies in order to be secure. Please refer to the [VLS Policy /// Controls](https://gitlab.com/lightning-signer/validating-lightning-signer/-/blob/main/docs/policy-controls.md) /// for an example of such policies. -pub trait EcdsaChannelSigner: ChannelSigner { +pub trait EcdsaChannelSigner: ChannelSigner + Clone { /// Create a signature for a counterparty's commitment transaction and associated HTLC transactions. /// /// Note that if signing fails or is rejected, the channel will be force-closed. diff --git a/lightning/src/sign/mod.rs b/lightning/src/sign/mod.rs index 0d3ec9efa..c0fd5b73b 100644 --- a/lightning/src/sign/mod.rs +++ b/lightning/src/sign/mod.rs @@ -2500,11 +2500,11 @@ impl EntropySource for RandomBytes { } } -// Ensure that EcdsaChannelSigner can have a vtable -#[test] +// Ensure that EcdsaChannelSigner can have a vtable - not required in bindings +/*#[test] pub fn dyn_sign() { let _signer: Box; -} +}*/ #[cfg(ldk_bench)] pub mod benches {