Skip to content

Commit b8d15f6

Browse files
ChannelManager+Router++ Logger Arc --> Deref
This caused a bunch of cascading changes, including passing loggers down to Channels in function calls rather than having each Channel have a pointer to the ChannelManager's Logger (which was a circular reference). Other structs that the Channel had passed its Logger to also had their loggers removed. Other newly unused Loggers were also removed, especially when keeping them would've caused a bunch of extra test changes to be necessary, e.g. with the ChainWatchInterfaceUtil's Logger.
1 parent 59fe300 commit b8d15f6

20 files changed

+692
-688
lines changed

fuzz/src/chanmon_consistency.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ use bitcoin::hash_types::{BlockHash, WPubkeyHash};
2222

2323
use lightning::chain::chaininterface;
2424
use lightning::chain::transaction::OutPoint;
25-
use lightning::chain::chaininterface::{BroadcasterInterface,ConfirmationTarget,ChainListener,FeeEstimator,ChainWatchInterfaceUtil};
25+
use lightning::chain::chaininterface::{BroadcasterInterface,ConfirmationTarget,ChainListener,FeeEstimator,ChainWatchInterfaceUtil,ChainWatchInterface};
2626
use lightning::chain::keysinterface::{KeysInterface, InMemoryChannelKeys};
2727
use lightning::ln::channelmonitor;
2828
use lightning::ln::channelmonitor::{ChannelMonitor, ChannelMonitorUpdateErr, HTLCUpdate};
@@ -75,7 +75,7 @@ impl Writer for VecWriter {
7575

7676
struct TestChannelMonitor {
7777
pub logger: Arc<dyn Logger>,
78-
pub simple_monitor: Arc<channelmonitor::SimpleManyChannelMonitor<OutPoint, EnforcingChannelKeys, Arc<TestBroadcaster>, Arc<FuzzEstimator>>>,
78+
pub simple_monitor: Arc<channelmonitor::SimpleManyChannelMonitor<OutPoint, EnforcingChannelKeys, Arc<TestBroadcaster>, Arc<FuzzEstimator>, Arc<dyn Logger>, Arc<dyn ChainWatchInterface>>>,
7979
pub update_ret: Mutex<Result<(), channelmonitor::ChannelMonitorUpdateErr>>,
8080
// If we reload a node with an old copy of ChannelMonitors, the ChannelManager deserialization
8181
// logic will automatically force-close our channels for us (as we don't have an up-to-date
@@ -115,8 +115,8 @@ impl channelmonitor::ManyChannelMonitor<EnforcingChannelKeys> for TestChannelMon
115115
hash_map::Entry::Vacant(_) => panic!("Didn't have monitor on update call"),
116116
};
117117
let mut deserialized_monitor = <(BlockHash, channelmonitor::ChannelMonitor<EnforcingChannelKeys>)>::
118-
read(&mut Cursor::new(&map_entry.get().1), Arc::clone(&self.logger)).unwrap().1;
119-
deserialized_monitor.update_monitor(update.clone(), &&TestBroadcaster {}).unwrap();
118+
read(&mut Cursor::new(&map_entry.get().1)).unwrap().1;
119+
deserialized_monitor.update_monitor(update.clone(), &&TestBroadcaster {}, &self.logger).unwrap();
120120
let mut ser = VecWriter(Vec::new());
121121
deserialized_monitor.write_for_disk(&mut ser).unwrap();
122122
map_entry.insert((update.update_id, ser.0));
@@ -187,7 +187,7 @@ pub fn do_test<Out: test_logger::Output>(data: &[u8], out: Out) {
187187
macro_rules! make_node {
188188
($node_id: expr) => { {
189189
let logger: Arc<dyn Logger> = Arc::new(test_logger::TestLogger::new($node_id.to_string(), out.clone()));
190-
let watch = Arc::new(ChainWatchInterfaceUtil::new(Network::Bitcoin, Arc::clone(&logger)));
190+
let watch = Arc::new(ChainWatchInterfaceUtil::new(Network::Bitcoin));
191191
let monitor = Arc::new(TestChannelMonitor::new(watch.clone(), broadcast.clone(), logger.clone(), fee_est.clone()));
192192

193193
let keys_manager = Arc::new(KeyProvider { node_id: $node_id, session_id: atomic::AtomicU8::new(0), channel_id: atomic::AtomicU8::new(0) });
@@ -203,7 +203,7 @@ pub fn do_test<Out: test_logger::Output>(data: &[u8], out: Out) {
203203
macro_rules! reload_node {
204204
($ser: expr, $node_id: expr, $old_monitors: expr) => { {
205205
let logger: Arc<dyn Logger> = Arc::new(test_logger::TestLogger::new($node_id.to_string(), out.clone()));
206-
let watch = Arc::new(ChainWatchInterfaceUtil::new(Network::Bitcoin, Arc::clone(&logger)));
206+
let watch = Arc::new(ChainWatchInterfaceUtil::new(Network::Bitcoin));
207207
let monitor = Arc::new(TestChannelMonitor::new(watch.clone(), broadcast.clone(), logger.clone(), fee_est.clone()));
208208

209209
let keys_manager = Arc::new(KeyProvider { node_id: $node_id, session_id: atomic::AtomicU8::new(0), channel_id: atomic::AtomicU8::new(0) });
@@ -215,7 +215,7 @@ pub fn do_test<Out: test_logger::Output>(data: &[u8], out: Out) {
215215
let mut monitors = HashMap::new();
216216
let mut old_monitors = $old_monitors.latest_monitors.lock().unwrap();
217217
for (outpoint, (update_id, monitor_ser)) in old_monitors.drain() {
218-
monitors.insert(outpoint, <(BlockHash, ChannelMonitor<EnforcingChannelKeys>)>::read(&mut Cursor::new(&monitor_ser), Arc::clone(&logger)).expect("Failed to read monitor").1);
218+
monitors.insert(outpoint, <(BlockHash, ChannelMonitor<EnforcingChannelKeys>)>::read(&mut Cursor::new(&monitor_ser)).expect("Failed to read monitor").1);
219219
monitor.latest_monitors.lock().unwrap().insert(outpoint, (update_id, monitor_ser));
220220
}
221221
let mut monitor_refs = HashMap::new();
@@ -233,7 +233,7 @@ pub fn do_test<Out: test_logger::Output>(data: &[u8], out: Out) {
233233
channel_monitors: &mut monitor_refs,
234234
};
235235

236-
(<(BlockHash, ChannelManager<EnforcingChannelKeys, Arc<TestChannelMonitor>, Arc<TestBroadcaster>, Arc<KeyProvider>, Arc<FuzzEstimator>>)>::read(&mut Cursor::new(&$ser.0), read_args).expect("Failed to read manager").1, monitor)
236+
(<(BlockHash, ChannelManager<EnforcingChannelKeys, Arc<TestChannelMonitor>, Arc<TestBroadcaster>, Arc<KeyProvider>, Arc<FuzzEstimator>, Arc<dyn Logger>>)>::read(&mut Cursor::new(&$ser.0), read_args).expect("Failed to read manager").1, monitor)
237237
} }
238238
}
239239

fuzz/src/chanmon_deser.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,11 @@ use bitcoin::hash_types::BlockHash;
55

66
use lightning::util::enforcing_trait_impls::EnforcingChannelKeys;
77
use lightning::ln::channelmonitor;
8-
use lightning::util::ser::{ReadableArgs, Writer};
8+
use lightning::util::ser::{Readable, Writer};
99

1010
use utils::test_logger;
1111

1212
use std::io::Cursor;
13-
use std::sync::Arc;
1413

1514
struct VecWriter(Vec<u8>);
1615
impl Writer for VecWriter {
@@ -24,12 +23,11 @@ impl Writer for VecWriter {
2423
}
2524

2625
#[inline]
27-
pub fn do_test<Out: test_logger::Output>(data: &[u8], out: Out) {
28-
let logger = Arc::new(test_logger::TestLogger::new("".to_owned(), out));
29-
if let Ok((latest_block_hash, monitor)) = <(BlockHash, channelmonitor::ChannelMonitor<EnforcingChannelKeys>)>::read(&mut Cursor::new(data), logger.clone()) {
26+
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)) {
3028
let mut w = VecWriter(Vec::new());
3129
monitor.write_for_disk(&mut w).unwrap();
32-
let deserialized_copy = <(BlockHash, channelmonitor::ChannelMonitor<EnforcingChannelKeys>)>::read(&mut Cursor::new(&w.0), logger.clone()).unwrap();
30+
let deserialized_copy = <(BlockHash, channelmonitor::ChannelMonitor<EnforcingChannelKeys>)>::read(&mut Cursor::new(&w.0)).unwrap();
3331
assert!(latest_block_hash == deserialized_copy.0);
3432
assert!(monitor == deserialized_copy.1);
3533
}

fuzz/src/full_stack.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -135,9 +135,9 @@ impl<'a> std::hash::Hash for Peer<'a> {
135135
}
136136

137137
struct MoneyLossDetector<'a> {
138-
manager: Arc<ChannelManager<EnforcingChannelKeys, Arc<channelmonitor::SimpleManyChannelMonitor<OutPoint, EnforcingChannelKeys, Arc<TestBroadcaster>, Arc<FuzzEstimator>>>, Arc<TestBroadcaster>, Arc<KeyProvider>, Arc<FuzzEstimator>>>,
139-
monitor: Arc<channelmonitor::SimpleManyChannelMonitor<OutPoint, EnforcingChannelKeys, Arc<TestBroadcaster>, Arc<FuzzEstimator>>>,
140-
handler: PeerManager<Peer<'a>, Arc<ChannelManager<EnforcingChannelKeys, Arc<channelmonitor::SimpleManyChannelMonitor<OutPoint, EnforcingChannelKeys, Arc<TestBroadcaster>, Arc<FuzzEstimator>>>, Arc<TestBroadcaster>, Arc<KeyProvider>, Arc<FuzzEstimator>>>>,
138+
manager: Arc<ChannelManager<EnforcingChannelKeys, Arc<channelmonitor::SimpleManyChannelMonitor<OutPoint, EnforcingChannelKeys, Arc<TestBroadcaster>, Arc<FuzzEstimator>, Arc<dyn Logger>, Arc<ChainWatchInterfaceUtil>>>, Arc<TestBroadcaster>, Arc<KeyProvider>, Arc<FuzzEstimator>, Arc<dyn Logger>>>,
139+
monitor: Arc<channelmonitor::SimpleManyChannelMonitor<OutPoint, EnforcingChannelKeys, Arc<TestBroadcaster>, Arc<FuzzEstimator>, Arc<dyn Logger>, Arc<ChainWatchInterfaceUtil>>>,
140+
handler: PeerManager<Peer<'a>, Arc<ChannelManager<EnforcingChannelKeys, Arc<channelmonitor::SimpleManyChannelMonitor<OutPoint, EnforcingChannelKeys, Arc<TestBroadcaster>, Arc<FuzzEstimator>, Arc<dyn Logger>, Arc<ChainWatchInterfaceUtil>>>, Arc<TestBroadcaster>, Arc<KeyProvider>, Arc<FuzzEstimator>, Arc<dyn Logger>>>>,
141141

142142
peers: &'a RefCell<[bool; 256]>,
143143
funding_txn: Vec<Transaction>,
@@ -149,9 +149,9 @@ struct MoneyLossDetector<'a> {
149149
}
150150
impl<'a> MoneyLossDetector<'a> {
151151
pub fn new(peers: &'a RefCell<[bool; 256]>,
152-
manager: Arc<ChannelManager<EnforcingChannelKeys, Arc<channelmonitor::SimpleManyChannelMonitor<OutPoint, EnforcingChannelKeys, Arc<TestBroadcaster>, Arc<FuzzEstimator>>>, Arc<TestBroadcaster>, Arc<KeyProvider>, Arc<FuzzEstimator>>>,
153-
monitor: Arc<channelmonitor::SimpleManyChannelMonitor<OutPoint, EnforcingChannelKeys, Arc<TestBroadcaster>, Arc<FuzzEstimator>>>,
154-
handler: PeerManager<Peer<'a>, Arc<ChannelManager<EnforcingChannelKeys, Arc<channelmonitor::SimpleManyChannelMonitor<OutPoint, EnforcingChannelKeys, Arc<TestBroadcaster>, Arc<FuzzEstimator>>>, Arc<TestBroadcaster>, Arc<KeyProvider>, Arc<FuzzEstimator>>>>) -> Self {
152+
manager: Arc<ChannelManager<EnforcingChannelKeys, Arc<channelmonitor::SimpleManyChannelMonitor<OutPoint, EnforcingChannelKeys, Arc<TestBroadcaster>, Arc<FuzzEstimator>, Arc<dyn Logger>, Arc<ChainWatchInterfaceUtil>>>, Arc<TestBroadcaster>, Arc<KeyProvider>, Arc<FuzzEstimator>, Arc<dyn Logger>>>,
153+
monitor: Arc<channelmonitor::SimpleManyChannelMonitor<OutPoint, EnforcingChannelKeys, Arc<TestBroadcaster>, Arc<FuzzEstimator>, Arc<dyn Logger>, Arc<ChainWatchInterfaceUtil>>>,
154+
handler: PeerManager<Peer<'a>, Arc<ChannelManager<EnforcingChannelKeys, Arc<channelmonitor::SimpleManyChannelMonitor<OutPoint, EnforcingChannelKeys, Arc<TestBroadcaster>, Arc<FuzzEstimator>, Arc<dyn Logger>, Arc<ChainWatchInterfaceUtil>>>, Arc<TestBroadcaster>, Arc<KeyProvider>, Arc<FuzzEstimator>, Arc<dyn Logger>>>>) -> Self {
155155
MoneyLossDetector {
156156
manager,
157157
monitor,
@@ -323,7 +323,7 @@ pub fn do_test(data: &[u8], logger: &Arc<dyn Logger>) {
323323
Err(_) => return,
324324
};
325325

326-
let watch = Arc::new(ChainWatchInterfaceUtil::new(Network::Bitcoin, Arc::clone(&logger)));
326+
let watch = Arc::new(ChainWatchInterfaceUtil::new(Network::Bitcoin));
327327
let broadcast = Arc::new(TestBroadcaster{});
328328
let monitor = Arc::new(channelmonitor::SimpleManyChannelMonitor::new(watch.clone(), broadcast.clone(), Arc::clone(&logger), fee_est.clone()));
329329

lightning-net-tokio/src/lib.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,11 @@
2424
//! // Define concrete types for our high-level objects:
2525
//! type TxBroadcaster = dyn lightning::chain::chaininterface::BroadcasterInterface;
2626
//! type FeeEstimator = dyn lightning::chain::chaininterface::FeeEstimator;
27-
//! type ChannelMonitor = lightning::ln::channelmonitor::SimpleManyChannelMonitor<lightning::chain::transaction::OutPoint, lightning::chain::keysinterface::InMemoryChannelKeys, Arc<TxBroadcaster>, Arc<FeeEstimator>>;
28-
//! type ChannelManager = lightning::ln::channelmanager::SimpleArcChannelManager<ChannelMonitor, TxBroadcaster, FeeEstimator>;
29-
//! type PeerManager = lightning::ln::peer_handler::SimpleArcPeerManager<lightning_net_tokio::SocketDescriptor, ChannelMonitor, TxBroadcaster, FeeEstimator>;
27+
//! type Logger = dyn lightning::util::logger::Logger;
28+
//! type ChainWatchInterface = dyn lightning::chain::chaininterface::ChainWatchInterface;
29+
//! type ChannelMonitor = lightning::ln::channelmonitor::SimpleManyChannelMonitor<lightning::chain::transaction::OutPoint, lightning::chain::keysinterface::InMemoryChannelKeys, Arc<TxBroadcaster>, Arc<FeeEstimator>, Arc<Logger>, Arc<ChainWatchInterface>>;
30+
//! type ChannelManager = lightning::ln::channelmanager::SimpleArcChannelManager<ChannelMonitor, TxBroadcaster, FeeEstimator, Logger>;
31+
//! type PeerManager = lightning::ln::peer_handler::SimpleArcPeerManager<lightning_net_tokio::SocketDescriptor, ChannelMonitor, TxBroadcaster, FeeEstimator, Logger>;
3032
//!
3133
//! // Connect to node with pubkey their_node_id at addr:
3234
//! async fn connect_to_node(peer_manager: PeerManager, channel_monitor: Arc<ChannelMonitor>, channel_manager: ChannelManager, their_node_id: PublicKey, addr: SocketAddr) {

lightning/src/chain/chaininterface.rs

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@ use bitcoin::util::hash::BitcoinHash;
1212
use bitcoin::network::constants::Network;
1313
use bitcoin::hash_types::{Txid, BlockHash};
1414

15-
use util::logger::Logger;
16-
1715
use std::sync::{Mutex, MutexGuard, Arc};
1816
use std::sync::atomic::{AtomicUsize, Ordering};
1917
use std::collections::HashSet;
@@ -220,7 +218,7 @@ impl ChainWatchedUtil {
220218
/// parameters with static lifetimes). Other times you can afford a reference, which is more
221219
/// efficient, in which case BlockNotifierRef is a more appropriate type. Defining these type
222220
/// aliases prevents issues such as overly long function definitions.
223-
pub type BlockNotifierArc = Arc<BlockNotifier<'static, Arc<ChainListener>>>;
221+
pub type BlockNotifierArc<C> = Arc<BlockNotifier<'static, Arc<ChainListener>, C>>;
224222

225223
/// BlockNotifierRef is useful when you want a BlockNotifier that points to ChainListeners
226224
/// with nonstatic lifetimes. This is useful for when static lifetimes are not needed. Nonstatic
@@ -229,7 +227,7 @@ pub type BlockNotifierArc = Arc<BlockNotifier<'static, Arc<ChainListener>>>;
229227
/// requires parameters with static lifetimes), in which case BlockNotifierArc is a more
230228
/// appropriate type. Defining these type aliases for common usages prevents issues such as
231229
/// overly long function definitions.
232-
pub type BlockNotifierRef<'a> = BlockNotifier<'a, &'a ChainListener>;
230+
pub type BlockNotifierRef<'a, C> = BlockNotifier<'a, &'a ChainListener, C>;
233231

234232
/// Utility for notifying listeners about new blocks, and handling block rescans if new watch
235233
/// data is registered.
@@ -238,15 +236,15 @@ pub type BlockNotifierRef<'a> = BlockNotifier<'a, &'a ChainListener>;
238236
/// or a BlockNotifierRef for conciseness. See their documentation for more details, but essentially
239237
/// you should default to using a BlockNotifierRef, and use a BlockNotifierArc instead when you
240238
/// require ChainListeners with static lifetimes, such as when you're using lightning-net-tokio.
241-
pub struct BlockNotifier<'a, CL: Deref<Target = ChainListener + 'a> + 'a> {
239+
pub struct BlockNotifier<'a, CL: Deref<Target = ChainListener + 'a> + 'a, C: Deref> where C::Target: ChainWatchInterface {
242240
listeners: Mutex<Vec<CL>>,
243-
chain_monitor: Arc<ChainWatchInterface>,
241+
chain_monitor: C,
244242
phantom: PhantomData<&'a ()>,
245243
}
246244

247-
impl<'a, CL: Deref<Target = ChainListener + 'a> + 'a> BlockNotifier<'a, CL> {
245+
impl<'a, CL: Deref<Target = ChainListener + 'a> + 'a, C: Deref> BlockNotifier<'a, CL, C> where C::Target: ChainWatchInterface {
248246
/// Constructs a new BlockNotifier without any listeners.
249-
pub fn new(chain_monitor: Arc<ChainWatchInterface>) -> BlockNotifier<'a, CL> {
247+
pub fn new(chain_monitor: C) -> BlockNotifier<'a, CL, C> {
250248
BlockNotifier {
251249
listeners: Mutex::new(Vec::new()),
252250
chain_monitor,
@@ -316,7 +314,6 @@ pub struct ChainWatchInterfaceUtil {
316314
network: Network,
317315
watched: Mutex<ChainWatchedUtil>,
318316
reentered: AtomicUsize,
319-
logger: Arc<Logger>,
320317
}
321318

322319
// We only expose PartialEq in test since its somewhat unclear exactly what it should do and we're
@@ -382,12 +379,11 @@ impl ChainWatchInterface for ChainWatchInterfaceUtil {
382379

383380
impl ChainWatchInterfaceUtil {
384381
/// Creates a new ChainWatchInterfaceUtil for the given network
385-
pub fn new(network: Network, logger: Arc<Logger>) -> ChainWatchInterfaceUtil {
382+
pub fn new(network: Network) -> ChainWatchInterfaceUtil {
386383
ChainWatchInterfaceUtil {
387-
network: network,
384+
network,
388385
watched: Mutex::new(ChainWatchedUtil::new()),
389386
reentered: AtomicUsize::new(1),
390-
logger: logger,
391387
}
392388
}
393389

@@ -412,7 +408,7 @@ mod tests {
412408
fn register_listener_test() {
413409
let chanmon_cfgs = create_chanmon_cfgs(1);
414410
let node_cfgs = create_node_cfgs(1, &chanmon_cfgs);
415-
let block_notifier = BlockNotifier::new(node_cfgs[0].chain_monitor.clone());
411+
let block_notifier = BlockNotifier::new(node_cfgs[0].chain_monitor);
416412
assert_eq!(block_notifier.listeners.lock().unwrap().len(), 0);
417413
let listener = &node_cfgs[0].chan_monitor.simple_monitor as &ChainListener;
418414
block_notifier.register_listener(listener);
@@ -426,7 +422,7 @@ mod tests {
426422
fn unregister_single_listener_test() {
427423
let chanmon_cfgs = create_chanmon_cfgs(2);
428424
let node_cfgs = create_node_cfgs(2, &chanmon_cfgs);
429-
let block_notifier = BlockNotifier::new(node_cfgs[0].chain_monitor.clone());
425+
let block_notifier = BlockNotifier::new(node_cfgs[0].chain_monitor);
430426
let listener1 = &node_cfgs[0].chan_monitor.simple_monitor as &ChainListener;
431427
let listener2 = &node_cfgs[1].chan_monitor.simple_monitor as &ChainListener;
432428
block_notifier.register_listener(listener1);
@@ -445,7 +441,7 @@ mod tests {
445441
fn unregister_single_listener_ref_test() {
446442
let chanmon_cfgs = create_chanmon_cfgs(2);
447443
let node_cfgs = create_node_cfgs(2, &chanmon_cfgs);
448-
let block_notifier = BlockNotifier::new(node_cfgs[0].chain_monitor.clone());
444+
let block_notifier = BlockNotifier::new(node_cfgs[0].chain_monitor);
449445
block_notifier.register_listener(&node_cfgs[0].chan_monitor.simple_monitor as &ChainListener);
450446
block_notifier.register_listener(&node_cfgs[1].chan_monitor.simple_monitor as &ChainListener);
451447
let vec = block_notifier.listeners.lock().unwrap();
@@ -462,7 +458,7 @@ mod tests {
462458
fn unregister_multiple_of_the_same_listeners_test() {
463459
let chanmon_cfgs = create_chanmon_cfgs(2);
464460
let node_cfgs = create_node_cfgs(2, &chanmon_cfgs);
465-
let block_notifier = BlockNotifier::new(node_cfgs[0].chain_monitor.clone());
461+
let block_notifier = BlockNotifier::new(node_cfgs[0].chain_monitor);
466462
let listener1 = &node_cfgs[0].chan_monitor.simple_monitor as &ChainListener;
467463
let listener2 = &node_cfgs[1].chan_monitor.simple_monitor as &ChainListener;
468464
block_notifier.register_listener(listener1);

lightning/src/chain/keysinterface.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,12 @@ use bitcoin::secp256k1::{Secp256k1, Signature, Signing};
2020
use bitcoin::secp256k1;
2121

2222
use util::byte_utils;
23-
use util::logger::Logger;
2423
use util::ser::{Writeable, Writer, Readable};
2524

2625
use ln::chan_utils;
2726
use ln::chan_utils::{TxCreationKeys, HTLCOutputInCommitment, make_funding_redeemscript, ChannelPublicKeys, LocalCommitmentTransaction};
2827
use ln::msgs;
2928

30-
use std::sync::Arc;
3129
use std::sync::atomic::{AtomicUsize, Ordering};
3230
use std::io::Error;
3331
use ln::msgs::DecodeError;
@@ -486,7 +484,6 @@ pub struct KeysManager {
486484
channel_id_child_index: AtomicUsize,
487485

488486
unique_start: Sha256State,
489-
logger: Arc<Logger>,
490487
}
491488

492489
impl KeysManager {
@@ -509,7 +506,7 @@ impl KeysManager {
509506
/// Note that until the 0.1 release there is no guarantee of backward compatibility between
510507
/// versions. Once the library is more fully supported, the docs will be updated to include a
511508
/// detailed description of the guarantee.
512-
pub fn new(seed: &[u8; 32], network: Network, logger: Arc<Logger>, starting_time_secs: u64, starting_time_nanos: u32) -> KeysManager {
509+
pub fn new(seed: &[u8; 32], network: Network, starting_time_secs: u64, starting_time_nanos: u32) -> KeysManager {
513510
let secp_ctx = Secp256k1::signing_only();
514511
match ExtendedPrivKey::new_master(network.clone(), seed) {
515512
Ok(master_key) => {
@@ -549,7 +546,6 @@ impl KeysManager {
549546
channel_id_child_index: AtomicUsize::new(0),
550547

551548
unique_start,
552-
logger,
553549
}
554550
},
555551
Err(_) => panic!("Your rng is busted"),

0 commit comments

Comments
 (0)