Skip to content

Commit bf09abd

Browse files
committed
Use KeysInterface::read_chan_signer for all channel keys deser
This drops any direct calls to a generic `ChannelKeys::read()` and replaces it with the new `KeysInterface::read_chan_signer()`. Still, under the hood all of our own `KeysInterface::read_chan_signer()` implementations simply call out to a `Readable::read()` implemention.
1 parent 16ee7c6 commit bf09abd

File tree

10 files changed

+85
-50
lines changed

10 files changed

+85
-50
lines changed

fuzz/src/chanmon_consistency.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ use lightning::util::logger::Logger;
4545
use lightning::util::config::UserConfig;
4646
use lightning::util::events::{EventsProvider, MessageSendEventsProvider};
4747
use lightning::util::ser::{Readable, ReadableArgs, Writeable, Writer};
48+
use lightning::util::test_utils::OnlyReadsKeysInterface;
4849
use lightning::routing::router::{Route, RouteHop};
4950

5051

@@ -128,7 +129,7 @@ impl chain::Watch for TestChainMonitor {
128129
hash_map::Entry::Vacant(_) => panic!("Didn't have monitor on update call"),
129130
};
130131
let mut deserialized_monitor = <(BlockHash, channelmonitor::ChannelMonitor<EnforcingChannelKeys>)>::
131-
read(&mut Cursor::new(&map_entry.get().1)).unwrap().1;
132+
read(&mut Cursor::new(&map_entry.get().1), &OnlyReadsKeysInterface {}).unwrap().1;
132133
deserialized_monitor.update_monitor(&update, &&TestBroadcaster{}, &&FuzzEstimator{}, &self.logger).unwrap();
133134
let mut ser = VecWriter(Vec::new());
134135
deserialized_monitor.write(&mut ser).unwrap();
@@ -311,7 +312,7 @@ pub fn do_test<Out: test_logger::Output>(data: &[u8], out: Out) {
311312
let mut monitors = HashMap::new();
312313
let mut old_monitors = $old_monitors.latest_monitors.lock().unwrap();
313314
for (outpoint, (update_id, monitor_ser)) in old_monitors.drain() {
314-
monitors.insert(outpoint, <(BlockHash, ChannelMonitor<EnforcingChannelKeys>)>::read(&mut Cursor::new(&monitor_ser)).expect("Failed to read monitor").1);
315+
monitors.insert(outpoint, <(BlockHash, ChannelMonitor<EnforcingChannelKeys>)>::read(&mut Cursor::new(&monitor_ser), &OnlyReadsKeysInterface {}).expect("Failed to read monitor").1);
315316
chain_monitor.latest_monitors.lock().unwrap().insert(outpoint, (update_id, monitor_ser));
316317
}
317318
let mut monitor_refs = HashMap::new();

fuzz/src/chanmon_deser.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ use bitcoin::hash_types::BlockHash;
55

66
use lightning::chain::channelmonitor;
77
use lightning::util::enforcing_trait_impls::EnforcingChannelKeys;
8-
use lightning::util::ser::{Readable, Writer, Writeable};
8+
use lightning::util::ser::{ReadableArgs, Writer, Writeable};
9+
use lightning::util::test_utils::OnlyReadsKeysInterface;
910

1011
use utils::test_logger;
1112

@@ -24,10 +25,10 @@ impl Writer for VecWriter {
2425

2526
#[inline]
2627
pub fn do_test<Out: test_logger::Output>(data: &[u8], _out: Out) {
27-
if let Ok((latest_block_hash, monitor)) = <(BlockHash, channelmonitor::ChannelMonitor<EnforcingChannelKeys>)>::read(&mut Cursor::new(data)) {
28+
if let Ok((latest_block_hash, monitor)) = <(BlockHash, channelmonitor::ChannelMonitor<EnforcingChannelKeys>)>::read(&mut Cursor::new(data), &OnlyReadsKeysInterface {}) {
2829
let mut w = VecWriter(Vec::new());
2930
monitor.write(&mut w).unwrap();
30-
let deserialized_copy = <(BlockHash, channelmonitor::ChannelMonitor<EnforcingChannelKeys>)>::read(&mut Cursor::new(&w.0)).unwrap();
31+
let deserialized_copy = <(BlockHash, channelmonitor::ChannelMonitor<EnforcingChannelKeys>)>::read(&mut Cursor::new(&w.0), &OnlyReadsKeysInterface {}).unwrap();
3132
assert!(latest_block_hash == deserialized_copy.0);
3233
assert!(monitor == deserialized_copy.1);
3334
}

lightning-persister/src/lib.rs

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,15 @@ use lightning::chain::channelmonitor::{ChannelMonitor, ChannelMonitorUpdate, Cha
77
use lightning::chain::channelmonitor;
88
use lightning::chain::keysinterface::ChannelKeys;
99
use lightning::chain::transaction::OutPoint;
10-
use lightning::util::ser::{Writeable, Readable};
10+
use lightning::util::ser::Writeable;
1111
use std::fs;
1212
use std::io::Error;
1313
use std::path::{Path, PathBuf};
1414

1515
#[cfg(test)]
1616
use {
17+
lightning::chain::keysinterface::KeysInterface,
18+
lightning::util::ser::ReadableArgs,
1719
bitcoin::{BlockHash, Txid},
1820
bitcoin::hashes::hex::FromHex,
1921
std::collections::HashMap,
@@ -94,8 +96,8 @@ impl FilesystemPersister {
9496
}
9597

9698
#[cfg(test)]
97-
fn load_channel_data<ChanSigner: ChannelKeys + Readable>(&self) ->
98-
Result<HashMap<OutPoint, ChannelMonitor<ChanSigner>>, ChannelMonitorUpdateErr> {
99+
fn load_channel_data<Keys: KeysInterface>(&self, keys: &Keys) ->
100+
Result<HashMap<OutPoint, ChannelMonitor<Keys::ChanKeySigner>>, ChannelMonitorUpdateErr> {
99101
if let Err(_) = fs::create_dir_all(&self.path_to_channel_data) {
100102
return Err(ChannelMonitorUpdateErr::PermanentFailure);
101103
}
@@ -118,7 +120,7 @@ impl FilesystemPersister {
118120
if contents.is_err() { return Err(ChannelMonitorUpdateErr::PermanentFailure); }
119121

120122
if let Ok((_, loaded_monitor)) =
121-
<(BlockHash, ChannelMonitor<ChanSigner>)>::read(&mut Cursor::new(&contents.unwrap())) {
123+
<(BlockHash, ChannelMonitor<Keys::ChanKeySigner>)>::read(&mut Cursor::new(&contents.unwrap()), keys) {
122124
res.insert(OutPoint { txid: txid.unwrap(), index: index.unwrap() }, loaded_monitor);
123125
} else {
124126
return Err(ChannelMonitorUpdateErr::PermanentFailure);
@@ -128,7 +130,7 @@ impl FilesystemPersister {
128130
}
129131
}
130132

131-
impl<ChanSigner: ChannelKeys + Readable + Send + Sync> channelmonitor::Persist<ChanSigner> for FilesystemPersister {
133+
impl<ChanSigner: ChannelKeys + Send + Sync> channelmonitor::Persist<ChanSigner> for FilesystemPersister {
132134
fn persist_new_channel(&self, funding_txo: OutPoint, monitor: &ChannelMonitor<ChanSigner>) -> Result<(), ChannelMonitorUpdateErr> {
133135
self.write_channel_data(funding_txo, monitor)
134136
.map_err(|_| ChannelMonitorUpdateErr::PermanentFailure)
@@ -168,7 +170,6 @@ mod tests {
168170
use lightning::ln::features::InitFeatures;
169171
use lightning::ln::functional_test_utils::*;
170172
use lightning::ln::msgs::ErrorAction;
171-
use lightning::util::enforcing_trait_impls::EnforcingChannelKeys;
172173
use lightning::util::events::{MessageSendEventsProvider, MessageSendEvent};
173174
use lightning::util::ser::Writer;
174175
use lightning::util::test_utils;
@@ -206,20 +207,20 @@ mod tests {
206207

207208
// Check that the persisted channel data is empty before any channels are
208209
// open.
209-
let mut persisted_chan_data_0 = persister_0.load_channel_data::<EnforcingChannelKeys>().unwrap();
210+
let mut persisted_chan_data_0 = persister_0.load_channel_data(nodes[0].keys_manager).unwrap();
210211
assert_eq!(persisted_chan_data_0.keys().len(), 0);
211-
let mut persisted_chan_data_1 = persister_1.load_channel_data::<EnforcingChannelKeys>().unwrap();
212+
let mut persisted_chan_data_1 = persister_1.load_channel_data(nodes[1].keys_manager).unwrap();
212213
assert_eq!(persisted_chan_data_1.keys().len(), 0);
213214

214215
// Helper to make sure the channel is on the expected update ID.
215216
macro_rules! check_persisted_data {
216217
($expected_update_id: expr) => {
217-
persisted_chan_data_0 = persister_0.load_channel_data::<EnforcingChannelKeys>().unwrap();
218+
persisted_chan_data_0 = persister_0.load_channel_data(nodes[0].keys_manager).unwrap();
218219
assert_eq!(persisted_chan_data_0.keys().len(), 1);
219220
for mon in persisted_chan_data_0.values() {
220221
assert_eq!(mon.get_latest_update_id(), $expected_update_id);
221222
}
222-
persisted_chan_data_1 = persister_1.load_channel_data::<EnforcingChannelKeys>().unwrap();
223+
persisted_chan_data_1 = persister_1.load_channel_data(nodes[1].keys_manager).unwrap();
223224
assert_eq!(persisted_chan_data_1.keys().len(), 1);
224225
for mon in persisted_chan_data_1.values() {
225226
assert_eq!(mon.get_latest_update_id(), $expected_update_id);

lightning/src/chain/channelmonitor.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@ use ln::channelmanager::{HTLCSource, PaymentPreimage, PaymentHash};
4444
use ln::onchaintx::{OnchainTxHandler, InputDescriptors};
4545
use chain::chaininterface::{BroadcasterInterface, FeeEstimator};
4646
use chain::transaction::{OutPoint, TransactionData};
47-
use chain::keysinterface::{SpendableOutputDescriptor, ChannelKeys};
47+
use chain::keysinterface::{SpendableOutputDescriptor, ChannelKeys, KeysInterface};
4848
use util::logger::Logger;
49-
use util::ser::{Readable, MaybeReadable, Writer, Writeable, U48};
49+
use util::ser::{Readable, ReadableArgs, MaybeReadable, Writer, Writeable, U48};
5050
use util::byte_utils;
5151
use util::events::Event;
5252

@@ -2289,8 +2289,9 @@ pub trait Persist<Keys: ChannelKeys>: Send + Sync {
22892289

22902290
const MAX_ALLOC_SIZE: usize = 64*1024;
22912291

2292-
impl<ChanSigner: ChannelKeys + Readable> Readable for (BlockHash, ChannelMonitor<ChanSigner>) {
2293-
fn read<R: ::std::io::Read>(reader: &mut R) -> Result<Self, DecodeError> {
2292+
impl<'a, ChanSigner: ChannelKeys, K: KeysInterface<ChanKeySigner = ChanSigner>> ReadableArgs<&'a K>
2293+
for (BlockHash, ChannelMonitor<ChanSigner>) {
2294+
fn read<R: ::std::io::Read>(reader: &mut R, keys_manager: &'a K) -> Result<Self, DecodeError> {
22942295
macro_rules! unwrap_obj {
22952296
($key: expr) => {
22962297
match $key {
@@ -2524,7 +2525,7 @@ impl<ChanSigner: ChannelKeys + Readable> Readable for (BlockHash, ChannelMonitor
25242525
return Err(DecodeError::InvalidValue);
25252526
}
25262527
}
2527-
let onchain_tx_handler = Readable::read(reader)?;
2528+
let onchain_tx_handler = ReadableArgs::read(reader, keys_manager)?;
25282529

25292530
let lockdown_from_offchain = Readable::read(reader)?;
25302531
let holder_tx_signed = Readable::read(reader)?;

lightning/src/ln/chanmon_update_fail_tests.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ use routing::router::get_route;
2626
use util::enforcing_trait_impls::EnforcingChannelKeys;
2727
use util::events::{Event, EventsProvider, MessageSendEvent, MessageSendEventsProvider};
2828
use util::errors::APIError;
29-
use util::ser::{Readable, Writeable};
29+
use util::ser::{ReadableArgs, Writeable};
3030

3131
use bitcoin::hashes::sha256::Hash as Sha256;
3232
use bitcoin::hashes::Hash;
@@ -107,7 +107,7 @@ fn test_monitor_and_persister_update_fail() {
107107
let mut w = test_utils::TestVecWriter(Vec::new());
108108
monitor.write(&mut w).unwrap();
109109
let new_monitor = <(BlockHash, ChannelMonitor<EnforcingChannelKeys>)>::read(
110-
&mut ::std::io::Cursor::new(&w.0)).unwrap().1;
110+
&mut ::std::io::Cursor::new(&w.0), &test_utils::OnlyReadsKeysInterface {}).unwrap().1;
111111
assert!(new_monitor == *monitor);
112112
let chain_mon = test_utils::TestChainMonitor::new(Some(&chain_source), &chanmon_cfgs[0].tx_broadcaster, &logger, &chanmon_cfgs[0].fee_estimator, &persister);
113113
assert!(chain_mon.watch_channel(outpoint, new_monitor).is_ok());

lightning/src/ln/channel.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4559,7 +4559,7 @@ mod tests {
45594559
self.chan_keys.clone()
45604560
}
45614561
fn get_secure_random_bytes(&self) -> [u8; 32] { [0; 32] }
4562-
fn read_chan_signer(&self, data: &[u8]) -> Result<Self::ChanKeySigner, DecodeError> { panic!(); }
4562+
fn read_chan_signer(&self, _data: &[u8]) -> Result<Self::ChanKeySigner, DecodeError> { panic!(); }
45634563
}
45644564

45654565
fn public_from_secret_hex(secp_ctx: &Secp256k1<All>, hex: &str) -> PublicKey {

lightning/src/ln/functional_test_utils.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ use ln::msgs;
2121
use ln::msgs::{ChannelMessageHandler,RoutingMessageHandler};
2222
use util::enforcing_trait_impls::EnforcingChannelKeys;
2323
use util::test_utils;
24-
use util::test_utils::TestChainMonitor;
24+
use util::test_utils::{TestChainMonitor, OnlyReadsKeysInterface};
2525
use util::events::{Event, EventsProvider, MessageSendEvent, MessageSendEventsProvider};
2626
use util::errors::APIError;
2727
use util::config::UserConfig;
@@ -172,7 +172,7 @@ impl<'a, 'b, 'c> Drop for Node<'a, 'b, 'c> {
172172
let mut w = test_utils::TestVecWriter(Vec::new());
173173
old_monitor.write(&mut w).unwrap();
174174
let (_, deserialized_monitor) = <(BlockHash, ChannelMonitor<EnforcingChannelKeys>)>::read(
175-
&mut ::std::io::Cursor::new(&w.0)).unwrap();
175+
&mut ::std::io::Cursor::new(&w.0), &OnlyReadsKeysInterface {}).unwrap();
176176
deserialized_monitors.push(deserialized_monitor);
177177
}
178178
}

lightning/src/ln/functional_tests.rs

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ use util::enforcing_trait_impls::EnforcingChannelKeys;
2828
use util::{byte_utils, test_utils};
2929
use util::events::{Event, EventsProvider, MessageSendEvent, MessageSendEventsProvider};
3030
use util::errors::APIError;
31-
use util::ser::{Writeable, ReadableArgs, Readable};
31+
use util::ser::{Writeable, ReadableArgs};
3232
use util::config::UserConfig;
3333

3434
use bitcoin::hashes::sha256d::Hash as Sha256dHash;
@@ -4326,13 +4326,14 @@ fn test_no_txn_manager_serialize_deserialize() {
43264326
persister = test_utils::TestPersister::new();
43274327
new_chain_monitor = test_utils::TestChainMonitor::new(Some(nodes[0].chain_source), nodes[0].tx_broadcaster.clone(), &logger, &fee_estimator, &persister);
43284328
nodes[0].chain_monitor = &new_chain_monitor;
4329+
keys_manager = test_utils::TestKeysInterface::new(&nodes[0].node_seed, Network::Testnet);
43294330
let mut chan_0_monitor_read = &chan_0_monitor_serialized.0[..];
4330-
let (_, mut chan_0_monitor) = <(BlockHash, ChannelMonitor<EnforcingChannelKeys>)>::read(&mut chan_0_monitor_read).unwrap();
4331+
let (_, mut chan_0_monitor) = <(BlockHash, ChannelMonitor<EnforcingChannelKeys>)>::read(
4332+
&mut chan_0_monitor_read, &keys_manager).unwrap();
43314333
assert!(chan_0_monitor_read.is_empty());
43324334

43334335
let mut nodes_0_read = &nodes_0_serialized[..];
43344336
let config = UserConfig::default();
4335-
keys_manager = test_utils::TestKeysInterface::new(&nodes[0].node_seed, Network::Testnet);
43364337
let (_, nodes_0_deserialized_tmp) = {
43374338
let mut channel_monitors = HashMap::new();
43384339
channel_monitors.insert(chan_0_monitor.get_funding_txo().0, &mut chan_0_monitor);
@@ -4434,14 +4435,15 @@ fn test_manager_serialize_deserialize_events() {
44344435
logger = test_utils::TestLogger::new();
44354436
persister = test_utils::TestPersister::new();
44364437
new_chain_monitor = test_utils::TestChainMonitor::new(Some(nodes[0].chain_source), nodes[0].tx_broadcaster.clone(), &logger, &fee_estimator, &persister);
4438+
keys_manager = test_utils::TestKeysInterface::new(&nodes[0].node_seed, Network::Testnet);
44374439
nodes[0].chain_monitor = &new_chain_monitor;
44384440
let mut chan_0_monitor_read = &chan_0_monitor_serialized.0[..];
4439-
let (_, mut chan_0_monitor) = <(BlockHash, ChannelMonitor<EnforcingChannelKeys>)>::read(&mut chan_0_monitor_read).unwrap();
4441+
let (_, mut chan_0_monitor) = <(BlockHash, ChannelMonitor<EnforcingChannelKeys>)>::read(
4442+
&mut chan_0_monitor_read, &keys_manager).unwrap();
44404443
assert!(chan_0_monitor_read.is_empty());
44414444

44424445
let mut nodes_0_read = &nodes_0_serialized[..];
44434446
let config = UserConfig::default();
4444-
keys_manager = test_utils::TestKeysInterface::new(&nodes[0].node_seed, Network::Testnet);
44454447
let (_, nodes_0_deserialized_tmp) = {
44464448
let mut channel_monitors = HashMap::new();
44474449
channel_monitors.insert(chan_0_monitor.get_funding_txo().0, &mut chan_0_monitor);
@@ -4526,13 +4528,14 @@ fn test_simple_manager_serialize_deserialize() {
45264528
fee_estimator = test_utils::TestFeeEstimator { sat_per_kw: 253 };
45274529
persister = test_utils::TestPersister::new();
45284530
new_chain_monitor = test_utils::TestChainMonitor::new(Some(nodes[0].chain_source), nodes[0].tx_broadcaster.clone(), &logger, &fee_estimator, &persister);
4531+
keys_manager = test_utils::TestKeysInterface::new(&nodes[0].node_seed, Network::Testnet);
45294532
nodes[0].chain_monitor = &new_chain_monitor;
45304533
let mut chan_0_monitor_read = &chan_0_monitor_serialized.0[..];
4531-
let (_, mut chan_0_monitor) = <(BlockHash, ChannelMonitor<EnforcingChannelKeys>)>::read(&mut chan_0_monitor_read).unwrap();
4534+
let (_, mut chan_0_monitor) = <(BlockHash, ChannelMonitor<EnforcingChannelKeys>)>::read(
4535+
&mut chan_0_monitor_read, &keys_manager).unwrap();
45324536
assert!(chan_0_monitor_read.is_empty());
45334537

45344538
let mut nodes_0_read = &nodes_0_serialized[..];
4535-
keys_manager = test_utils::TestKeysInterface::new(&nodes[0].node_seed, Network::Testnet);
45364539
let (_, nodes_0_deserialized_tmp) = {
45374540
let mut channel_monitors = HashMap::new();
45384541
channel_monitors.insert(chan_0_monitor.get_funding_txo().0, &mut chan_0_monitor);
@@ -4608,24 +4611,24 @@ fn test_manager_serialize_deserialize_inconsistent_monitor() {
46084611
new_chain_monitor = test_utils::TestChainMonitor::new(Some(nodes[0].chain_source), nodes[0].tx_broadcaster.clone(), &logger, &fee_estimator, &persister);
46094612
nodes[0].chain_monitor = &new_chain_monitor;
46104613

4614+
keys_manager = test_utils::TestKeysInterface::new(&nodes[0].node_seed, Network::Testnet);
4615+
46114616
let mut node_0_stale_monitors = Vec::new();
46124617
for serialized in node_0_stale_monitors_serialized.iter() {
46134618
let mut read = &serialized[..];
4614-
let (_, monitor) = <(BlockHash, ChannelMonitor<EnforcingChannelKeys>)>::read(&mut read).unwrap();
4619+
let (_, monitor) = <(BlockHash, ChannelMonitor<EnforcingChannelKeys>)>::read(&mut read, &keys_manager).unwrap();
46154620
assert!(read.is_empty());
46164621
node_0_stale_monitors.push(monitor);
46174622
}
46184623

46194624
let mut node_0_monitors = Vec::new();
46204625
for serialized in node_0_monitors_serialized.iter() {
46214626
let mut read = &serialized[..];
4622-
let (_, monitor) = <(BlockHash, ChannelMonitor<EnforcingChannelKeys>)>::read(&mut read).unwrap();
4627+
let (_, monitor) = <(BlockHash, ChannelMonitor<EnforcingChannelKeys>)>::read(&mut read, &keys_manager).unwrap();
46234628
assert!(read.is_empty());
46244629
node_0_monitors.push(monitor);
46254630
}
46264631

4627-
keys_manager = test_utils::TestKeysInterface::new(&nodes[0].node_seed, Network::Testnet);
4628-
46294632
let mut nodes_0_read = &nodes_0_serialized[..];
46304633
if let Err(msgs::DecodeError::InvalidValue) =
46314634
<(BlockHash, ChannelManager<EnforcingChannelKeys, &test_utils::TestChainMonitor, &test_utils::TestBroadcaster, &test_utils::TestKeysInterface, &test_utils::TestFeeEstimator, &test_utils::TestLogger>)>::read(&mut nodes_0_read, ChannelManagerReadArgs {
@@ -7442,11 +7445,11 @@ fn test_data_loss_protect() {
74427445

74437446
// Restore node A from previous state
74447447
logger = test_utils::TestLogger::with_id(format!("node {}", 0));
7445-
let mut chain_monitor = <(BlockHash, ChannelMonitor<EnforcingChannelKeys>)>::read(&mut ::std::io::Cursor::new(previous_chain_monitor_state.0)).unwrap().1;
7448+
keys_manager = test_utils::TestKeysInterface::new(&nodes[0].node_seed, Network::Testnet);
7449+
let mut chain_monitor = <(BlockHash, ChannelMonitor<EnforcingChannelKeys>)>::read(&mut ::std::io::Cursor::new(previous_chain_monitor_state.0), &keys_manager).unwrap().1;
74467450
chain_source = test_utils::TestChainSource::new(Network::Testnet);
74477451
tx_broadcaster = test_utils::TestBroadcaster{txn_broadcasted: Mutex::new(Vec::new())};
74487452
fee_estimator = test_utils::TestFeeEstimator { sat_per_kw: 253 };
7449-
keys_manager = test_utils::TestKeysInterface::new(&nodes[0].node_seed, Network::Testnet);
74507453
persister = test_utils::TestPersister::new();
74517454
monitor = test_utils::TestChainMonitor::new(Some(&chain_source), &tx_broadcaster, &logger, &fee_estimator, &persister);
74527455
node_state_0 = {
@@ -8316,7 +8319,7 @@ fn test_update_err_monitor_lockdown() {
83168319
let mut w = test_utils::TestVecWriter(Vec::new());
83178320
monitor.write(&mut w).unwrap();
83188321
let new_monitor = <(BlockHash, channelmonitor::ChannelMonitor<EnforcingChannelKeys>)>::read(
8319-
&mut ::std::io::Cursor::new(&w.0)).unwrap().1;
8322+
&mut ::std::io::Cursor::new(&w.0), &test_utils::OnlyReadsKeysInterface {}).unwrap().1;
83208323
assert!(new_monitor == *monitor);
83218324
let watchtower = test_utils::TestChainMonitor::new(Some(&chain_source), &chanmon_cfgs[0].tx_broadcaster, &logger, &chanmon_cfgs[0].fee_estimator, &persister);
83228325
assert!(watchtower.watch_channel(outpoint, new_monitor).is_ok());
@@ -8375,7 +8378,7 @@ fn test_concurrent_monitor_claim() {
83758378
let mut w = test_utils::TestVecWriter(Vec::new());
83768379
monitor.write(&mut w).unwrap();
83778380
let new_monitor = <(BlockHash, channelmonitor::ChannelMonitor<EnforcingChannelKeys>)>::read(
8378-
&mut ::std::io::Cursor::new(&w.0)).unwrap().1;
8381+
&mut ::std::io::Cursor::new(&w.0), &test_utils::OnlyReadsKeysInterface {}).unwrap().1;
83798382
assert!(new_monitor == *monitor);
83808383
let watchtower = test_utils::TestChainMonitor::new(Some(&chain_source), &chanmon_cfgs[0].tx_broadcaster, &logger, &chanmon_cfgs[0].fee_estimator, &persister);
83818384
assert!(watchtower.watch_channel(outpoint, new_monitor).is_ok());
@@ -8401,7 +8404,7 @@ fn test_concurrent_monitor_claim() {
84018404
let mut w = test_utils::TestVecWriter(Vec::new());
84028405
monitor.write(&mut w).unwrap();
84038406
let new_monitor = <(BlockHash, channelmonitor::ChannelMonitor<EnforcingChannelKeys>)>::read(
8404-
&mut ::std::io::Cursor::new(&w.0)).unwrap().1;
8407+
&mut ::std::io::Cursor::new(&w.0), &test_utils::OnlyReadsKeysInterface {}).unwrap().1;
84058408
assert!(new_monitor == *monitor);
84068409
let watchtower = test_utils::TestChainMonitor::new(Some(&chain_source), &chanmon_cfgs[0].tx_broadcaster, &logger, &chanmon_cfgs[0].fee_estimator, &persister);
84078410
assert!(watchtower.watch_channel(outpoint, new_monitor).is_ok());

0 commit comments

Comments
 (0)