Skip to content

Commit abe3533

Browse files
committed
Move channelmonitor.rs from ln to chain module
Given the chain::Watch interface is defined in terms of ChannelMonitor and ChannelMonitorUpdateErr, move channelmonitor.rs from the ln module to the chain module.
1 parent 0198ef7 commit abe3533

16 files changed

+53
-53
lines changed

fuzz/src/chanmon_consistency.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ use bitcoin::hashes::sha256::Hash as Sha256;
2121
use bitcoin::hash_types::{BlockHash, WPubkeyHash};
2222

2323
use lightning::chain;
24+
use lightning::chain::channelmonitor;
25+
use lightning::chain::channelmonitor::{ChannelMonitor, ChannelMonitorUpdateErr, HTLCUpdate};
2426
use lightning::chain::transaction::OutPoint;
2527
use lightning::chain::chaininterface::{BroadcasterInterface, ConfirmationTarget, FeeEstimator};
2628
use lightning::chain::keysinterface::{KeysInterface, InMemoryChannelKeys};
27-
use lightning::ln::channelmonitor;
28-
use lightning::ln::channelmonitor::{ChannelMonitor, ChannelMonitorUpdateErr, HTLCUpdate};
2929
use lightning::ln::channelmanager::{ChannelManager, PaymentHash, PaymentPreimage, PaymentSecret, ChannelManagerReadArgs};
3030
use lightning::ln::features::{ChannelFeatures, InitFeatures, NodeFeatures};
3131
use lightning::ln::msgs::{CommitmentUpdate, ChannelMessageHandler, ErrorAction, UpdateAddHTLC, Init};

fuzz/src/chanmon_deser.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33

44
use bitcoin::hash_types::BlockHash;
55

6+
use lightning::chain::channelmonitor;
67
use lightning::util::enforcing_trait_impls::EnforcingChannelKeys;
7-
use lightning::ln::channelmonitor;
88
use lightning::util::ser::{Readable, Writer};
99

1010
use utils::test_logger;

fuzz/src/full_stack.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ use bitcoin::hash_types::{Txid, BlockHash, WPubkeyHash};
1919

2020
use lightning::chain;
2121
use lightning::chain::chaininterface::{BroadcasterInterface, ConfirmationTarget, FeeEstimator};
22+
use lightning::chain::channelmonitor;
2223
use lightning::chain::transaction::OutPoint;
2324
use lightning::chain::keysinterface::{InMemoryChannelKeys, KeysInterface};
24-
use lightning::ln::channelmonitor;
2525
use lightning::ln::channelmanager::{ChannelManager, PaymentHash, PaymentPreimage, PaymentSecret};
2626
use lightning::ln::peer_handler::{MessageHandler,PeerManager,SocketDescriptor};
2727
use lightning::routing::router::get_route;
@@ -898,6 +898,6 @@ mod tests {
898898
assert_eq!(log_entries.get(&("lightning::ln::peer_handler".to_string(), "Handling UpdateHTLCs event in peer_handler for node 030200000000000000000000000000000000000000000000000000000000000000 with 1 adds, 0 fulfills, 0 fails for channel 3900000000000000000000000000000000000000000000000000000000000000".to_string())), Some(&3)); // 7
899899
assert_eq!(log_entries.get(&("lightning::ln::peer_handler".to_string(), "Handling UpdateHTLCs event in peer_handler for node 030000000000000000000000000000000000000000000000000000000000000000 with 0 adds, 1 fulfills, 0 fails for channel 3d00000000000000000000000000000000000000000000000000000000000000".to_string())), Some(&1)); // 8
900900
assert_eq!(log_entries.get(&("lightning::ln::peer_handler".to_string(), "Handling UpdateHTLCs event in peer_handler for node 030000000000000000000000000000000000000000000000000000000000000000 with 0 adds, 0 fulfills, 1 fails for channel 3d00000000000000000000000000000000000000000000000000000000000000".to_string())), Some(&2)); // 9
901-
assert_eq!(log_entries.get(&("lightning::ln::channelmonitor".to_string(), "Input spending remote commitment tx (00000000000000000000000000000000000000000000000000000000000000a1:0) in 0000000000000000000000000000000000000000000000000000000000000018 resolves outbound HTLC with payment hash ff00000000000000000000000000000000000000000000000000000000000000 with timeout".to_string())), Some(&1)); // 10
901+
assert_eq!(log_entries.get(&("lightning::chain::channelmonitor".to_string(), "Input spending remote commitment tx (00000000000000000000000000000000000000000000000000000000000000a1:0) in 0000000000000000000000000000000000000000000000000000000000000018 resolves outbound HTLC with payment hash ff00000000000000000000000000000000000000000000000000000000000000 with timeout".to_string())), Some(&1)); // 10
902902
}
903903
}

lightning-net-tokio/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
//! type Logger = dyn lightning::util::logger::Logger;
2828
//! type ChainAccess = dyn lightning::chain::Access;
2929
//! type ChainNotify = dyn lightning::chain::Notify;
30-
//! type ChainMonitor = lightning::ln::channelmonitor::ChainMonitor<lightning::chain::keysinterface::InMemoryChannelKeys, Arc<ChainNotify>, Arc<TxBroadcaster>, Arc<FeeEstimator>, Arc<Logger>>;
30+
//! type ChainMonitor = lightning::chain::channelmonitor::ChainMonitor<lightning::chain::keysinterface::InMemoryChannelKeys, Arc<ChainNotify>, Arc<TxBroadcaster>, Arc<FeeEstimator>, Arc<Logger>>;
3131
//! type ChannelManager = lightning::ln::channelmanager::SimpleArcChannelManager<ChainMonitor, TxBroadcaster, FeeEstimator, Logger>;
3232
//! type PeerManager = lightning::ln::peer_handler::SimpleArcPeerManager<lightning_net_tokio::SocketDescriptor, ChainMonitor, TxBroadcaster, FeeEstimator, ChainAccess, Logger>;
3333
//!

lightning/src/ln/channelmonitor.rs renamed to lightning/src/chain/channelmonitor.rs

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ use std::ops::Deref;
5454
#[derive(Clone)]
5555
#[must_use]
5656
pub struct ChannelMonitorUpdate {
57-
pub(super) updates: Vec<ChannelMonitorUpdateStep>,
57+
pub(crate) updates: Vec<ChannelMonitorUpdateStep>,
5858
/// The sequence number of this update. Updates *must* be replayed in-order according to this
5959
/// sequence number (and updates may panic if they are not). The update_id values are strictly
6060
/// increasing and increase by one for each new update.
@@ -149,9 +149,9 @@ pub struct MonitorUpdateError(pub &'static str);
149149
/// [`chain::Watch`]: ../../chain/trait.Watch.html
150150
#[derive(Clone, PartialEq)]
151151
pub struct HTLCUpdate {
152-
pub(super) payment_hash: PaymentHash,
153-
pub(super) payment_preimage: Option<PaymentPreimage>,
154-
pub(super) source: HTLCSource
152+
pub(crate) payment_hash: PaymentHash,
153+
pub(crate) payment_preimage: Option<PaymentPreimage>,
154+
pub(crate) source: HTLCSource
155155
}
156156
impl_writeable!(HTLCUpdate, 0, { payment_hash, payment_preimage, source });
157157

@@ -692,7 +692,7 @@ const MIN_SERIALIZATION_VERSION: u8 = 1;
692692

693693
#[cfg_attr(test, derive(PartialEq))]
694694
#[derive(Clone)]
695-
pub(super) enum ChannelMonitorUpdateStep {
695+
pub(crate) enum ChannelMonitorUpdateStep {
696696
LatestLocalCommitmentTXInfo {
697697
commitment_tx: LocalCommitmentTransaction,
698698
htlc_outputs: Vec<(HTLCOutputInCommitment, Option<Signature>, Option<HTLCSource>)>,
@@ -1145,7 +1145,7 @@ impl<ChanSigner: ChannelKeys + Writeable> ChannelMonitor<ChanSigner> {
11451145
}
11461146

11471147
impl<ChanSigner: ChannelKeys> ChannelMonitor<ChanSigner> {
1148-
pub(super) fn new(keys: ChanSigner, shutdown_pubkey: &PublicKey,
1148+
pub(crate) fn new(keys: ChanSigner, shutdown_pubkey: &PublicKey,
11491149
on_remote_tx_csv: u16, destination_script: &Script, funding_info: (OutPoint, Script),
11501150
remote_htlc_base_key: &PublicKey, remote_delayed_payment_base_key: &PublicKey,
11511151
on_local_tx_csv: u16, funding_redeemscript: Script, channel_value_satoshis: u64,
@@ -1232,7 +1232,7 @@ impl<ChanSigner: ChannelKeys> ChannelMonitor<ChanSigner> {
12321232
/// Inserts a revocation secret into this channel monitor. Prunes old preimages if neither
12331233
/// needed by local commitment transactions HTCLs nor by remote ones. Unless we haven't already seen remote
12341234
/// commitment transaction's secret, they are de facto pruned (we can use revocation key).
1235-
pub(super) fn provide_secret(&mut self, idx: u64, secret: [u8; 32]) -> Result<(), MonitorUpdateError> {
1235+
fn provide_secret(&mut self, idx: u64, secret: [u8; 32]) -> Result<(), MonitorUpdateError> {
12361236
if let Err(()) = self.commitment_secrets.provide_secret(idx, secret) {
12371237
return Err(MonitorUpdateError("Previous secret did not match new one"));
12381238
}
@@ -1284,7 +1284,7 @@ impl<ChanSigner: ChannelKeys> ChannelMonitor<ChanSigner> {
12841284
/// The monitor watches for it to be broadcasted and then uses the HTLC information (and
12851285
/// possibly future revocation/preimage information) to claim outputs where possible.
12861286
/// We cache also the mapping hash:commitment number to lighten pruning of old preimages by watchtowers.
1287-
pub(super) fn provide_latest_remote_commitment_tx_info<L: Deref>(&mut self, unsigned_commitment_tx: &Transaction, htlc_outputs: Vec<(HTLCOutputInCommitment, Option<Box<HTLCSource>>)>, commitment_number: u64, their_revocation_point: PublicKey, logger: &L) where L::Target: Logger {
1287+
pub(crate) fn provide_latest_remote_commitment_tx_info<L: Deref>(&mut self, unsigned_commitment_tx: &Transaction, htlc_outputs: Vec<(HTLCOutputInCommitment, Option<Box<HTLCSource>>)>, commitment_number: u64, their_revocation_point: PublicKey, logger: &L) where L::Target: Logger {
12881288
// TODO: Encrypt the htlc_outputs data with the single-hash of the commitment transaction
12891289
// so that a remote monitor doesn't learn anything unless there is a malicious close.
12901290
// (only maybe, sadly we cant do the same for local info, as we need to be aware of
@@ -1333,7 +1333,7 @@ impl<ChanSigner: ChannelKeys> ChannelMonitor<ChanSigner> {
13331333
/// is important that any clones of this channel monitor (including remote clones) by kept
13341334
/// up-to-date as our local commitment transaction is updated.
13351335
/// Panics if set_on_local_tx_csv has never been called.
1336-
pub(super) fn provide_latest_local_commitment_tx_info(&mut self, commitment_tx: LocalCommitmentTransaction, htlc_outputs: Vec<(HTLCOutputInCommitment, Option<Signature>, Option<HTLCSource>)>) -> Result<(), MonitorUpdateError> {
1336+
fn provide_latest_local_commitment_tx_info(&mut self, commitment_tx: LocalCommitmentTransaction, htlc_outputs: Vec<(HTLCOutputInCommitment, Option<Signature>, Option<HTLCSource>)>) -> Result<(), MonitorUpdateError> {
13371337
if self.local_tx_signed {
13381338
return Err(MonitorUpdateError("A local commitment tx has already been signed, no new local commitment txn can be sent to our counterparty"));
13391339
}
@@ -1366,11 +1366,11 @@ impl<ChanSigner: ChannelKeys> ChannelMonitor<ChanSigner> {
13661366

13671367
/// Provides a payment_hash->payment_preimage mapping. Will be automatically pruned when all
13681368
/// commitment_tx_infos which contain the payment hash have been revoked.
1369-
pub(super) fn provide_payment_preimage(&mut self, payment_hash: &PaymentHash, payment_preimage: &PaymentPreimage) {
1369+
pub(crate) fn provide_payment_preimage(&mut self, payment_hash: &PaymentHash, payment_preimage: &PaymentPreimage) {
13701370
self.payment_preimages.insert(payment_hash.clone(), payment_preimage.clone());
13711371
}
13721372

1373-
pub(super) fn broadcast_latest_local_commitment_txn<B: Deref, L: Deref>(&mut self, broadcaster: &B, logger: &L)
1373+
pub(crate) fn broadcast_latest_local_commitment_txn<B: Deref, L: Deref>(&mut self, broadcaster: &B, logger: &L)
13741374
where B::Target: BroadcasterInterface,
13751375
L::Target: Logger,
13761376
{
@@ -1380,7 +1380,7 @@ impl<ChanSigner: ChannelKeys> ChannelMonitor<ChanSigner> {
13801380
}
13811381

13821382
/// Used in Channel to cheat wrt the update_ids since it plays games, will be removed soon!
1383-
pub(super) fn update_monitor_ooo<L: Deref>(&mut self, mut updates: ChannelMonitorUpdate, logger: &L) -> Result<(), MonitorUpdateError> where L::Target: Logger {
1383+
pub(crate) fn update_monitor_ooo<L: Deref>(&mut self, mut updates: ChannelMonitorUpdate, logger: &L) -> Result<(), MonitorUpdateError> where L::Target: Logger {
13841384
for update in updates.updates.drain(..) {
13851385
match update {
13861386
ChannelMonitorUpdateStep::LatestLocalCommitmentTXInfo { commitment_tx, htlc_outputs } => {
@@ -1491,19 +1491,19 @@ impl<ChanSigner: ChannelKeys> ChannelMonitor<ChanSigner> {
14911491
}
14921492

14931493
/// Can only fail if idx is < get_min_seen_secret
1494-
pub(super) fn get_secret(&self, idx: u64) -> Option<[u8; 32]> {
1494+
fn get_secret(&self, idx: u64) -> Option<[u8; 32]> {
14951495
self.commitment_secrets.get_secret(idx)
14961496
}
14971497

1498-
pub(super) fn get_min_seen_secret(&self) -> u64 {
1498+
pub(crate) fn get_min_seen_secret(&self) -> u64 {
14991499
self.commitment_secrets.get_min_seen_secret()
15001500
}
15011501

1502-
pub(super) fn get_cur_remote_commitment_number(&self) -> u64 {
1502+
pub(crate) fn get_cur_remote_commitment_number(&self) -> u64 {
15031503
self.current_remote_commitment_number
15041504
}
15051505

1506-
pub(super) fn get_cur_local_commitment_number(&self) -> u64 {
1506+
pub(crate) fn get_cur_local_commitment_number(&self) -> u64 {
15071507
self.current_local_commitment_number
15081508
}
15091509

@@ -2032,7 +2032,7 @@ impl<ChanSigner: ChannelKeys> ChannelMonitor<ChanSigner> {
20322032
self.last_block_hash = block_hash;
20332033
}
20342034

2035-
pub(super) fn would_broadcast_at_height<L: Deref>(&self, height: u32, logger: &L) -> bool where L::Target: Logger {
2035+
pub(crate) fn would_broadcast_at_height<L: Deref>(&self, height: u32, logger: &L) -> bool where L::Target: Logger {
20362036
// We need to consider all HTLCs which are:
20372037
// * in any unrevoked remote commitment transaction, as they could broadcast said
20382038
// transactions and we'd end up in a race, or
@@ -2584,9 +2584,9 @@ mod tests {
25842584
use bitcoin::hashes::hex::FromHex;
25852585
use bitcoin::hash_types::Txid;
25862586
use hex;
2587+
use chain::channelmonitor::ChannelMonitor;
25872588
use chain::transaction::OutPoint;
25882589
use ln::channelmanager::{PaymentPreimage, PaymentHash};
2589-
use ln::channelmonitor::ChannelMonitor;
25902590
use ln::onchaintx::{OnchainTxHandler, InputDescriptors};
25912591
use ln::chan_utils;
25922592
use ln::chan_utils::{HTLCOutputInCommitment, LocalCommitmentTransaction};

lightning/src/chain/mod.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,12 @@ use bitcoin::blockdata::script::Script;
44
use bitcoin::blockdata::transaction::TxOut;
55
use bitcoin::hash_types::{BlockHash, Txid};
66

7+
use chain::channelmonitor::{ChannelMonitor, ChannelMonitorUpdate, ChannelMonitorUpdateErr, HTLCUpdate};
78
use chain::keysinterface::ChannelKeys;
89
use chain::transaction::OutPoint;
9-
use ln::channelmonitor::{ChannelMonitor, ChannelMonitorUpdate, ChannelMonitorUpdateErr, HTLCUpdate};
1010

1111
pub mod chaininterface;
12+
pub mod channelmonitor;
1213
pub mod transaction;
1314
pub mod keysinterface;
1415

lightning/src/ln/chan_utils.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ pub fn build_commitment_secret(commitment_seed: &[u8; 32], idx: u64) -> [u8; 32]
7171
/// Allows us to keep track of all of the revocation secrets of counterarties in just 50*32 bytes
7272
/// or so.
7373
#[derive(Clone)]
74-
pub(super) struct CounterpartyCommitmentSecrets {
74+
pub(crate) struct CounterpartyCommitmentSecrets {
7575
old_secrets: [([u8; 32], u64); 49],
7676
}
7777

@@ -87,7 +87,7 @@ impl PartialEq for CounterpartyCommitmentSecrets {
8787
}
8888

8989
impl CounterpartyCommitmentSecrets {
90-
pub(super) fn new() -> Self {
90+
pub(crate) fn new() -> Self {
9191
Self { old_secrets: [([0; 32], 1 << 48); 49], }
9292
}
9393

@@ -101,7 +101,7 @@ impl CounterpartyCommitmentSecrets {
101101
48
102102
}
103103

104-
pub(super) fn get_min_seen_secret(&self) -> u64 {
104+
pub(crate) fn get_min_seen_secret(&self) -> u64 {
105105
//TODO This can be optimized?
106106
let mut min = 1 << 48;
107107
for &(_, idx) in self.old_secrets.iter() {
@@ -113,7 +113,7 @@ impl CounterpartyCommitmentSecrets {
113113
}
114114

115115
#[inline]
116-
pub(super) fn derive_secret(secret: [u8; 32], bits: u8, idx: u64) -> [u8; 32] {
116+
fn derive_secret(secret: [u8; 32], bits: u8, idx: u64) -> [u8; 32] {
117117
let mut res: [u8; 32] = secret;
118118
for i in 0..bits {
119119
let bitpos = bits - 1 - i;
@@ -125,7 +125,7 @@ impl CounterpartyCommitmentSecrets {
125125
res
126126
}
127127

128-
pub(super) fn provide_secret(&mut self, idx: u64, secret: [u8; 32]) -> Result<(), ()> {
128+
pub(crate) fn provide_secret(&mut self, idx: u64, secret: [u8; 32]) -> Result<(), ()> {
129129
let pos = Self::place_secret(idx);
130130
for i in 0..pos {
131131
let (old_secret, old_idx) = self.old_secrets[i as usize];
@@ -141,7 +141,7 @@ impl CounterpartyCommitmentSecrets {
141141
}
142142

143143
/// Can only fail if idx is < get_min_seen_secret
144-
pub(super) fn get_secret(&self, idx: u64) -> Option<[u8; 32]> {
144+
pub(crate) fn get_secret(&self, idx: u64) -> Option<[u8; 32]> {
145145
for i in 0..self.old_secrets.len() {
146146
if (idx & (!((1 << i) - 1))) == self.old_secrets[i].1 {
147147
return Some(Self::derive_secret(self.old_secrets[i].0, i as u8, idx))

lightning/src/ln/chanmon_update_fail_tests.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
//! There are a bunch of these as their handling is relatively error-prone so they are split out
44
//! here. See also the chanmon_fail_consistency fuzz test.
55
6+
use chain::channelmonitor::ChannelMonitorUpdateErr;
67
use chain::transaction::OutPoint;
78
use ln::channelmanager::{RAACommitmentOrder, PaymentPreimage, PaymentHash, PaymentSecret, PaymentSendFailure};
8-
use ln::channelmonitor::ChannelMonitorUpdateErr;
99
use ln::features::InitFeatures;
1010
use ln::msgs;
1111
use ln::msgs::{ChannelMessageHandler, ErrorAction, RoutingMessageHandler};

lightning/src/ln/channel.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@ use bitcoin::secp256k1;
1717
use ln::features::{ChannelFeatures, InitFeatures};
1818
use ln::msgs;
1919
use ln::msgs::{DecodeError, OptionalField, DataLossProtect};
20-
use ln::channelmonitor::{ChannelMonitor, ChannelMonitorUpdate, ChannelMonitorUpdateStep, HTLC_FAIL_BACK_BUFFER};
2120
use ln::channelmanager::{PendingHTLCStatus, HTLCSource, HTLCFailReason, HTLCFailureMsg, PendingHTLCInfo, RAACommitmentOrder, PaymentPreimage, PaymentHash, BREAKDOWN_TIMEOUT, MAX_LOCAL_BREAKDOWN_TIMEOUT};
2221
use ln::chan_utils::{CounterpartyCommitmentSecrets, LocalCommitmentTransaction, TxCreationKeys, HTLCOutputInCommitment, HTLC_SUCCESS_TX_WEIGHT, HTLC_TIMEOUT_TX_WEIGHT, make_funding_redeemscript, ChannelPublicKeys};
2322
use ln::chan_utils;
2423
use chain::chaininterface::{FeeEstimator,ConfirmationTarget};
24+
use chain::channelmonitor::{ChannelMonitor, ChannelMonitorUpdate, ChannelMonitorUpdateStep, HTLC_FAIL_BACK_BUFFER};
2525
use chain::transaction::OutPoint;
2626
use chain::keysinterface::{ChannelKeys, KeysInterface};
2727
use util::transaction_utils;

lightning/src/ln/channelmanager.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ use bitcoin::secp256k1;
2929
use chain;
3030
use chain::Watch;
3131
use chain::chaininterface::{BroadcasterInterface, FeeEstimator};
32+
use chain::channelmonitor::{ChannelMonitor, ChannelMonitorUpdate, ChannelMonitorUpdateErr, HTLC_FAIL_BACK_BUFFER, CLTV_CLAIM_BUFFER, LATENCY_GRACE_PERIOD_BLOCKS, ANTI_REORG_DELAY};
3233
use chain::transaction::OutPoint;
3334
use ln::channel::{Channel, ChannelError};
34-
use ln::channelmonitor::{ChannelMonitor, ChannelMonitorUpdate, ChannelMonitorUpdateErr, HTLC_FAIL_BACK_BUFFER, CLTV_CLAIM_BUFFER, LATENCY_GRACE_PERIOD_BLOCKS, ANTI_REORG_DELAY};
3535
use ln::features::{InitFeatures, NodeFeatures};
3636
use routing::router::{Route, RouteHop};
3737
use ln::msgs;
@@ -120,7 +120,7 @@ pub(super) enum HTLCForwardInfo {
120120

121121
/// Tracks the inbound corresponding to an outbound HTLC
122122
#[derive(Clone, PartialEq)]
123-
pub(super) struct HTLCPreviousHopData {
123+
pub(crate) struct HTLCPreviousHopData {
124124
short_channel_id: u64,
125125
htlc_id: u64,
126126
incoming_packet_shared_secret: [u8; 32],
@@ -139,7 +139,7 @@ struct ClaimableHTLC {
139139

140140
/// Tracks the inbound corresponding to an outbound HTLC
141141
#[derive(Clone, PartialEq)]
142-
pub(super) enum HTLCSource {
142+
pub(crate) enum HTLCSource {
143143
PreviousHopData(HTLCPreviousHopData),
144144
OutboundRoute {
145145
path: Vec<RouteHop>,

lightning/src/ln/functional_test_utils.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
//! nodes for functional tests.
33
44
use chain::Watch;
5+
use chain::channelmonitor::ChannelMonitor;
56
use chain::transaction::OutPoint;
67
use ln::channelmanager::{ChannelManager, ChannelManagerReadArgs, RAACommitmentOrder, PaymentPreimage, PaymentHash, PaymentSecret, PaymentSendFailure};
7-
use ln::channelmonitor::ChannelMonitor;
88
use routing::router::{Route, get_route};
99
use routing::network_graph::{NetGraphMsgHandler, NetworkGraph};
1010
use ln::features::InitFeatures;

lightning/src/ln/functional_tests.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
//! claim outputs on-chain.
44
55
use chain::Watch;
6+
use chain::channelmonitor;
7+
use chain::channelmonitor::{ChannelMonitor, CLTV_CLAIM_BUFFER, LATENCY_GRACE_PERIOD_BLOCKS, ANTI_REORG_DELAY};
68
use chain::transaction::OutPoint;
79
use chain::keysinterface::{ChannelKeys, KeysInterface, SpendableOutputDescriptor};
810
use ln::channel::{COMMITMENT_TX_BASE_WEIGHT, COMMITMENT_TX_WEIGHT_PER_HTLC};
911
use ln::channelmanager::{ChannelManager,ChannelManagerReadArgs,HTLCForwardInfo,RAACommitmentOrder, PaymentPreimage, PaymentHash, PaymentSecret, PaymentSendFailure, BREAKDOWN_TIMEOUT};
10-
use ln::channelmonitor::{ChannelMonitor, CLTV_CLAIM_BUFFER, LATENCY_GRACE_PERIOD_BLOCKS, ANTI_REORG_DELAY};
11-
use ln::channelmonitor;
1212
use ln::channel::{Channel, ChannelError};
1313
use ln::{chan_utils, onion_utils};
1414
use routing::router::{Route, RouteHop, get_route};

lightning/src/ln/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
//! call into your NetGraphMsgHandler.
1111
1212
pub mod channelmanager;
13-
pub mod channelmonitor;
1413
pub mod msgs;
1514
pub mod peer_handler;
1615
pub mod chan_utils;

0 commit comments

Comments
 (0)