Skip to content

Breakup CooperativeClosure into Local/Remote initiated #2863

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 5, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Rename old CooperativeClosure to LegacyCooperativeClosure
  • Loading branch information
benthecarman committed Feb 4, 2024
commit efcb5d9d0f1861977ef9748ab84ec5e69240283b
6 changes: 3 additions & 3 deletions lightning/src/events/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ pub enum ClosureReason {
/// The channel was closed after negotiating a cooperative close and we've now broadcasted
/// the cooperative close transaction. Note the shutdown may have been initiated by us.
// Can be removed once we disallow downgrading to 0.0.121
CooperativeClosure,
LegacyCooperativeClosure,
/// The channel was closed after negotiating a cooperative close and we've now broadcasted
/// the cooperative close transaction. This indicates that the shutdown was initiated by our
/// counterparty.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/// counterparty.
/// counterparty.
///
/// In rare cases where we sent our peer a `shutdown`, crashed, then restarted this reason may be given even though we initiated the shutdown.

Expand Down Expand Up @@ -237,7 +237,7 @@ impl core::fmt::Display for ClosureReason {
f.write_fmt(format_args!("counterparty force-closed with message: {}", peer_msg))
},
ClosureReason::HolderForceClosed => f.write_str("user manually force-closed the channel"),
ClosureReason::CooperativeClosure => f.write_str("the channel was cooperatively closed"),
ClosureReason::LegacyCooperativeClosure => f.write_str("the channel was cooperatively closed"),
ClosureReason::CounterpartyInitiatedCooperativeClosure => f.write_str("the channel was cooperatively closed by our peer"),
ClosureReason::LocallyInitiatedCooperativeClosure => f.write_str("the channel was cooperatively closed by us"),
ClosureReason::CommitmentTxConfirmed => f.write_str("commitment or closing transaction was confirmed on chain."),
Expand All @@ -259,7 +259,7 @@ impl_writeable_tlv_based_enum_upgradable!(ClosureReason,
(1, FundingTimedOut) => {},
(2, HolderForceClosed) => {},
(6, CommitmentTxConfirmed) => {},
(4, CooperativeClosure) => {},
(4, LegacyCooperativeClosure) => {},
Comment on lines 261 to +262
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unrelated nit:

Since we are touching these lines, should we think about reordering these enums? I think it's pretty odd to write 6th before 4th.

Suggested change
(6, CommitmentTxConfirmed) => {},
(4, CooperativeClosure) => {},
(4, LegacyCooperativeClosure) => {},
(4, LegacyCooperativeClosure) => {},
(6, CommitmentTxConfirmed) => {},

(8, ProcessingError) => { (1, err, required) },
(10, DisconnectedPeer) => {},
(12, OutdatedChannelManager) => {},
Expand Down