Skip to content

Commit ad55b0e

Browse files
committed
Add interactive tx constructor to ChannelContext
1 parent 61d869f commit ad55b0e

File tree

2 files changed

+17
-5
lines changed

2 files changed

+17
-5
lines changed

lightning/src/ln/channel.rs

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ use bitcoin::secp256k1;
2727

2828
use crate::ln::types::{ChannelId, PaymentPreimage, PaymentHash};
2929
use crate::ln::features::{ChannelTypeFeatures, InitFeatures};
30+
use crate::ln::interactivetxs::InteractiveTxConstructor;
3031
use crate::ln::msgs;
3132
use crate::ln::msgs::DecodeError;
3233
use crate::ln::script::{self, ShutdownScript};
@@ -3624,6 +3625,8 @@ pub(super) struct DualFundingChannelContext {
36243625
pub(super) struct Channel<SP: Deref> where SP::Target: SignerProvider {
36253626
pub context: ChannelContext<SP>,
36263627
pub dual_funding_channel_context: Option<DualFundingChannelContext>,
3628+
/// The current interactive transaction construction session under negotiation.
3629+
interactive_tx_constructor: Option<InteractiveTxConstructor>,
36273630
}
36283631

36293632
#[cfg(any(test, fuzzing))]
@@ -7724,6 +7727,7 @@ impl<SP: Deref> OutboundV1Channel<SP> where SP::Target: SignerProvider {
77247727
let mut channel = Channel {
77257728
context: self.context,
77267729
dual_funding_channel_context: None,
7730+
interactive_tx_constructor: None,
77277731
};
77287732

77297733
let need_channel_ready = channel.check_get_channel_ready(0, logger).is_some();
@@ -7832,7 +7836,7 @@ impl<SP: Deref> InboundV1Channel<SP> where SP::Target: SignerProvider {
78327836
msg.push_msat,
78337837
msg.common_fields.clone(),
78347838
)?,
7835-
unfunded_context: UnfundedChannelContext { unfunded_channel_age_ticks: 0 }
7839+
unfunded_context: UnfundedChannelContext { unfunded_channel_age_ticks: 0 },
78367840
};
78377841
Ok(chan)
78387842
}
@@ -8014,6 +8018,7 @@ impl<SP: Deref> InboundV1Channel<SP> where SP::Target: SignerProvider {
80148018
let mut channel = Channel {
80158019
context: self.context,
80168020
dual_funding_channel_context: None,
8021+
interactive_tx_constructor: None,
80178022
};
80188023
let need_channel_ready = channel.check_get_channel_ready(0, logger).is_some();
80198024
channel.monitor_updating_paused(false, false, need_channel_ready, Vec::new(), Vec::new(), Vec::new());
@@ -8027,6 +8032,8 @@ pub(super) struct OutboundV2Channel<SP: Deref> where SP::Target: SignerProvider
80278032
pub context: ChannelContext<SP>,
80288033
pub unfunded_context: UnfundedChannelContext,
80298034
pub dual_funding_context: DualFundingChannelContext,
8035+
/// The current interactive transaction construction session under negotiation.
8036+
interactive_tx_constructor: Option<InteractiveTxConstructor>,
80308037
}
80318038

80328039
impl<SP: Deref> OutboundV2Channel<SP> where SP::Target: SignerProvider {
@@ -8076,7 +8083,8 @@ impl<SP: Deref> OutboundV2Channel<SP> where SP::Target: SignerProvider {
80768083
their_funding_satoshis: 0,
80778084
funding_tx_locktime,
80788085
funding_feerate_sat_per_1000_weight,
8079-
}
8086+
},
8087+
interactive_tx_constructor: None,
80808088
};
80818089
Ok(chan)
80828090
}
@@ -8148,6 +8156,8 @@ pub(super) struct InboundV2Channel<SP: Deref> where SP::Target: SignerProvider {
81488156
pub context: ChannelContext<SP>,
81498157
pub unfunded_context: UnfundedChannelContext,
81508158
pub dual_funding_context: DualFundingChannelContext,
8159+
/// The current interactive transaction construction session under negotiation.
8160+
interactive_tx_constructor: Option<InteractiveTxConstructor>,
81518161
}
81528162

81538163
impl<SP: Deref> InboundV2Channel<SP> where SP::Target: SignerProvider {
@@ -8219,7 +8229,8 @@ impl<SP: Deref> InboundV2Channel<SP> where SP::Target: SignerProvider {
82198229
their_funding_satoshis: msg.common_fields.funding_satoshis,
82208230
funding_tx_locktime: msg.locktime,
82218231
funding_feerate_sat_per_1000_weight: msg.funding_feerate_sat_per_1000_weight,
8222-
}
8232+
},
8233+
interactive_tx_constructor: None,
82238234
};
82248235

82258236
Ok(chan)
@@ -9344,6 +9355,7 @@ impl<'a, 'b, 'c, ES: Deref, SP: Deref> ReadableArgs<(&'a ES, &'b SP, u32, &'c Ch
93449355
blocked_monitor_updates: blocked_monitor_updates.unwrap(),
93459356
},
93469357
dual_funding_channel_context: None,
9358+
interactive_tx_constructor: None,
93479359
})
93489360
}
93499361
}

lightning/src/ln/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ pub mod channel;
3737
#[cfg(not(fuzzing))]
3838
pub(crate) mod channel;
3939

40+
#[allow(dead_code)]
41+
mod interactivetxs;
4042
pub(crate) mod onion_utils;
4143
mod outbound_payment;
4244
pub mod wire;
@@ -85,7 +87,5 @@ mod async_signer_tests;
8587
#[cfg(test)]
8688
#[allow(unused_mut)]
8789
mod offers_tests;
88-
#[allow(dead_code)] // TODO(dual_funding): Exchange for dual_funding cfg
89-
pub(crate) mod interactivetxs;
9090

9191
pub use self::peer_channel_encryptor::LN_MAX_MSG_LEN;

0 commit comments

Comments
 (0)