@@ -1133,6 +1133,7 @@ pub(super) struct Channel<SP: Deref> where SP::Target: SignerProvider {
1133
1133
/// The `ChannelPhase` enum describes the current phase in life of a lightning channel with each of
1134
1134
/// its variants containing an appropriate channel struct.
1135
1135
enum ChannelPhase<SP: Deref> where SP::Target: SignerProvider {
1136
+ Intermediate,
1136
1137
UnfundedOutboundV1(OutboundV1Channel<SP>),
1137
1138
UnfundedInboundV1(InboundV1Channel<SP>),
1138
1139
#[allow(dead_code)] // TODO(dual_funding): Remove once creating V2 channels is enabled.
@@ -1146,6 +1147,7 @@ impl<SP: Deref> Channel<SP> where
1146
1147
{
1147
1148
pub fn context(&self) -> &ChannelContext<SP> {
1148
1149
match &self.phase {
1150
+ ChannelPhase::Intermediate => unreachable!(),
1149
1151
ChannelPhase::Funded(chan) => &chan.context,
1150
1152
ChannelPhase::UnfundedOutboundV1(chan) => &chan.context,
1151
1153
ChannelPhase::UnfundedInboundV1(chan) => &chan.context,
@@ -1155,6 +1157,7 @@ impl<SP: Deref> Channel<SP> where
1155
1157
1156
1158
pub fn context_mut(&mut self) -> &mut ChannelContext<SP> {
1157
1159
match &mut self.phase {
1160
+ ChannelPhase::Intermediate => unreachable!(),
1158
1161
ChannelPhase::Funded(chan) => &mut chan.context,
1159
1162
ChannelPhase::UnfundedOutboundV1(chan) => &mut chan.context,
1160
1163
ChannelPhase::UnfundedInboundV1(chan) => &mut chan.context,
@@ -1164,6 +1167,7 @@ impl<SP: Deref> Channel<SP> where
1164
1167
1165
1168
pub fn unfunded_context_mut(&mut self) -> Option<&mut UnfundedChannelContext> {
1166
1169
match &mut self.phase {
1170
+ ChannelPhase::Intermediate => unreachable!(),
1167
1171
ChannelPhase::Funded(_) => { debug_assert!(false); None },
1168
1172
ChannelPhase::UnfundedOutboundV1(chan) => Some(&mut chan.unfunded_context),
1169
1173
ChannelPhase::UnfundedInboundV1(chan) => Some(&mut chan.unfunded_context),
@@ -1252,6 +1256,7 @@ impl<SP: Deref> Channel<SP> where
1252
1256
&mut self, chain_hash: ChainHash, logger: &L,
1253
1257
) -> Option<SignerResumeUpdates> where L::Target: Logger {
1254
1258
match &mut self.phase {
1259
+ ChannelPhase::Intermediate => unreachable!(),
1255
1260
ChannelPhase::Funded(chan) => Some(chan.signer_maybe_unblocked(logger)),
1256
1261
ChannelPhase::UnfundedOutboundV1(chan) => {
1257
1262
let (open_channel, funding_created) = chan.signer_maybe_unblocked(chain_hash, logger);
@@ -1292,6 +1297,7 @@ impl<SP: Deref> Channel<SP> where
1292
1297
1293
1298
pub fn is_resumable(&self) -> bool {
1294
1299
match &self.phase {
1300
+ ChannelPhase::Intermediate => unreachable!(),
1295
1301
ChannelPhase::Funded(_) => false,
1296
1302
ChannelPhase::UnfundedOutboundV1(chan) => chan.is_resumable(),
1297
1303
ChannelPhase::UnfundedInboundV1(_) => false,
@@ -1303,6 +1309,7 @@ impl<SP: Deref> Channel<SP> where
1303
1309
&mut self, chain_hash: ChainHash, logger: &L,
1304
1310
) -> Option<OpenChannelMessage> where L::Target: Logger {
1305
1311
match &mut self.phase {
1312
+ ChannelPhase::Intermediate => unreachable!(),
1306
1313
ChannelPhase::Funded(_) => None,
1307
1314
ChannelPhase::UnfundedOutboundV1(chan) => {
1308
1315
let logger = WithChannelContext::from(logger, &chan.context, None);
@@ -1344,6 +1351,7 @@ impl<SP: Deref> Channel<SP> where
1344
1351
L::Target: Logger,
1345
1352
{
1346
1353
match &mut self.phase {
1354
+ ChannelPhase::Intermediate => unreachable!(),
1347
1355
ChannelPhase::Funded(_) => Ok(None),
1348
1356
ChannelPhase::UnfundedOutboundV1(chan) => {
1349
1357
let logger = WithChannelContext::from(logger, &chan.context, None);
0 commit comments