Skip to content

Commit a041b81

Browse files
committed
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.
1 parent 00ecea1 commit a041b81

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

lightning-persister/src/lib.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ extern crate libc;
2020
use bitcoin::hash_types::{BlockHash, Txid};
2121
use bitcoin::hashes::hex::FromHex;
2222
use lightning::chain::channelmonitor::ChannelMonitor;
23-
use lightning::chain::keysinterface::{EntropySource, SignerProvider};
23+
use lightning::chain::keysinterface::{EntropySource, SignerProvider, WriteableEcdsaChannelSigner};
2424
use lightning::util::ser::{ReadableArgs, Writeable};
2525
use lightning::util::persist::KVStorePersister;
2626
use std::fs;
@@ -59,12 +59,11 @@ impl FilesystemPersister {
5959
}
6060

6161
/// Read `ChannelMonitor`s from disk.
62-
pub fn read_channelmonitors<ES: Deref, SP: Deref> (
63-
&self, entropy_source: ES, signer_provider: SP
64-
) -> std::io::Result<Vec<(BlockHash, ChannelMonitor<<SP::Target as SignerProvider>::Signer>)>>
62+
pub fn read_channelmonitors<ES: Deref, WES: WriteableEcdsaChannelSigner, SP: SignerProvider<Signer = WES> + Sized, SPD: Deref<Target=SP>> (
63+
&self, entropy_source: ES, signer_provider: SPD
64+
) -> Result<Vec<(BlockHash, ChannelMonitor<WES>)>, std::io::Error>
6565
where
6666
ES::Target: EntropySource + Sized,
67-
SP::Target: SignerProvider + Sized
6867
{
6968
let mut path = PathBuf::from(&self.path_to_channel_data);
7069
path.push("monitors");
@@ -105,7 +104,7 @@ impl FilesystemPersister {
105104

106105
let contents = fs::read(&file.path())?;
107106
let mut buffer = Cursor::new(&contents);
108-
match <(BlockHash, ChannelMonitor<<SP::Target as SignerProvider>::Signer>)>::read(&mut buffer, (&*entropy_source, &*signer_provider)) {
107+
match <(BlockHash, ChannelMonitor<WES>)>::read(&mut buffer, (&*entropy_source, &*signer_provider)) {
109108
Ok((blockhash, channel_monitor)) => {
110109
if channel_monitor.get_funding_txo().0.txid != txid || channel_monitor.get_funding_txo().0.index != index {
111110
return Err(std::io::Error::new(std::io::ErrorKind::InvalidData,

lightning/src/chain/channelmonitor.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3772,8 +3772,8 @@ where
37723772

37733773
const MAX_ALLOC_SIZE: usize = 64*1024;
37743774

3775-
impl<'a, 'b, ES: EntropySource, SP: SignerProvider> ReadableArgs<(&'a ES, &'b SP)>
3776-
for (BlockHash, ChannelMonitor<SP::Signer>) {
3775+
impl<'a, 'b, ES: EntropySource, SP: SignerProvider<Signer=Signer>, Signer: WriteableEcdsaChannelSigner> ReadableArgs<(&'a ES, &'b SP)>
3776+
for (BlockHash, ChannelMonitor<Signer>) {
37773777
fn read<R: io::Read>(reader: &mut R, args: (&'a ES, &'b SP)) -> Result<Self, DecodeError> {
37783778
macro_rules! unwrap_obj {
37793779
($key: expr) => {

0 commit comments

Comments
 (0)