Skip to content

Commit dd83080

Browse files
committed
Add a new field to OutboundV1Channel
1. This field saves info about the previously received AcceptChannel and previously created FundingTransaction.
1 parent d25d55a commit dd83080

File tree

1 file changed

+26
-1
lines changed

1 file changed

+26
-1
lines changed

lightning/src/ln/channel.rs

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1247,6 +1247,29 @@ impl UnfundedChannelContext {
12471247
}
12481248
}
12491249

1250+
/// Stores values related to retrying the handshake process for outbound channels
1251+
/// after disconnection and reconnection.
1252+
pub(super) struct OutboundContext {
1253+
received_accept_channel_msg: Option<msgs::AcceptChannel>,
1254+
created_funding_transaction: Option<FundingTransaction>
1255+
}
1256+
1257+
impl OutboundContext {
1258+
/// Create a new [`OutboundContext`] with blank values.
1259+
pub fn new() -> Self {
1260+
OutboundContext {
1261+
received_accept_channel_msg: None,
1262+
created_funding_transaction: None,
1263+
}
1264+
}
1265+
}
1266+
1267+
struct FundingTransaction {
1268+
funding_transaction: Transaction,
1269+
outpoint: OutPoint,
1270+
is_batch_funding: bool,
1271+
}
1272+
12501273
/// Contains everything about the channel including state, and various flags.
12511274
pub(super) struct ChannelContext<SP: Deref> where SP::Target: SignerProvider {
12521275
config: LegacyChannelConfig,
@@ -7285,6 +7308,7 @@ impl<SP: Deref> Channel<SP> where
72857308
pub(super) struct OutboundV1Channel<SP: Deref> where SP::Target: SignerProvider {
72867309
pub context: ChannelContext<SP>,
72877310
pub unfunded_context: UnfundedChannelContext,
7311+
pub outbound_context: OutboundContext,
72887312
}
72897313

72907314
impl<SP: Deref> OutboundV1Channel<SP> where SP::Target: SignerProvider {
@@ -7327,7 +7351,8 @@ impl<SP: Deref> OutboundV1Channel<SP> where SP::Target: SignerProvider {
73277351
holder_signer,
73287352
pubkeys,
73297353
)?,
7330-
unfunded_context: UnfundedChannelContext { unfunded_channel_age_ticks: 0 }
7354+
unfunded_context: UnfundedChannelContext { unfunded_channel_age_ticks: 0 },
7355+
outbound_context: OutboundContext::new(),
73317356
};
73327357
Ok(chan)
73337358
}

0 commit comments

Comments
 (0)