Skip to content

Commit d39432d

Browse files
committed
Add interactive tx constructor to ChannelContext
1 parent a7b1b64 commit d39432d

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))]
@@ -7725,6 +7728,7 @@ impl<SP: Deref> OutboundV1Channel<SP> where SP::Target: SignerProvider {
77257728
let mut channel = Channel {
77267729
context: self.context,
77277730
dual_funding_channel_context: None,
7731+
interactive_tx_constructor: None,
77287732
};
77297733

77307734
let need_channel_ready = channel.check_get_channel_ready(0, logger).is_some();
@@ -7833,7 +7837,7 @@ impl<SP: Deref> InboundV1Channel<SP> where SP::Target: SignerProvider {
78337837
msg.push_msat,
78347838
msg.common_fields.clone(),
78357839
)?,
7836-
unfunded_context: UnfundedChannelContext { unfunded_channel_age_ticks: 0 }
7840+
unfunded_context: UnfundedChannelContext { unfunded_channel_age_ticks: 0 },
78377841
};
78387842
Ok(chan)
78397843
}
@@ -8015,6 +8019,7 @@ impl<SP: Deref> InboundV1Channel<SP> where SP::Target: SignerProvider {
80158019
let mut channel = Channel {
80168020
context: self.context,
80178021
dual_funding_channel_context: None,
8022+
interactive_tx_constructor: None,
80188023
};
80198024
let need_channel_ready = channel.check_get_channel_ready(0, logger).is_some();
80208025
channel.monitor_updating_paused(false, false, need_channel_ready, Vec::new(), Vec::new(), Vec::new());
@@ -8028,6 +8033,8 @@ pub(super) struct OutboundV2Channel<SP: Deref> where SP::Target: SignerProvider
80288033
pub context: ChannelContext<SP>,
80298034
pub unfunded_context: UnfundedChannelContext,
80308035
pub dual_funding_context: DualFundingChannelContext,
8036+
/// The current interactive transaction construction session under negotiation.
8037+
interactive_tx_constructor: Option<InteractiveTxConstructor>,
80318038
}
80328039

80338040
impl<SP: Deref> OutboundV2Channel<SP> where SP::Target: SignerProvider {
@@ -8077,7 +8084,8 @@ impl<SP: Deref> OutboundV2Channel<SP> where SP::Target: SignerProvider {
80778084
their_funding_satoshis: 0,
80788085
funding_tx_locktime,
80798086
funding_feerate_sat_per_1000_weight,
8080-
}
8087+
},
8088+
interactive_tx_constructor: None,
80818089
};
80828090
Ok(chan)
80838091
}
@@ -8149,6 +8157,8 @@ pub(super) struct InboundV2Channel<SP: Deref> where SP::Target: SignerProvider {
81498157
pub context: ChannelContext<SP>,
81508158
pub unfunded_context: UnfundedChannelContext,
81518159
pub dual_funding_context: DualFundingChannelContext,
8160+
/// The current interactive transaction construction session under negotiation.
8161+
interactive_tx_constructor: Option<InteractiveTxConstructor>,
81528162
}
81538163

81548164
impl<SP: Deref> InboundV2Channel<SP> where SP::Target: SignerProvider {
@@ -8220,7 +8230,8 @@ impl<SP: Deref> InboundV2Channel<SP> where SP::Target: SignerProvider {
82208230
their_funding_satoshis: msg.common_fields.funding_satoshis,
82218231
funding_tx_locktime: msg.locktime,
82228232
funding_feerate_sat_per_1000_weight: msg.funding_feerate_sat_per_1000_weight,
8223-
}
8233+
},
8234+
interactive_tx_constructor: None,
82248235
};
82258236

82268237
Ok(chan)
@@ -9345,6 +9356,7 @@ impl<'a, 'b, 'c, ES: Deref, SP: Deref> ReadableArgs<(&'a ES, &'b SP, u32, &'c Ch
93459356
blocked_monitor_updates: blocked_monitor_updates.unwrap(),
93469357
},
93479358
dual_funding_channel_context: None,
9359+
interactive_tx_constructor: None,
93489360
})
93499361
}
93509362
}

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)] // TODO(dual_funding): Remove allow when dual-funding fully implemented.
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)