Skip to content

Commit de480d0

Browse files
committed
Lean on Logger wrapping in ChannelMonitor rather than in channel
Now that `ChannelMonitor` is careful about wrapping `Logger`s at the edge, there's no need to use `WithChannelMonitor` in a few cases in `channel.rs` and one in `channelmanager.rs`.
1 parent 65e37fd commit de480d0

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

lightning/src/ln/channel.rs

+3-5
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ use crate::ln::chan_utils;
3535
use crate::ln::onion_utils::HTLCFailReason;
3636
use crate::chain::BestBlock;
3737
use crate::chain::chaininterface::{FeeEstimator, ConfirmationTarget, LowerBoundedFeeEstimator};
38-
use crate::chain::channelmonitor::{ChannelMonitor, ChannelMonitorUpdate, ChannelMonitorUpdateStep, WithChannelMonitor, LATENCY_GRACE_PERIOD_BLOCKS, CLOSED_CHANNEL_UPDATE_ID};
38+
use crate::chain::channelmonitor::{ChannelMonitor, ChannelMonitorUpdate, ChannelMonitorUpdateStep, LATENCY_GRACE_PERIOD_BLOCKS, CLOSED_CHANNEL_UPDATE_ID};
3939
use crate::chain::transaction::{OutPoint, TransactionData};
4040
use crate::sign::ecdsa::{EcdsaChannelSigner, WriteableEcdsaChannelSigner};
4141
use crate::sign::{EntropySource, ChannelSigner, SignerProvider, NodeSigner, Recipient};
@@ -2773,14 +2773,13 @@ impl<SP: Deref> Channel<SP> where
27732773
funding_redeemscript.clone(), self.context.channel_value_satoshis,
27742774
obscure_factor,
27752775
holder_commitment_tx, best_block, self.context.counterparty_node_id);
2776-
let logger_with_chan_monitor = WithChannelMonitor::from(logger, &channel_monitor);
27772776
channel_monitor.provide_initial_counterparty_commitment_tx(
27782777
counterparty_initial_bitcoin_tx.txid, Vec::new(),
27792778
self.context.cur_counterparty_commitment_transaction_number,
27802779
self.context.counterparty_cur_commitment_point.unwrap(),
27812780
counterparty_initial_commitment_tx.feerate_per_kw(),
27822781
counterparty_initial_commitment_tx.to_broadcaster_value_sat(),
2783-
counterparty_initial_commitment_tx.to_countersignatory_value_sat(), &&logger_with_chan_monitor);
2782+
counterparty_initial_commitment_tx.to_countersignatory_value_sat(), logger);
27842783

27852784
assert_eq!(self.context.channel_state & (ChannelState::MonitorUpdateInProgress as u32), 0); // We have no had any monitor(s) yet to fail update!
27862785
if self.context.is_batch_funding() {
@@ -6976,13 +6975,12 @@ impl<SP: Deref> InboundV1Channel<SP> where SP::Target: SignerProvider {
69766975
funding_redeemscript.clone(), self.context.channel_value_satoshis,
69776976
obscure_factor,
69786977
holder_commitment_tx, best_block, self.context.counterparty_node_id);
6979-
let logger_with_chan_monitor = WithChannelMonitor::from(logger, &channel_monitor);
69806978
channel_monitor.provide_initial_counterparty_commitment_tx(
69816979
counterparty_initial_commitment_tx.trust().txid(), Vec::new(),
69826980
self.context.cur_counterparty_commitment_transaction_number + 1,
69836981
self.context.counterparty_cur_commitment_point.unwrap(), self.context.feerate_per_kw,
69846982
counterparty_initial_commitment_tx.to_broadcaster_value_sat(),
6985-
counterparty_initial_commitment_tx.to_countersignatory_value_sat(), &&logger_with_chan_monitor);
6983+
counterparty_initial_commitment_tx.to_countersignatory_value_sat(), logger);
69866984

69876985
log_info!(logger, "{} funding_signed for peer for channel {}",
69886986
if funding_signed.is_some() { "Generated" } else { "Waiting for signature on" }, &self.context.channel_id());

lightning/src/ln/channelmanager.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -10711,8 +10711,7 @@ where
1071110711
}
1071210712
}
1071310713
if let Some(previous_hop_monitor) = args.channel_monitors.get(&claimable_htlc.prev_hop.outpoint) {
10714-
let logger = WithChannelMonitor::from(&args.logger, previous_hop_monitor);
10715-
previous_hop_monitor.provide_payment_preimage(&payment_hash, &payment_preimage, &args.tx_broadcaster, &bounded_fee_estimator, &&logger);
10714+
previous_hop_monitor.provide_payment_preimage(&payment_hash, &payment_preimage, &args.tx_broadcaster, &bounded_fee_estimator, &args.logger);
1071610715
}
1071710716
}
1071810717
pending_events_read.push_back((events::Event::PaymentClaimed {

0 commit comments

Comments
 (0)