From: Matt Corallo Date: Sat, 24 Dec 2022 04:16:48 +0000 (+0000) Subject: Use an explicit `Sign` type on the `ChannelMonitor` read tuple X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=commitdiff_plain;h=b1024b1b9308a88fe1174c53692900ebb2cd6d15;p=rust-lightning Use an explicit `Sign` type on the `ChannelMonitor` read tuple The bindings currently get confused by the implicit `Sign` type, so we temporarily remove it on the `impl` here. --- diff --git a/lightning-persister/src/lib.rs b/lightning-persister/src/lib.rs index aaa3ef73d..2a9f0dc7a 100644 --- a/lightning-persister/src/lib.rs +++ b/lightning-persister/src/lib.rs @@ -20,7 +20,7 @@ extern crate libc; use bitcoin::hash_types::{BlockHash, Txid}; use bitcoin::hashes::hex::FromHex; use lightning::chain::channelmonitor::ChannelMonitor; -use lightning::chain::keysinterface::{EntropySource, SignerProvider}; +use lightning::chain::keysinterface::{EntropySource, SignerProvider, WriteableEcdsaChannelSigner}; use lightning::util::ser::{ReadableArgs, Writeable}; use lightning::util::persist::KVStorePersister; use std::fs; @@ -59,12 +59,11 @@ impl FilesystemPersister { } /// Read `ChannelMonitor`s from disk. - pub fn read_channelmonitors ( - &self, entropy_source: ES, signer_provider: SP - ) -> std::io::Result::Signer>)>> + pub fn read_channelmonitors + Sized, SPD: Deref> ( + &self, entropy_source: ES, signer_provider: SPD + ) -> Result)>, std::io::Error> where ES::Target: EntropySource + Sized, - SP::Target: SignerProvider + Sized { let mut path = PathBuf::from(&self.path_to_channel_data); path.push("monitors"); @@ -105,7 +104,7 @@ impl FilesystemPersister { let contents = fs::read(&file.path())?; let mut buffer = Cursor::new(&contents); - match <(BlockHash, ChannelMonitor<::Signer>)>::read(&mut buffer, (&*entropy_source, &*signer_provider)) { + match <(BlockHash, ChannelMonitor)>::read(&mut buffer, (&*entropy_source, &*signer_provider)) { Ok((blockhash, channel_monitor)) => { if channel_monitor.get_funding_txo().0.txid != txid || channel_monitor.get_funding_txo().0.index != index { return Err(std::io::Error::new(std::io::ErrorKind::InvalidData, diff --git a/lightning/src/chain/channelmonitor.rs b/lightning/src/chain/channelmonitor.rs index cd18ffad1..401221acd 100644 --- a/lightning/src/chain/channelmonitor.rs +++ b/lightning/src/chain/channelmonitor.rs @@ -3693,8 +3693,8 @@ where const MAX_ALLOC_SIZE: usize = 64*1024; -impl<'a, 'b, ES: EntropySource, SP: SignerProvider> ReadableArgs<(&'a ES, &'b SP)> - for (BlockHash, ChannelMonitor) { +impl<'a, 'b, ES: EntropySource, SP: SignerProvider, Signer: WriteableEcdsaChannelSigner> ReadableArgs<(&'a ES, &'b SP)> + for (BlockHash, ChannelMonitor) { fn read(reader: &mut R, args: (&'a ES, &'b SP)) -> Result { macro_rules! unwrap_obj { ($key: expr) => {