mirror of
https://github.com/lightningdevkit/rust-lightning.git
synced 2025-02-24 23:08:36 +01:00
Rename Channel to FundedChannel
In preparation for hiding ChannelPhase inside a Channel type, rename Channel to FundedChannel.
This commit is contained in:
parent
4a81e65b0e
commit
c55508860f
2 changed files with 46 additions and 46 deletions
|
@ -1091,8 +1091,8 @@ pub(crate) const CONCURRENT_INBOUND_HTLC_FEE_BUFFER: u32 = 2;
|
|||
/// transaction (not counting the value of the HTLCs themselves).
|
||||
pub(crate) const MIN_AFFORDABLE_HTLC_COUNT: usize = 4;
|
||||
|
||||
/// When a [`Channel`] has its [`ChannelConfig`] updated, its existing one is stashed for up to this
|
||||
/// number of ticks to allow forwarding HTLCs by nodes that have yet to receive the new
|
||||
/// When a [`FundedChannel`] has its [`ChannelConfig`] updated, its existing one is stashed for up
|
||||
/// to this number of ticks to allow forwarding HTLCs by nodes that have yet to receive the new
|
||||
/// ChannelUpdate prompted by the config update. This value was determined as follows:
|
||||
///
|
||||
/// * The expected interval between ticks (1 minute).
|
||||
|
@ -1109,7 +1109,7 @@ pub(crate) const EXPIRE_PREV_CONFIG_TICKS: usize = 5;
|
|||
pub(crate) const DISCONNECT_PEER_AWAITING_RESPONSE_TICKS: usize = 2;
|
||||
|
||||
/// The number of ticks that may elapse while we're waiting for an unfunded outbound/inbound channel
|
||||
/// to be promoted to a [`Channel`] since the unfunded channel was created. An unfunded channel
|
||||
/// to be promoted to a [`FundedChannel`] since the unfunded channel was created. An unfunded channel
|
||||
/// exceeding this age limit will be force-closed and purged from memory.
|
||||
pub(crate) const UNFUNDED_CHANNEL_AGE_LIMIT_TICKS: usize = 60;
|
||||
|
||||
|
@ -1131,7 +1131,7 @@ pub(super) enum ChannelPhase<SP: Deref> where SP::Target: SignerProvider {
|
|||
UnfundedInboundV1(InboundV1Channel<SP>),
|
||||
#[allow(dead_code)] // TODO(dual_funding): Remove once creating V2 channels is enabled.
|
||||
UnfundedV2(PendingV2Channel<SP>),
|
||||
Funded(Channel<SP>),
|
||||
Funded(FundedChannel<SP>),
|
||||
}
|
||||
|
||||
impl<'a, SP: Deref> ChannelPhase<SP> where
|
||||
|
@ -1169,7 +1169,7 @@ impl<'a, SP: Deref> ChannelPhase<SP> where
|
|||
matches!(self, ChannelPhase::Funded(_))
|
||||
}
|
||||
|
||||
pub fn as_funded(&self) -> Option<&Channel<SP>> {
|
||||
pub fn as_funded(&self) -> Option<&FundedChannel<SP>> {
|
||||
if let ChannelPhase::Funded(channel) = self {
|
||||
Some(channel)
|
||||
} else {
|
||||
|
@ -1177,7 +1177,7 @@ impl<'a, SP: Deref> ChannelPhase<SP> where
|
|||
}
|
||||
}
|
||||
|
||||
pub fn as_funded_mut(&mut self) -> Option<&mut Channel<SP>> {
|
||||
pub fn as_funded_mut(&mut self) -> Option<&mut FundedChannel<SP>> {
|
||||
if let ChannelPhase::Funded(channel) = self {
|
||||
Some(channel)
|
||||
} else {
|
||||
|
@ -1388,12 +1388,12 @@ where
|
|||
}
|
||||
}
|
||||
|
||||
impl<SP: Deref> From<Channel<SP>> for ChannelPhase<SP>
|
||||
impl<SP: Deref> From<FundedChannel<SP>> for ChannelPhase<SP>
|
||||
where
|
||||
SP::Target: SignerProvider,
|
||||
<SP::Target as SignerProvider>::EcdsaSigner: ChannelSigner,
|
||||
{
|
||||
fn from(channel: Channel<SP>) -> Self {
|
||||
fn from(channel: FundedChannel<SP>) -> Self {
|
||||
ChannelPhase::Funded(channel)
|
||||
}
|
||||
}
|
||||
|
@ -1514,7 +1514,7 @@ pub(super) struct ChannelContext<SP: Deref> where SP::Target: SignerProvider {
|
|||
/// the future when the signer indicates it may have a signature for us.
|
||||
///
|
||||
/// This flag is set in such a case. Note that we don't need to persist this as we'll end up
|
||||
/// setting it again as a side-effect of [`Channel::channel_reestablish`].
|
||||
/// setting it again as a side-effect of [`FundedChannel::channel_reestablish`].
|
||||
signer_pending_commitment_update: bool,
|
||||
/// Similar to [`Self::signer_pending_commitment_update`] but we're waiting to send either a
|
||||
/// [`msgs::FundingCreated`] or [`msgs::FundingSigned`] depending on if this channel is
|
||||
|
@ -1910,7 +1910,7 @@ impl<SP: Deref> InitialRemoteCommitmentReceiver<SP> for InboundV1Channel<SP> whe
|
|||
}
|
||||
}
|
||||
|
||||
impl<SP: Deref> InitialRemoteCommitmentReceiver<SP> for Channel<SP> where SP::Target: SignerProvider {
|
||||
impl<SP: Deref> InitialRemoteCommitmentReceiver<SP> for FundedChannel<SP> where SP::Target: SignerProvider {
|
||||
fn context(&self) -> &ChannelContext<SP> {
|
||||
&self.context
|
||||
}
|
||||
|
@ -2140,7 +2140,7 @@ impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider {
|
|||
if open_channel_fields.htlc_minimum_msat >= full_channel_value_msat {
|
||||
return Err(ChannelError::close(format!("Minimum htlc value ({}) was larger than full channel value ({})", open_channel_fields.htlc_minimum_msat, full_channel_value_msat)));
|
||||
}
|
||||
Channel::<SP>::check_remote_fee(&channel_type, fee_estimator, open_channel_fields.commitment_feerate_sat_per_1000_weight, None, &&logger)?;
|
||||
FundedChannel::<SP>::check_remote_fee(&channel_type, fee_estimator, open_channel_fields.commitment_feerate_sat_per_1000_weight, None, &&logger)?;
|
||||
|
||||
let max_counterparty_selected_contest_delay = u16::min(config.channel_handshake_limits.their_to_self_delay, MAX_LOCAL_BREAKDOWN_TIMEOUT);
|
||||
if open_channel_fields.to_self_delay > max_counterparty_selected_contest_delay {
|
||||
|
@ -4410,7 +4410,7 @@ pub(super) struct DualFundingChannelContext {
|
|||
|
||||
// Holder designates channel data owned for the benefit of the user client.
|
||||
// Counterparty designates channel data owned by the another channel participant entity.
|
||||
pub(super) struct Channel<SP: Deref> where SP::Target: SignerProvider {
|
||||
pub(super) struct FundedChannel<SP: Deref> where SP::Target: SignerProvider {
|
||||
pub context: ChannelContext<SP>,
|
||||
pub interactive_tx_signing_session: Option<InteractiveTxSigningSession>,
|
||||
holder_commitment_point: HolderCommitmentPoint,
|
||||
|
@ -4425,7 +4425,7 @@ struct CommitmentTxInfoCached {
|
|||
feerate: u32,
|
||||
}
|
||||
|
||||
/// Contents of a wire message that fails an HTLC backwards. Useful for [`Channel::fail_htlc`] to
|
||||
/// Contents of a wire message that fails an HTLC backwards. Useful for [`FundedChannel::fail_htlc`] to
|
||||
/// fail with either [`msgs::UpdateFailMalformedHTLC`] or [`msgs::UpdateFailHTLC`] as needed.
|
||||
trait FailHTLCContents {
|
||||
type Message: FailHTLCMessageName;
|
||||
|
@ -4481,7 +4481,7 @@ impl FailHTLCMessageName for msgs::UpdateFailMalformedHTLC {
|
|||
}
|
||||
}
|
||||
|
||||
impl<SP: Deref> Channel<SP> where
|
||||
impl<SP: Deref> FundedChannel<SP> where
|
||||
SP::Target: SignerProvider,
|
||||
<SP::Target as SignerProvider>::EcdsaSigner: EcdsaChannelSigner
|
||||
{
|
||||
|
@ -5989,7 +5989,7 @@ impl<SP: Deref> Channel<SP> where
|
|||
/// new feerate, the update is cancelled.
|
||||
///
|
||||
/// You MUST call [`Self::send_commitment_no_state_update`] prior to any other calls on this
|
||||
/// [`Channel`] if `force_holding_cell` is false.
|
||||
/// [`FundedChannel`] if `force_holding_cell` is false.
|
||||
fn send_update_fee<F: Deref, L: Deref>(
|
||||
&mut self, feerate_per_kw: u32, mut force_holding_cell: bool,
|
||||
fee_estimator: &LowerBoundedFeeEstimator<F>, logger: &L
|
||||
|
@ -6283,7 +6283,7 @@ impl<SP: Deref> Channel<SP> where
|
|||
if self.context.channel_state.is_peer_disconnected() {
|
||||
return Err(ChannelError::close("Peer sent update_fee when we needed a channel_reestablish".to_owned()));
|
||||
}
|
||||
Channel::<SP>::check_remote_fee(&self.context.channel_type, fee_estimator, msg.feerate_per_kw, Some(self.context.feerate_per_kw), logger)?;
|
||||
FundedChannel::<SP>::check_remote_fee(&self.context.channel_type, fee_estimator, msg.feerate_per_kw, Some(self.context.feerate_per_kw), logger)?;
|
||||
|
||||
self.context.pending_update_fee = Some((msg.feerate_per_kw, FeeUpdateState::RemoteAnnounced));
|
||||
self.context.update_time_counter += 1;
|
||||
|
@ -8070,7 +8070,7 @@ impl<SP: Deref> Channel<SP> where
|
|||
/// regenerate them.
|
||||
///
|
||||
/// You MUST call [`Self::send_commitment_no_state_update`] prior to calling any other methods
|
||||
/// on this [`Channel`] if `force_holding_cell` is false.
|
||||
/// on this [`FundedChannel`] if `force_holding_cell` is false.
|
||||
///
|
||||
/// `Err`s will only be [`ChannelError::Ignore`].
|
||||
fn send_htlc<F: Deref, L: Deref>(
|
||||
|
@ -8694,7 +8694,7 @@ impl<SP: Deref> OutboundV1Channel<SP> where SP::Target: SignerProvider {
|
|||
/// If this call is successful, broadcast the funding transaction (and not before!)
|
||||
pub fn funding_signed<L: Deref>(
|
||||
mut self, msg: &msgs::FundingSigned, best_block: BestBlock, signer_provider: &SP, logger: &L
|
||||
) -> Result<(Channel<SP>, ChannelMonitor<<SP::Target as SignerProvider>::EcdsaSigner>), (OutboundV1Channel<SP>, ChannelError)>
|
||||
) -> Result<(FundedChannel<SP>, ChannelMonitor<<SP::Target as SignerProvider>::EcdsaSigner>), (OutboundV1Channel<SP>, ChannelError)>
|
||||
where
|
||||
L::Target: Logger
|
||||
{
|
||||
|
@ -8721,7 +8721,7 @@ impl<SP: Deref> OutboundV1Channel<SP> where SP::Target: SignerProvider {
|
|||
|
||||
log_info!(logger, "Received funding_signed from peer for channel {}", &self.context.channel_id());
|
||||
|
||||
let mut channel = Channel {
|
||||
let mut channel = FundedChannel {
|
||||
context: self.context,
|
||||
interactive_tx_signing_session: None,
|
||||
holder_commitment_point,
|
||||
|
@ -8942,7 +8942,7 @@ impl<SP: Deref> InboundV1Channel<SP> where SP::Target: SignerProvider {
|
|||
|
||||
pub fn funding_created<L: Deref>(
|
||||
mut self, msg: &msgs::FundingCreated, best_block: BestBlock, signer_provider: &SP, logger: &L
|
||||
) -> Result<(Channel<SP>, Option<msgs::FundingSigned>, ChannelMonitor<<SP::Target as SignerProvider>::EcdsaSigner>), (Self, ChannelError)>
|
||||
) -> Result<(FundedChannel<SP>, Option<msgs::FundingSigned>, ChannelMonitor<<SP::Target as SignerProvider>::EcdsaSigner>), (Self, ChannelError)>
|
||||
where
|
||||
L::Target: Logger
|
||||
{
|
||||
|
@ -8986,7 +8986,7 @@ impl<SP: Deref> InboundV1Channel<SP> where SP::Target: SignerProvider {
|
|||
|
||||
// Promote the channel to a full-fledged one now that we have updated the state and have a
|
||||
// `ChannelMonitor`.
|
||||
let mut channel = Channel {
|
||||
let mut channel = FundedChannel {
|
||||
context: self.context,
|
||||
interactive_tx_signing_session: None,
|
||||
holder_commitment_point,
|
||||
|
@ -9343,11 +9343,11 @@ impl<SP: Deref> PendingV2Channel<SP> where SP::Target: SignerProvider {
|
|||
self.generate_accept_channel_v2_message()
|
||||
}
|
||||
|
||||
pub fn into_channel(self, signing_session: InteractiveTxSigningSession) -> Result<Channel<SP>, ChannelError>{
|
||||
pub fn into_channel(self, signing_session: InteractiveTxSigningSession) -> Result<FundedChannel<SP>, ChannelError>{
|
||||
let holder_commitment_point = self.unfunded_context.holder_commitment_point.ok_or(ChannelError::close(
|
||||
format!("Expected to have holder commitment points available upon finishing interactive tx construction for channel {}",
|
||||
self.context.channel_id())))?;
|
||||
let channel = Channel {
|
||||
let channel = FundedChannel {
|
||||
context: self.context,
|
||||
interactive_tx_signing_session: Some(signing_session),
|
||||
holder_commitment_point,
|
||||
|
@ -9439,7 +9439,7 @@ impl Readable for AnnouncementSigsState {
|
|||
}
|
||||
}
|
||||
|
||||
impl<SP: Deref> Writeable for Channel<SP> where SP::Target: SignerProvider {
|
||||
impl<SP: Deref> Writeable for FundedChannel<SP> where SP::Target: SignerProvider {
|
||||
fn write<W: Writer>(&self, writer: &mut W) -> Result<(), io::Error> {
|
||||
// Note that we write out as if remove_uncommitted_htlcs_and_mark_paused had just been
|
||||
// called.
|
||||
|
@ -9818,7 +9818,7 @@ impl<SP: Deref> Writeable for Channel<SP> where SP::Target: SignerProvider {
|
|||
}
|
||||
|
||||
const MAX_ALLOC_SIZE: usize = 64*1024;
|
||||
impl<'a, 'b, 'c, ES: Deref, SP: Deref> ReadableArgs<(&'a ES, &'b SP, u32, &'c ChannelTypeFeatures)> for Channel<SP>
|
||||
impl<'a, 'b, 'c, ES: Deref, SP: Deref> ReadableArgs<(&'a ES, &'b SP, u32, &'c ChannelTypeFeatures)> for FundedChannel<SP>
|
||||
where
|
||||
ES::Target: EntropySource,
|
||||
SP::Target: SignerProvider
|
||||
|
@ -10291,7 +10291,7 @@ impl<'a, 'b, 'c, ES: Deref, SP: Deref> ReadableArgs<(&'a ES, &'b SP, u32, &'c Ch
|
|||
},
|
||||
};
|
||||
|
||||
Ok(Channel {
|
||||
Ok(FundedChannel {
|
||||
context: ChannelContext {
|
||||
user_id,
|
||||
|
||||
|
@ -10449,7 +10449,7 @@ mod tests {
|
|||
use crate::ln::channel_keys::{RevocationKey, RevocationBasepoint};
|
||||
use crate::ln::channelmanager::{self, HTLCSource, PaymentId};
|
||||
use crate::ln::channel::InitFeatures;
|
||||
use crate::ln::channel::{AwaitingChannelReadyFlags, Channel, ChannelState, InboundHTLCOutput, OutboundV1Channel, InboundV1Channel, OutboundHTLCOutput, InboundHTLCState, OutboundHTLCState, HTLCCandidate, HTLCInitiator, HTLCUpdateAwaitingACK, commit_tx_fee_sat};
|
||||
use crate::ln::channel::{AwaitingChannelReadyFlags, ChannelState, FundedChannel, InboundHTLCOutput, OutboundV1Channel, InboundV1Channel, OutboundHTLCOutput, InboundHTLCState, OutboundHTLCState, HTLCCandidate, HTLCInitiator, HTLCUpdateAwaitingACK, commit_tx_fee_sat};
|
||||
use crate::ln::channel::{MAX_FUNDING_SATOSHIS_NO_WUMBO, TOTAL_BITCOIN_SUPPLY_SATOSHIS, MIN_THEIR_CHAN_RESERVE_SATOSHIS};
|
||||
use crate::types::features::{ChannelFeatures, ChannelTypeFeatures, NodeFeatures};
|
||||
use crate::ln::msgs;
|
||||
|
@ -11115,7 +11115,7 @@ mod tests {
|
|||
let mut s = crate::io::Cursor::new(&encoded_chan);
|
||||
let mut reader = crate::util::ser::FixedLengthReader::new(&mut s, encoded_chan.len() as u64);
|
||||
let features = channelmanager::provided_channel_type_features(&config);
|
||||
let decoded_chan = Channel::read(&mut reader, (&&keys_provider, &&keys_provider, 0, &features)).unwrap();
|
||||
let decoded_chan = FundedChannel::read(&mut reader, (&&keys_provider, &&keys_provider, 0, &features)).unwrap();
|
||||
assert_eq!(decoded_chan.context.pending_outbound_htlcs, pending_outbound_htlcs);
|
||||
assert_eq!(decoded_chan.context.holding_cell_htlc_updates, holding_cell_htlc_updates);
|
||||
}
|
||||
|
|
|
@ -48,7 +48,7 @@ use crate::events::{self, Event, EventHandler, EventsProvider, InboundChannelFun
|
|||
use crate::ln::inbound_payment;
|
||||
use crate::ln::types::ChannelId;
|
||||
use crate::types::payment::{PaymentHash, PaymentPreimage, PaymentSecret};
|
||||
use crate::ln::channel::{self, Channel, ChannelPhase, ChannelError, ChannelUpdateStatus, ShutdownResult, UpdateFulfillCommitFetch, OutboundV1Channel, InboundV1Channel, WithChannelContext};
|
||||
use crate::ln::channel::{self, ChannelPhase, ChannelError, ChannelUpdateStatus, FundedChannel, ShutdownResult, UpdateFulfillCommitFetch, OutboundV1Channel, InboundV1Channel, WithChannelContext};
|
||||
#[cfg(any(dual_funding, splicing))]
|
||||
use crate::ln::channel::PendingV2Channel;
|
||||
use crate::ln::channel_state::ChannelDetails;
|
||||
|
@ -150,7 +150,7 @@ use crate::ln::script::ShutdownScript;
|
|||
// our payment, which we can use to decode errors or inform the user that the payment was sent.
|
||||
|
||||
/// Information about where a received HTLC('s onion) has indicated the HTLC should go.
|
||||
#[derive(Clone)] // See Channel::revoke_and_ack for why, tl;dr: Rust bug
|
||||
#[derive(Clone)] // See FundedChannel::revoke_and_ack for why, tl;dr: Rust bug
|
||||
#[cfg_attr(test, derive(Debug, PartialEq))]
|
||||
pub enum PendingHTLCRouting {
|
||||
/// An HTLC which should be forwarded on to another node.
|
||||
|
@ -270,7 +270,7 @@ impl PendingHTLCRouting {
|
|||
|
||||
/// Information about an incoming HTLC, including the [`PendingHTLCRouting`] describing where it
|
||||
/// should go next.
|
||||
#[derive(Clone)] // See Channel::revoke_and_ack for why, tl;dr: Rust bug
|
||||
#[derive(Clone)] // See FundedChannel::revoke_and_ack for why, tl;dr: Rust bug
|
||||
#[cfg_attr(test, derive(Debug, PartialEq))]
|
||||
pub struct PendingHTLCInfo {
|
||||
/// Further routing details based on whether the HTLC is being forwarded or received.
|
||||
|
@ -313,14 +313,14 @@ pub struct PendingHTLCInfo {
|
|||
pub skimmed_fee_msat: Option<u64>,
|
||||
}
|
||||
|
||||
#[derive(Clone)] // See Channel::revoke_and_ack for why, tl;dr: Rust bug
|
||||
#[derive(Clone)] // See FundedChannel::revoke_and_ack for why, tl;dr: Rust bug
|
||||
pub(super) enum HTLCFailureMsg {
|
||||
Relay(msgs::UpdateFailHTLC),
|
||||
Malformed(msgs::UpdateFailMalformedHTLC),
|
||||
}
|
||||
|
||||
/// Stores whether we can't forward an HTLC or relevant forwarding info
|
||||
#[derive(Clone)] // See Channel::revoke_and_ack for why, tl;dr: Rust bug
|
||||
#[derive(Clone)] // See FundedChannel::revoke_and_ack for why, tl;dr: Rust bug
|
||||
pub(super) enum PendingHTLCStatus {
|
||||
Forward(PendingHTLCInfo),
|
||||
Fail(HTLCFailureMsg),
|
||||
|
@ -820,7 +820,7 @@ pub(super) const MIN_HTLC_RELAY_HOLDING_CELL_MILLIS: u64 = 100;
|
|||
|
||||
/// For events which result in both a RevokeAndACK and a CommitmentUpdate, by default they should
|
||||
/// be sent in the order they appear in the return value, however sometimes the order needs to be
|
||||
/// variable at runtime (eg Channel::channel_reestablish needs to re-send messages in the order
|
||||
/// variable at runtime (eg FundedChannel::channel_reestablish needs to re-send messages in the order
|
||||
/// they were originally sent). In those cases, this enum is also returned.
|
||||
#[derive(Clone, PartialEq, Debug)]
|
||||
pub(super) enum RAACommitmentOrder {
|
||||
|
@ -3680,7 +3680,7 @@ where
|
|||
Ok(temporary_channel_id)
|
||||
}
|
||||
|
||||
fn list_funded_channels_with_filter<Fn: FnMut(&(&ChannelId, &Channel<SP>)) -> bool + Copy>(&self, f: Fn) -> Vec<ChannelDetails> {
|
||||
fn list_funded_channels_with_filter<Fn: FnMut(&(&ChannelId, &FundedChannel<SP>)) -> bool + Copy>(&self, f: Fn) -> Vec<ChannelDetails> {
|
||||
// Allocate our best estimate of the number of channels we have in the `res`
|
||||
// Vec. Sadly the `short_to_chan_info` map doesn't cover channels without
|
||||
// a scid or a scid alias, and the `outpoint_to_peer` shouldn't be used outside
|
||||
|
@ -4204,7 +4204,7 @@ where
|
|||
}
|
||||
|
||||
fn can_forward_htlc_to_outgoing_channel(
|
||||
&self, chan: &mut Channel<SP>, msg: &msgs::UpdateAddHTLC, next_packet: &NextPacketDetails
|
||||
&self, chan: &mut FundedChannel<SP>, msg: &msgs::UpdateAddHTLC, next_packet: &NextPacketDetails
|
||||
) -> Result<(), (&'static str, u16)> {
|
||||
if !chan.context.should_announce() && !self.default_configuration.accept_forwards_to_priv_channels {
|
||||
// Note that the behavior here should be identical to the above block - we
|
||||
|
@ -4245,7 +4245,7 @@ where
|
|||
|
||||
/// Executes a callback `C` that returns some value `X` on the channel found with the given
|
||||
/// `scid`. `None` is returned when the channel is not found.
|
||||
fn do_funded_channel_callback<X, C: Fn(&mut Channel<SP>) -> X>(
|
||||
fn do_funded_channel_callback<X, C: Fn(&mut FundedChannel<SP>) -> X>(
|
||||
&self, scid: u64, callback: C,
|
||||
) -> Option<X> {
|
||||
let (counterparty_node_id, channel_id) = match self.short_to_chan_info.read().unwrap().get(&scid).cloned() {
|
||||
|
@ -4268,7 +4268,7 @@ where
|
|||
fn can_forward_htlc(
|
||||
&self, msg: &msgs::UpdateAddHTLC, next_packet_details: &NextPacketDetails
|
||||
) -> Result<(), (&'static str, u16)> {
|
||||
match self.do_funded_channel_callback(next_packet_details.outgoing_scid, |chan: &mut Channel<SP>| {
|
||||
match self.do_funded_channel_callback(next_packet_details.outgoing_scid, |chan: &mut FundedChannel<SP>| {
|
||||
self.can_forward_htlc_to_outgoing_channel(chan, msg, next_packet_details)
|
||||
}) {
|
||||
Some(Ok(())) => {},
|
||||
|
@ -4439,7 +4439,7 @@ where
|
|||
///
|
||||
/// [`channel_update`]: msgs::ChannelUpdate
|
||||
/// [`internal_closing_signed`]: Self::internal_closing_signed
|
||||
fn get_channel_update_for_broadcast(&self, chan: &Channel<SP>) -> Result<msgs::ChannelUpdate, LightningError> {
|
||||
fn get_channel_update_for_broadcast(&self, chan: &FundedChannel<SP>) -> Result<msgs::ChannelUpdate, LightningError> {
|
||||
if !chan.context.should_announce() {
|
||||
return Err(LightningError {
|
||||
err: "Cannot broadcast a channel_update for a private channel".to_owned(),
|
||||
|
@ -4465,7 +4465,7 @@ where
|
|||
///
|
||||
/// [`channel_update`]: msgs::ChannelUpdate
|
||||
/// [`internal_closing_signed`]: Self::internal_closing_signed
|
||||
fn get_channel_update_for_unicast(&self, chan: &Channel<SP>) -> Result<msgs::ChannelUpdate, LightningError> {
|
||||
fn get_channel_update_for_unicast(&self, chan: &FundedChannel<SP>) -> Result<msgs::ChannelUpdate, LightningError> {
|
||||
let logger = WithChannelContext::from(&self.logger, &chan.context, None);
|
||||
log_trace!(logger, "Attempting to generate channel update for channel {}", chan.context.channel_id());
|
||||
let short_channel_id = match chan.context.get_short_channel_id().or(chan.context.latest_inbound_scid_alias()) {
|
||||
|
@ -5603,7 +5603,7 @@ where
|
|||
};
|
||||
|
||||
'outer_loop: for (incoming_scid, update_add_htlcs) in decode_update_add_htlcs {
|
||||
let incoming_channel_details_opt = self.do_funded_channel_callback(incoming_scid, |chan: &mut Channel<SP>| {
|
||||
let incoming_channel_details_opt = self.do_funded_channel_callback(incoming_scid, |chan: &mut FundedChannel<SP>| {
|
||||
let counterparty_node_id = chan.context.get_counterparty_node_id();
|
||||
let channel_id = chan.context.channel_id();
|
||||
let funding_txo = chan.context.get_funding_txo().unwrap();
|
||||
|
@ -5638,7 +5638,7 @@ where
|
|||
let outgoing_scid_opt = next_packet_details_opt.as_ref().map(|d| d.outgoing_scid);
|
||||
|
||||
// Process the HTLC on the incoming channel.
|
||||
match self.do_funded_channel_callback(incoming_scid, |chan: &mut Channel<SP>| {
|
||||
match self.do_funded_channel_callback(incoming_scid, |chan: &mut FundedChannel<SP>| {
|
||||
let logger = WithChannelContext::from(&self.logger, &chan.context, Some(update_add_htlc.payment_hash));
|
||||
chan.can_accept_incoming_htlc(
|
||||
update_add_htlc, &self.fee_estimator, &logger,
|
||||
|
@ -6338,7 +6338,7 @@ where
|
|||
let _ = self.process_background_events();
|
||||
}
|
||||
|
||||
fn update_channel_fee(&self, chan_id: &ChannelId, chan: &mut Channel<SP>, new_feerate: u32) -> NotifyOption {
|
||||
fn update_channel_fee(&self, chan_id: &ChannelId, chan: &mut FundedChannel<SP>, new_feerate: u32) -> NotifyOption {
|
||||
if !chan.context.is_outbound() { return NotifyOption::SkipPersistNoEvents; }
|
||||
|
||||
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/
|
|||
/// Handles a channel reentering a functional state, either due to reconnect or a monitor
|
||||
/// update completion.
|
||||
fn handle_channel_resumption(&self, pending_msg_events: &mut Vec<MessageSendEvent>,
|
||||
channel: &mut Channel<SP>, raa: Option<msgs::RevokeAndACK>,
|
||||
channel: &mut FundedChannel<SP>, raa: Option<msgs::RevokeAndACK>,
|
||||
commitment_update: Option<msgs::CommitmentUpdate>, order: RAACommitmentOrder,
|
||||
pending_forwards: Vec<(PendingHTLCInfo, u64)>, pending_update_adds: Vec<msgs::UpdateAddHTLC>,
|
||||
funding_broadcastable: Option<Transaction>,
|
||||
|
@ -10946,7 +10946,7 @@ where
|
|||
/// Calls a function which handles an on-chain event (blocks dis/connected, transactions
|
||||
/// un/confirmed, etc) on each channel, handling any resulting errors or messages generated by
|
||||
/// the function.
|
||||
fn do_chain_event<FN: Fn(&mut Channel<SP>) -> Result<(Option<msgs::ChannelReady>, Vec<(HTLCSource, PaymentHash)>, Option<msgs::AnnouncementSignatures>), ClosureReason>>
|
||||
fn do_chain_event<FN: Fn(&mut FundedChannel<SP>) -> Result<(Option<msgs::ChannelReady>, Vec<(HTLCSource, PaymentHash)>, Option<msgs::AnnouncementSignatures>), ClosureReason>>
|
||||
(&self, height_opt: Option<u32>, f: FN) {
|
||||
// Note that we MUST NOT end up calling methods on self.chain_monitor here - we're called
|
||||
// during initialization prior to the chain_monitor being fully configured in some cases.
|
||||
|
@ -13157,7 +13157,7 @@ where
|
|||
let mut close_background_events = Vec::new();
|
||||
let mut funding_txo_to_channel_id = hash_map_with_capacity(channel_count as usize);
|
||||
for _ in 0..channel_count {
|
||||
let mut channel: Channel<SP> = Channel::read(reader, (
|
||||
let mut channel: FundedChannel<SP> = FundedChannel::read(reader, (
|
||||
&args.entropy_source, &args.signer_provider, best_block_height, &provided_channel_type_features(&args.default_config)
|
||||
))?;
|
||||
let logger = WithChannelContext::from(&args.logger, &channel.context, None);
|
||||
|
|
Loading…
Add table
Reference in a new issue