@@ -48,7 +48,7 @@ use crate::events::{self, Event, EventHandler, EventsProvider, InboundChannelFun
48
48
use crate::ln::inbound_payment;
49
49
use crate::ln::types::ChannelId;
50
50
use crate::types::payment::{PaymentHash, PaymentPreimage, PaymentSecret};
51
- use crate::ln::channel::{self, Channel, ChannelPhase, ChannelError, ChannelUpdateStatus, ShutdownResult, UpdateFulfillCommitFetch, OutboundV1Channel, InboundV1Channel, WithChannelContext};
51
+ use crate::ln::channel::{self, ChannelPhase, ChannelError, ChannelUpdateStatus, FundedChannel , ShutdownResult, UpdateFulfillCommitFetch, OutboundV1Channel, InboundV1Channel, WithChannelContext};
52
52
#[cfg(any(dual_funding, splicing))]
53
53
use crate::ln::channel::PendingV2Channel;
54
54
use crate::ln::channel_state::ChannelDetails;
@@ -150,7 +150,7 @@ use crate::ln::script::ShutdownScript;
150
150
// our payment, which we can use to decode errors or inform the user that the payment was sent.
151
151
152
152
/// Information about where a received HTLC('s onion) has indicated the HTLC should go.
153
- #[derive(Clone)] // See Channel ::revoke_and_ack for why, tl;dr: Rust bug
153
+ #[derive(Clone)] // See FundedChannel ::revoke_and_ack for why, tl;dr: Rust bug
154
154
#[cfg_attr(test, derive(Debug, PartialEq))]
155
155
pub enum PendingHTLCRouting {
156
156
/// An HTLC which should be forwarded on to another node.
@@ -270,7 +270,7 @@ impl PendingHTLCRouting {
270
270
271
271
/// Information about an incoming HTLC, including the [`PendingHTLCRouting`] describing where it
272
272
/// should go next.
273
- #[derive(Clone)] // See Channel ::revoke_and_ack for why, tl;dr: Rust bug
273
+ #[derive(Clone)] // See FundedChannel ::revoke_and_ack for why, tl;dr: Rust bug
274
274
#[cfg_attr(test, derive(Debug, PartialEq))]
275
275
pub struct PendingHTLCInfo {
276
276
/// Further routing details based on whether the HTLC is being forwarded or received.
@@ -313,14 +313,14 @@ pub struct PendingHTLCInfo {
313
313
pub skimmed_fee_msat: Option<u64>,
314
314
}
315
315
316
- #[derive(Clone)] // See Channel ::revoke_and_ack for why, tl;dr: Rust bug
316
+ #[derive(Clone)] // See FundedChannel ::revoke_and_ack for why, tl;dr: Rust bug
317
317
pub(super) enum HTLCFailureMsg {
318
318
Relay(msgs::UpdateFailHTLC),
319
319
Malformed(msgs::UpdateFailMalformedHTLC),
320
320
}
321
321
322
322
/// Stores whether we can't forward an HTLC or relevant forwarding info
323
- #[derive(Clone)] // See Channel ::revoke_and_ack for why, tl;dr: Rust bug
323
+ #[derive(Clone)] // See FundedChannel ::revoke_and_ack for why, tl;dr: Rust bug
324
324
pub(super) enum PendingHTLCStatus {
325
325
Forward(PendingHTLCInfo),
326
326
Fail(HTLCFailureMsg),
@@ -820,7 +820,7 @@ pub(super) const MIN_HTLC_RELAY_HOLDING_CELL_MILLIS: u64 = 100;
820
820
821
821
/// For events which result in both a RevokeAndACK and a CommitmentUpdate, by default they should
822
822
/// be sent in the order they appear in the return value, however sometimes the order needs to be
823
- /// variable at runtime (eg Channel ::channel_reestablish needs to re-send messages in the order
823
+ /// variable at runtime (eg FundedChannel ::channel_reestablish needs to re-send messages in the order
824
824
/// they were originally sent). In those cases, this enum is also returned.
825
825
#[derive(Clone, PartialEq, Debug)]
826
826
pub(super) enum RAACommitmentOrder {
@@ -3680,7 +3680,7 @@ where
3680
3680
Ok(temporary_channel_id)
3681
3681
}
3682
3682
3683
- fn list_funded_channels_with_filter<Fn: FnMut(&(&ChannelId, &Channel <SP>)) -> bool + Copy>(&self, f: Fn) -> Vec<ChannelDetails> {
3683
+ fn list_funded_channels_with_filter<Fn: FnMut(&(&ChannelId, &FundedChannel <SP>)) -> bool + Copy>(&self, f: Fn) -> Vec<ChannelDetails> {
3684
3684
// Allocate our best estimate of the number of channels we have in the `res`
3685
3685
// Vec. Sadly the `short_to_chan_info` map doesn't cover channels without
3686
3686
// a scid or a scid alias, and the `outpoint_to_peer` shouldn't be used outside
@@ -4204,7 +4204,7 @@ where
4204
4204
}
4205
4205
4206
4206
fn can_forward_htlc_to_outgoing_channel(
4207
- &self, chan: &mut Channel <SP>, msg: &msgs::UpdateAddHTLC, next_packet: &NextPacketDetails
4207
+ &self, chan: &mut FundedChannel <SP>, msg: &msgs::UpdateAddHTLC, next_packet: &NextPacketDetails
4208
4208
) -> Result<(), (&'static str, u16)> {
4209
4209
if !chan.context.should_announce() && !self.default_configuration.accept_forwards_to_priv_channels {
4210
4210
// Note that the behavior here should be identical to the above block - we
@@ -4245,7 +4245,7 @@ where
4245
4245
4246
4246
/// Executes a callback `C` that returns some value `X` on the channel found with the given
4247
4247
/// `scid`. `None` is returned when the channel is not found.
4248
- fn do_funded_channel_callback<X, C: Fn(&mut Channel <SP>) -> X>(
4248
+ fn do_funded_channel_callback<X, C: Fn(&mut FundedChannel <SP>) -> X>(
4249
4249
&self, scid: u64, callback: C,
4250
4250
) -> Option<X> {
4251
4251
let (counterparty_node_id, channel_id) = match self.short_to_chan_info.read().unwrap().get(&scid).cloned() {
@@ -4268,7 +4268,7 @@ where
4268
4268
fn can_forward_htlc(
4269
4269
&self, msg: &msgs::UpdateAddHTLC, next_packet_details: &NextPacketDetails
4270
4270
) -> Result<(), (&'static str, u16)> {
4271
- match self.do_funded_channel_callback(next_packet_details.outgoing_scid, |chan: &mut Channel <SP>| {
4271
+ match self.do_funded_channel_callback(next_packet_details.outgoing_scid, |chan: &mut FundedChannel <SP>| {
4272
4272
self.can_forward_htlc_to_outgoing_channel(chan, msg, next_packet_details)
4273
4273
}) {
4274
4274
Some(Ok(())) => {},
@@ -4439,7 +4439,7 @@ where
4439
4439
///
4440
4440
/// [`channel_update`]: msgs::ChannelUpdate
4441
4441
/// [`internal_closing_signed`]: Self::internal_closing_signed
4442
- fn get_channel_update_for_broadcast(&self, chan: &Channel <SP>) -> Result<msgs::ChannelUpdate, LightningError> {
4442
+ fn get_channel_update_for_broadcast(&self, chan: &FundedChannel <SP>) -> Result<msgs::ChannelUpdate, LightningError> {
4443
4443
if !chan.context.should_announce() {
4444
4444
return Err(LightningError {
4445
4445
err: "Cannot broadcast a channel_update for a private channel".to_owned(),
@@ -4465,7 +4465,7 @@ where
4465
4465
///
4466
4466
/// [`channel_update`]: msgs::ChannelUpdate
4467
4467
/// [`internal_closing_signed`]: Self::internal_closing_signed
4468
- fn get_channel_update_for_unicast(&self, chan: &Channel <SP>) -> Result<msgs::ChannelUpdate, LightningError> {
4468
+ fn get_channel_update_for_unicast(&self, chan: &FundedChannel <SP>) -> Result<msgs::ChannelUpdate, LightningError> {
4469
4469
let logger = WithChannelContext::from(&self.logger, &chan.context, None);
4470
4470
log_trace!(logger, "Attempting to generate channel update for channel {}", chan.context.channel_id());
4471
4471
let short_channel_id = match chan.context.get_short_channel_id().or(chan.context.latest_inbound_scid_alias()) {
@@ -5603,7 +5603,7 @@ where
5603
5603
};
5604
5604
5605
5605
'outer_loop: for (incoming_scid, update_add_htlcs) in decode_update_add_htlcs {
5606
- let incoming_channel_details_opt = self.do_funded_channel_callback(incoming_scid, |chan: &mut Channel <SP>| {
5606
+ let incoming_channel_details_opt = self.do_funded_channel_callback(incoming_scid, |chan: &mut FundedChannel <SP>| {
5607
5607
let counterparty_node_id = chan.context.get_counterparty_node_id();
5608
5608
let channel_id = chan.context.channel_id();
5609
5609
let funding_txo = chan.context.get_funding_txo().unwrap();
@@ -5638,7 +5638,7 @@ where
5638
5638
let outgoing_scid_opt = next_packet_details_opt.as_ref().map(|d| d.outgoing_scid);
5639
5639
5640
5640
// Process the HTLC on the incoming channel.
5641
- match self.do_funded_channel_callback(incoming_scid, |chan: &mut Channel <SP>| {
5641
+ match self.do_funded_channel_callback(incoming_scid, |chan: &mut FundedChannel <SP>| {
5642
5642
let logger = WithChannelContext::from(&self.logger, &chan.context, Some(update_add_htlc.payment_hash));
5643
5643
chan.can_accept_incoming_htlc(
5644
5644
update_add_htlc, &self.fee_estimator, &logger,
@@ -6338,7 +6338,7 @@ where
6338
6338
let _ = self.process_background_events();
6339
6339
}
6340
6340
6341
- fn update_channel_fee(&self, chan_id: &ChannelId, chan: &mut Channel <SP>, new_feerate: u32) -> NotifyOption {
6341
+ fn update_channel_fee(&self, chan_id: &ChannelId, chan: &mut FundedChannel <SP>, new_feerate: u32) -> NotifyOption {
6342
6342
if !chan.context.is_outbound() { return NotifyOption::SkipPersistNoEvents; }
6343
6343
6344
6344
let logger = WithChannelContext::from(&self.logger, &chan.context, None);
@@ -7437,7 +7437,7 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
7437
7437
/// Handles a channel reentering a functional state, either due to reconnect or a monitor
7438
7438
/// update completion.
7439
7439
fn handle_channel_resumption(&self, pending_msg_events: &mut Vec<MessageSendEvent>,
7440
- channel: &mut Channel <SP>, raa: Option<msgs::RevokeAndACK>,
7440
+ channel: &mut FundedChannel <SP>, raa: Option<msgs::RevokeAndACK>,
7441
7441
commitment_update: Option<msgs::CommitmentUpdate>, order: RAACommitmentOrder,
7442
7442
pending_forwards: Vec<(PendingHTLCInfo, u64)>, pending_update_adds: Vec<msgs::UpdateAddHTLC>,
7443
7443
funding_broadcastable: Option<Transaction>,
@@ -10946,7 +10946,7 @@ where
10946
10946
/// Calls a function which handles an on-chain event (blocks dis/connected, transactions
10947
10947
/// un/confirmed, etc) on each channel, handling any resulting errors or messages generated by
10948
10948
/// the function.
10949
- fn do_chain_event<FN: Fn(&mut Channel <SP>) -> Result<(Option<msgs::ChannelReady>, Vec<(HTLCSource, PaymentHash)>, Option<msgs::AnnouncementSignatures>), ClosureReason>>
10949
+ fn do_chain_event<FN: Fn(&mut FundedChannel <SP>) -> Result<(Option<msgs::ChannelReady>, Vec<(HTLCSource, PaymentHash)>, Option<msgs::AnnouncementSignatures>), ClosureReason>>
10950
10950
(&self, height_opt: Option<u32>, f: FN) {
10951
10951
// Note that we MUST NOT end up calling methods on self.chain_monitor here - we're called
10952
10952
// during initialization prior to the chain_monitor being fully configured in some cases.
@@ -13157,7 +13157,7 @@ where
13157
13157
let mut close_background_events = Vec::new();
13158
13158
let mut funding_txo_to_channel_id = hash_map_with_capacity(channel_count as usize);
13159
13159
for _ in 0..channel_count {
13160
- let mut channel: Channel <SP> = Channel ::read(reader, (
13160
+ let mut channel: FundedChannel <SP> = FundedChannel ::read(reader, (
13161
13161
&args.entropy_source, &args.signer_provider, best_block_height, &provided_channel_type_features(&args.default_config)
13162
13162
))?;
13163
13163
let logger = WithChannelContext::from(&args.logger, &channel.context, None);
0 commit comments