Skip to content

Commit 2843d9f

Browse files
committed
f get_channel_id -> channel_id
1 parent 0bb8c5e commit 2843d9f

File tree

7 files changed

+23
-23
lines changed

7 files changed

+23
-23
lines changed

lightning-persister/src/fs_store.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -450,7 +450,7 @@ mod tests {
450450
check_closed_event!(nodes[1], 1, ClosureReason::HolderForceClosed, [nodes[0].node.get_our_node_id()], 100000);
451451
let mut added_monitors = nodes[1].chain_monitor.added_monitors.lock().unwrap();
452452
let update_map = nodes[1].chain_monitor.latest_monitor_update_id.lock().unwrap();
453-
let update_id = update_map.get(&added_monitors[0].1.get_channel_id()).unwrap();
453+
let update_id = update_map.get(&added_monitors[0].1.channel_id()).unwrap();
454454

455455
// Set the store's directory to read-only, which should result in
456456
// returning an unrecoverable failure when we then attempt to persist a
@@ -489,7 +489,7 @@ mod tests {
489489
check_closed_event!(nodes[1], 1, ClosureReason::HolderForceClosed, [nodes[0].node.get_our_node_id()], 100000);
490490
let mut added_monitors = nodes[1].chain_monitor.added_monitors.lock().unwrap();
491491
let update_map = nodes[1].chain_monitor.latest_monitor_update_id.lock().unwrap();
492-
let update_id = update_map.get(&added_monitors[0].1.get_channel_id()).unwrap();
492+
let update_id = update_map.get(&added_monitors[0].1.channel_id()).unwrap();
493493

494494
// Create the store with an invalid directory name and test that the
495495
// channel fails to open because the directories fail to be created. There

lightning/src/chain/chainmonitor.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -478,7 +478,7 @@ where C::Target: chain::Filter,
478478
/// monitoring for on-chain state resolutions.
479479
pub fn list_monitors(&self) -> Vec<(OutPoint, ChannelId)> {
480480
self.monitors.read().unwrap().iter().map(|(outpoint, monitor_holder)| {
481-
let channel_id = monitor_holder.monitor.get_channel_id();
481+
let channel_id = monitor_holder.monitor.channel_id();
482482
(*outpoint, channel_id)
483483
}).collect()
484484
}
@@ -546,7 +546,7 @@ where C::Target: chain::Filter,
546546
// Completed event.
547547
return Ok(());
548548
}
549-
let channel_id = monitor_data.monitor.get_channel_id();
549+
let channel_id = monitor_data.monitor.channel_id();
550550
self.pending_monitor_events.lock().unwrap().push((funding_txo, channel_id, vec![MonitorEvent::Completed {
551551
funding_txo, channel_id,
552552
monitor_update_id: monitor_data.monitor.get_latest_update_id(),
@@ -571,7 +571,7 @@ where C::Target: chain::Filter,
571571
pub fn force_channel_monitor_updated(&self, funding_txo: OutPoint, monitor_update_id: u64) {
572572
let monitors = self.monitors.read().unwrap();
573573
let (counterparty_node_id, channel_id) = if let Some(m) = monitors.get(&funding_txo) {
574-
(m.monitor.get_counterparty_node_id(), m.monitor.get_channel_id())
574+
(m.monitor.get_counterparty_node_id(), m.monitor.channel_id())
575575
} else {
576576
(None, ChannelId::v1_from_funding_outpoint(funding_txo))
577577
};
@@ -839,7 +839,7 @@ where C::Target: chain::Filter,
839839
let monitor_events = monitor_state.monitor.get_and_clear_pending_monitor_events();
840840
if monitor_events.len() > 0 {
841841
let monitor_outpoint = monitor_state.monitor.get_funding_txo().0;
842-
let monitor_channel_id = monitor_state.monitor.get_channel_id();
842+
let monitor_channel_id = monitor_state.monitor.channel_id();
843843
let counterparty_node_id = monitor_state.monitor.get_counterparty_node_id();
844844
pending_monitor_events.push((monitor_outpoint, monitor_channel_id, monitor_events, counterparty_node_id));
845845
}

lightning/src/chain/channelmonitor.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1165,7 +1165,7 @@ impl<'a, L: Deref> WithChannelMonitor<'a, L> where L::Target: Logger {
11651165

11661166
pub(crate) fn from_impl<S: WriteableEcdsaChannelSigner>(logger: &'a L, monitor_impl: &ChannelMonitorImpl<S>) -> Self {
11671167
let peer_id = monitor_impl.counterparty_node_id;
1168-
let channel_id = Some(monitor_impl.get_channel_id());
1168+
let channel_id = Some(monitor_impl.channel_id());
11691169
WithChannelMonitor {
11701170
logger, peer_id, channel_id,
11711171
}
@@ -1394,8 +1394,8 @@ impl<Signer: WriteableEcdsaChannelSigner> ChannelMonitor<Signer> {
13941394
}
13951395

13961396
/// Gets the channel_id of the channel this ChannelMonitor is monitoring for.
1397-
pub fn get_channel_id(&self) -> ChannelId {
1398-
self.inner.lock().unwrap().get_channel_id()
1397+
pub fn channel_id(&self) -> ChannelId {
1398+
self.inner.lock().unwrap().channel_id()
13991399
}
14001400

14011401
/// Gets a list of txids, with their output scripts (in the order they appear in the
@@ -2846,7 +2846,7 @@ impl<Signer: WriteableEcdsaChannelSigner> ChannelMonitorImpl<Signer> {
28462846
self.queue_latest_holder_commitment_txn_for_broadcast(broadcaster, &bounded_fee_estimator, logger);
28472847
} else if !self.holder_tx_signed {
28482848
log_error!(logger, "WARNING: You have a potentially-unsafe holder commitment transaction available to broadcast");
2849-
log_error!(logger, " in channel monitor for channel {}!", &self.get_channel_id());
2849+
log_error!(logger, " in channel monitor for channel {}!", &self.channel_id());
28502850
log_error!(logger, " Read the docs for ChannelMonitor::get_latest_holder_commitment_txn and take manual action!");
28512851
} else {
28522852
// If we generated a MonitorEvent::HolderForceClosed, the ChannelManager
@@ -2892,7 +2892,7 @@ impl<Signer: WriteableEcdsaChannelSigner> ChannelMonitorImpl<Signer> {
28922892
&self.funding_info
28932893
}
28942894

2895-
pub fn get_channel_id(&self) -> ChannelId {
2895+
pub fn channel_id(&self) -> ChannelId {
28962896
self.channel_id
28972897
}
28982898

@@ -3658,7 +3658,7 @@ impl<Signer: WriteableEcdsaChannelSigner> ChannelMonitorImpl<Signer> {
36583658
if prevout.txid == self.funding_info.0.txid && prevout.vout == self.funding_info.0.index as u32 {
36593659
let mut balance_spendable_csv = None;
36603660
log_info!(logger, "Channel {} closed by funding output spend in txid {}.",
3661-
&self.get_channel_id(), txid);
3661+
&self.channel_id(), txid);
36623662
self.funding_spend_seen = true;
36633663
let mut commitment_tx_to_counterparty_output = None;
36643664
if (tx.input[0].sequence.0 >> 8*3) as u8 == 0x80 && (tx.lock_time.to_consensus_u32() >> 8*3) as u8 == 0x20 {
@@ -3828,7 +3828,7 @@ impl<Signer: WriteableEcdsaChannelSigner> ChannelMonitorImpl<Signer> {
38283828
log_debug!(logger, "Descriptor {} has got enough confirmations to be passed upstream", log_spendable!(descriptor));
38293829
self.pending_events.push(Event::SpendableOutputs {
38303830
outputs: vec![descriptor],
3831-
channel_id: Some(self.get_channel_id()),
3831+
channel_id: Some(self.channel_id()),
38323832
});
38333833
self.spendable_txids_confirmed.push(entry.txid);
38343834
},
@@ -5130,7 +5130,7 @@ mod tests {
51305130
&channel_parameters, ScriptBuf::new(), 46, 0, HolderCommitmentTransaction::dummy(&mut Vec::new()),
51315131
best_block, dummy_key, channel_id);
51325132

5133-
let chan_id = monitor.inner.lock().unwrap().get_channel_id();
5133+
let chan_id = monitor.inner.lock().unwrap().channel_id();
51345134
let context_logger = WithChannelMonitor::from(&logger, &monitor);
51355135
log_error!(context_logger, "This is an error");
51365136
log_warn!(context_logger, "This is an error");

lightning/src/ln/channelmanager.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10452,7 +10452,7 @@ where
1045210452
for (funding_txo, monitor) in args.channel_monitors.iter() {
1045310453
if !funding_txo_set.contains(funding_txo) {
1045410454
let logger = WithChannelMonitor::from(&args.logger, monitor);
10455-
let channel_id = monitor.get_channel_id();
10455+
let channel_id = monitor.channel_id();
1045610456
log_info!(logger, "Queueing monitor update to ensure missing channel {} is force closed",
1045710457
&channel_id);
1045810458
let monitor_update = ChannelMonitorUpdate {
@@ -10811,7 +10811,7 @@ where
1081110811
if let HTLCForwardInfo::AddHTLC(htlc_info) = forward {
1081210812
if pending_forward_matches_htlc(&htlc_info) {
1081310813
log_info!(logger, "Removing pending to-forward HTLC with hash {} as it was forwarded to the closed channel {}",
10814-
&htlc.payment_hash, &monitor.get_channel_id());
10814+
&htlc.payment_hash, &monitor.channel_id());
1081510815
false
1081610816
} else { true }
1081710817
} else { true }
@@ -10821,7 +10821,7 @@ where
1082110821
pending_intercepted_htlcs.as_mut().unwrap().retain(|intercepted_id, htlc_info| {
1082210822
if pending_forward_matches_htlc(&htlc_info) {
1082310823
log_info!(logger, "Removing pending intercepted HTLC with hash {} as it was forwarded to the closed channel {}",
10824-
&htlc.payment_hash, &monitor.get_channel_id());
10824+
&htlc.payment_hash, &monitor.channel_id());
1082510825
pending_events_read.retain(|(event, _)| {
1082610826
if let Event::HTLCIntercepted { intercept_id: ev_id, .. } = event {
1082710827
intercepted_id != ev_id
@@ -10845,7 +10845,7 @@ where
1084510845
let compl_action =
1084610846
EventCompletionAction::ReleaseRAAChannelMonitorUpdate {
1084710847
channel_funding_outpoint: monitor.get_funding_txo().0,
10848-
channel_id: monitor.get_channel_id(),
10848+
channel_id: monitor.channel_id(),
1084910849
counterparty_node_id: path.hops[0].pubkey,
1085010850
};
1085110851
pending_outbounds.claim_htlc(payment_id, preimage, session_priv,
@@ -10871,7 +10871,7 @@ where
1087110871
// channel_id -> peer map entry).
1087210872
counterparty_opt.is_none(),
1087310873
counterparty_opt.cloned().or(monitor.get_counterparty_node_id()),
10874-
monitor.get_funding_txo().0, monitor.get_channel_id()))
10874+
monitor.get_funding_txo().0, monitor.channel_id()))
1087510875
} else { None }
1087610876
} else {
1087710877
// If it was an outbound payment, we've handled it above - if a preimage

lightning/src/util/macro_logger.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ impl<'a> core::fmt::Display for DebugFundingInfo<'a> {
5555
macro_rules! log_funding_info {
5656
($key_storage: expr) => {
5757
$crate::util::macro_logger::DebugFundingInfo(
58-
&$key_storage.get_channel_id()
58+
&$key_storage.channel_id()
5959
)
6060
}
6161
}

lightning/src/util/persist.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1052,9 +1052,9 @@ mod tests {
10521052
{
10531053
let mut added_monitors = nodes[1].chain_monitor.added_monitors.lock().unwrap();
10541054
let update_map = nodes[1].chain_monitor.latest_monitor_update_id.lock().unwrap();
1055-
let update_id = update_map.get(&added_monitors[0].1.get_channel_id()).unwrap();
1055+
let update_id = update_map.get(&added_monitors[0].1.channel_id()).unwrap();
10561056
let cmu_map = nodes[1].chain_monitor.monitor_updates.lock().unwrap();
1057-
let cmu = &cmu_map.get(&added_monitors[0].1.get_channel_id()).unwrap()[0];
1057+
let cmu = &cmu_map.get(&added_monitors[0].1.channel_id()).unwrap()[0];
10581058
let test_txo = OutPoint { txid: Txid::from_str("8984484a580b825b9972d7adb15050b3ab624ccd731946b3eeddb92f4e7ef6be").unwrap(), index: 0 };
10591059

10601060
let ro_persister = MonitorUpdatingPersister {

lightning/src/util/test_utils.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ impl<'a> chain::Watch<TestChannelSigner> for TestChainMonitor<'a> {
301301
let new_monitor = <(BlockHash, channelmonitor::ChannelMonitor<TestChannelSigner>)>::read(
302302
&mut io::Cursor::new(&w.0), (self.keys_manager, self.keys_manager)).unwrap().1;
303303
assert!(new_monitor == monitor);
304-
self.latest_monitor_update_id.lock().unwrap().insert(monitor.get_channel_id(),
304+
self.latest_monitor_update_id.lock().unwrap().insert(monitor.channel_id(),
305305
(funding_txo, monitor.get_latest_update_id(), MonitorUpdateId::from_new_monitor(&monitor)));
306306
self.added_monitors.lock().unwrap().push((funding_txo, monitor));
307307
self.chain_monitor.watch_channel(funding_txo, new_monitor)

0 commit comments

Comments
 (0)