mirror of
https://github.com/lightningdevkit/rust-lightning.git
synced 2025-01-18 21:34:48 +01:00
Implement From<InboundV1Channel> for ChannelPhase
Exposing ChannelPhase in ChannelManager has led to verbose match statements, which need to be modified each time a ChannelPhase is added. Making ChannelPhase an implementation detail of Channel would help avoid this. As a step in this direction, define a conversion from InboundV1Channel to ChannelPhase (to be renamed Channel).
This commit is contained in:
parent
583224f4f9
commit
e8c4849dc7
@ -1368,6 +1368,16 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
impl<SP: Deref> From<InboundV1Channel<SP>> for ChannelPhase<SP>
|
||||
where
|
||||
SP::Target: SignerProvider,
|
||||
<SP::Target as SignerProvider>::EcdsaSigner: ChannelSigner,
|
||||
{
|
||||
fn from(channel: InboundV1Channel<SP>) -> Self {
|
||||
ChannelPhase::UnfundedInboundV1(channel)
|
||||
}
|
||||
}
|
||||
|
||||
impl<SP: Deref> From<Channel<SP>> for ChannelPhase<SP>
|
||||
where
|
||||
SP::Target: SignerProvider,
|
||||
|
@ -7689,7 +7689,7 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
|
||||
msg,
|
||||
}
|
||||
});
|
||||
(*temporary_channel_id, ChannelPhase::UnfundedInboundV1(channel), message_send_event)
|
||||
(*temporary_channel_id, ChannelPhase::from(channel), message_send_event)
|
||||
})
|
||||
},
|
||||
#[cfg(dual_funding)]
|
||||
@ -7977,7 +7977,7 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
|
||||
msg,
|
||||
}
|
||||
});
|
||||
(ChannelPhase::UnfundedInboundV1(channel), message_send_event)
|
||||
(ChannelPhase::from(channel), message_send_event)
|
||||
},
|
||||
#[cfg(dual_funding)]
|
||||
OpenChannelMessageRef::V2(msg) => {
|
||||
|
Loading…
Reference in New Issue
Block a user