Skip to content

Commit 8884077

Browse files
committed
Remove distinction on PendingHTLCStatus
This will be removed as part of #2845.
1 parent 58e8e16 commit 8884077

File tree

1 file changed

+13
-38
lines changed

1 file changed

+13
-38
lines changed

lightning/src/ln/channel.rs

Lines changed: 13 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -175,28 +175,11 @@ enum InboundHTLCState {
175175
pub enum InboundHTLCStateDetails {
176176
/// The remote node announced the HTLC with update_add_htlc but the HTLC is not added to any
177177
/// commitment transactions yet.
178-
///
179-
/// We intend to forward the HTLC as it is correctly formed and is forwardable to the next hop.
180-
RemoteAnnouncedForward,
181-
/// The remote node announced the HTLC with update_add_htlc but the HTLC is not added to any
182-
/// commitment transactions yet.
183-
///
184-
/// We intend to fail the HTLC as it is malformed or we are unable to forward to the next hop,
185-
/// for example if the peer is disconnected or not enough capacity is available.
186-
RemoteAnnouncedFail,
187-
/// We have added this HTLC in our commitment transaction by receiving commitment_signed and
188-
/// returning revoke_and_ack. We are awaiting the appropriate revoke_and_ack's from the remote
189-
/// before this HTLC is included on the remote commitment transaction.
190-
///
191-
/// We intend to forward the HTLC as it is correctly formed and is forwardable to the next hop.
192-
AwaitingRemoteRevokeToAddForward,
178+
RemoteAnnounced,
193179
/// We have added this HTLC in our commitment transaction by receiving commitment_signed and
194180
/// returning revoke_and_ack. We are awaiting the appropriate revoke_and_ack's from the remote
195181
/// before this HTLC is included on the remote commitment transaction.
196-
///
197-
/// We intend to fail the HTLC as it is malformed or we are unable to forward to the next hop,
198-
/// for example if the peer is disconnected or not enough capacity is available.
199-
AwaitingRemoteRevokeToAddFail,
182+
AwaitingRemoteRevokeToAdd,
200183
/// This HTLC has been included in the commitment_signed and revoke_and_ack messages on both sides
201184
/// and is included in both commitment transactions.
202185
///
@@ -220,18 +203,12 @@ pub enum InboundHTLCStateDetails {
220203
impl From<&InboundHTLCState> for InboundHTLCStateDetails {
221204
fn from(state: &InboundHTLCState) -> InboundHTLCStateDetails {
222205
match state {
223-
InboundHTLCState::RemoteAnnounced(PendingHTLCStatus::Forward(_)) =>
224-
InboundHTLCStateDetails::RemoteAnnouncedForward,
225-
InboundHTLCState::RemoteAnnounced(PendingHTLCStatus::Fail(_)) =>
226-
InboundHTLCStateDetails::RemoteAnnouncedFail,
227-
InboundHTLCState::AwaitingRemoteRevokeToAnnounce(PendingHTLCStatus::Forward(_)) =>
228-
InboundHTLCStateDetails::AwaitingRemoteRevokeToAddForward,
229-
InboundHTLCState::AwaitingRemoteRevokeToAnnounce(PendingHTLCStatus::Fail(_)) =>
230-
InboundHTLCStateDetails::AwaitingRemoteRevokeToAddFail,
231-
InboundHTLCState::AwaitingAnnouncedRemoteRevoke(PendingHTLCStatus::Forward(_)) =>
232-
InboundHTLCStateDetails::AwaitingRemoteRevokeToAddForward,
233-
InboundHTLCState::AwaitingAnnouncedRemoteRevoke(PendingHTLCStatus::Fail(_)) =>
234-
InboundHTLCStateDetails::AwaitingRemoteRevokeToAddFail,
206+
InboundHTLCState::RemoteAnnounced(_) =>
207+
InboundHTLCStateDetails::RemoteAnnounced,
208+
InboundHTLCState::AwaitingRemoteRevokeToAnnounce(_) =>
209+
InboundHTLCStateDetails::AwaitingRemoteRevokeToAdd,
210+
InboundHTLCState::AwaitingAnnouncedRemoteRevoke(_) =>
211+
InboundHTLCStateDetails::AwaitingRemoteRevokeToAdd,
235212
InboundHTLCState::Committed =>
236213
InboundHTLCStateDetails::Committed,
237214
InboundHTLCState::LocalRemoved(InboundHTLCRemovalReason::FailRelay(_)) =>
@@ -245,13 +222,11 @@ impl From<&InboundHTLCState> for InboundHTLCStateDetails {
245222
}
246223

247224
impl_writeable_tlv_based_enum!(InboundHTLCStateDetails,
248-
(0, RemoteAnnouncedForward) => {},
249-
(2, RemoteAnnouncedFail) => {},
250-
(4, AwaitingRemoteRevokeToAddForward) => {},
251-
(6, AwaitingRemoteRevokeToAddFail) => {},
252-
(8, Committed) => {},
253-
(10, AwaitingRemoteRevokeToRemoveFulfill) => {},
254-
(12, AwaitingRemoteRevokeToRemoveFail) => {};
225+
(0, RemoteAnnounced) => {},
226+
(2, AwaitingRemoteRevokeToAdd) => {},
227+
(4, Committed) => {},
228+
(6, AwaitingRemoteRevokeToRemoveFulfill) => {},
229+
(8, AwaitingRemoteRevokeToRemoveFail) => {};
255230
);
256231

257232
struct InboundHTLCOutput {

0 commit comments

Comments
 (0)