Skip to content

Commit 26f1492

Browse files
daywalker90rustyrussell
authored andcommitted
docs: fix htlc states description regarding direction
Changelog-None
1 parent 71ddba2 commit 26f1492

File tree

8 files changed

+492
-541
lines changed

8 files changed

+492
-541
lines changed

cln-grpc/proto/node.proto

Lines changed: 1 addition & 24 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cln-rpc/src/model.rs

Lines changed: 1 addition & 103 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cln-rpc/src/primitives.rs

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ pub enum ChannelState {
3131
DUALOPEND_OPEN_COMMIT_READY = 13,
3232
}
3333

34+
/// ['The first 10 states are for `out`, the next 10 are for `in`.']
3435
#[derive(Copy, Clone, Serialize, Deserialize, Debug, PartialEq, Eq)]
3536
#[allow(non_camel_case_types)]
3637
pub enum HtlcState {
@@ -106,6 +107,19 @@ impl TryFrom<i32> for AutocleanSubsystem {
106107
}
107108
}
108109

110+
impl Display for AutocleanSubsystem {
111+
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
112+
match self {
113+
AutocleanSubsystem::SUCCEEDEDFORWARDS => write!(f, "SUCCEEDEDFORWARDS"),
114+
AutocleanSubsystem::FAILEDFORWARDS => write!(f, "FAILEDFORWARDS"),
115+
AutocleanSubsystem::SUCCEEDEDPAYS => write!(f, "SUCCEEDEDPAYS"),
116+
AutocleanSubsystem::FAILEDPAYS => write!(f, "FAILEDPAYS"),
117+
AutocleanSubsystem::PAIDINVOICES => write!(f, "PAIDINVOICES"),
118+
AutocleanSubsystem::EXPIREDINVOICES => write!(f, "EXPIREDINVOICES"),
119+
}
120+
}
121+
}
122+
109123
#[derive(Copy, Clone, Serialize, Deserialize, Debug)]
110124
#[allow(non_camel_case_types)]
111125
pub enum PluginSubcommand {
@@ -452,6 +466,27 @@ impl TryFrom<i32> for ChannelState {
452466
}
453467
}
454468

469+
impl Display for ChannelState {
470+
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
471+
match self {
472+
ChannelState::OPENINGD => write!(f, "OPENINGD"),
473+
ChannelState::CHANNELD_AWAITING_LOCKIN => write!(f, "CHANNELD_AWAITING_LOCKIN"),
474+
ChannelState::CHANNELD_NORMAL => write!(f, "CHANNELD_NORMAL"),
475+
ChannelState::CHANNELD_SHUTTING_DOWN => write!(f, "CHANNELD_SHUTTING_DOWN"),
476+
ChannelState::CLOSINGD_SIGEXCHANGE => write!(f, "CLOSINGD_SIGEXCHANGE"),
477+
ChannelState::CLOSINGD_COMPLETE => write!(f, "CLOSINGD_COMPLETE"),
478+
ChannelState::AWAITING_UNILATERAL => write!(f, "AWAITING_UNILATERAL"),
479+
ChannelState::FUNDING_SPEND_SEEN => write!(f, "FUNDING_SPEND_SEEN"),
480+
ChannelState::ONCHAIN => write!(f, "ONCHAIN"),
481+
ChannelState::DUALOPEND_OPEN_INIT => write!(f, "DUALOPEND_OPEN_INIT"),
482+
ChannelState::DUALOPEND_AWAITING_LOCKIN => write!(f, "DUALOPEND_AWAITING_LOCKIN"),
483+
ChannelState::CHANNELD_AWAITING_SPLICE => write!(f, "CHANNELD_AWAITING_SPLICE"),
484+
ChannelState::DUALOPEND_OPEN_COMMITTED => write!(f, "DUALOPEND_OPEN_COMMITTED"),
485+
ChannelState::DUALOPEND_OPEN_COMMIT_READY => write!(f, "DUALOPEND_OPEN_COMMIT_READY"),
486+
}
487+
}
488+
}
489+
455490
impl From<i32> for ChannelTypeName {
456491
fn from(value: i32) -> Self {
457492
match value {
@@ -479,6 +514,21 @@ impl From<ChannelTypeName> for i32 {
479514
}
480515
}
481516

517+
impl Display for ChannelTypeName {
518+
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
519+
match self {
520+
ChannelTypeName::STATIC_REMOTEKEY_EVEN => write!(f, "STATIC_REMOTEKEY_EVEN"),
521+
ChannelTypeName::ANCHOR_OUTPUTS_EVEN => write!(f, "ANCHOR_OUTPUTS_EVEN"),
522+
ChannelTypeName::ANCHORS_ZERO_FEE_HTLC_TX_EVEN => {
523+
write!(f, "ANCHORS_ZERO_FEE_HTLC_TX_EVEN")
524+
}
525+
ChannelTypeName::SCID_ALIAS_EVEN => write!(f, "SCID_ALIAS_EVEN"),
526+
ChannelTypeName::ZEROCONF_EVEN => write!(f, "ZEROCONF_EVEN"),
527+
ChannelTypeName::ANCHORS_EVEN => write!(f, "ANCHORS_EVEN"),
528+
}
529+
}
530+
}
531+
482532
impl From<i32> for HtlcState {
483533
fn from(value: i32) -> Self {
484534
match value {
@@ -508,6 +558,33 @@ impl From<i32> for HtlcState {
508558
}
509559
}
510560

561+
impl Display for HtlcState {
562+
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
563+
match self {
564+
HtlcState::SENT_ADD_HTLC => write!(f, "SENT_ADD_HTLC"),
565+
HtlcState::SENT_ADD_COMMIT => write!(f, "SENT_ADD_COMMIT"),
566+
HtlcState::RCVD_ADD_REVOCATION => write!(f, "RCVD_ADD_REVOCATION"),
567+
HtlcState::RCVD_ADD_ACK_COMMIT => write!(f, "RCVD_ADD_ACK_COMMIT"),
568+
HtlcState::SENT_ADD_ACK_REVOCATION => write!(f, "SENT_ADD_ACK_REVOCATION"),
569+
HtlcState::RCVD_ADD_ACK_REVOCATION => write!(f, "RCVD_ADD_ACK_REVOCATION"),
570+
HtlcState::RCVD_REMOVE_HTLC => write!(f, "RCVD_REMOVE_HTLC"),
571+
HtlcState::RCVD_REMOVE_COMMIT => write!(f, "RCVD_REMOVE_COMMIT"),
572+
HtlcState::SENT_REMOVE_REVOCATION => write!(f, "SENT_REMOVE_REVOCATION"),
573+
HtlcState::SENT_REMOVE_ACK_COMMIT => write!(f, "SENT_REMOVE_ACK_COMMIT"),
574+
HtlcState::RCVD_REMOVE_ACK_REVOCATION => write!(f, "RCVD_REMOVE_ACK_REVOCATION"),
575+
HtlcState::RCVD_ADD_HTLC => write!(f, "RCVD_ADD_HTLC"),
576+
HtlcState::RCVD_ADD_COMMIT => write!(f, "RCVD_ADD_COMMIT"),
577+
HtlcState::SENT_ADD_REVOCATION => write!(f, "SENT_ADD_REVOCATION"),
578+
HtlcState::SENT_ADD_ACK_COMMIT => write!(f, "SENT_ADD_ACK_COMMIT"),
579+
HtlcState::SENT_REMOVE_HTLC => write!(f, "SENT_REMOVE_HTLC"),
580+
HtlcState::SENT_REMOVE_COMMIT => write!(f, "SENT_REMOVE_COMMIT"),
581+
HtlcState::RCVD_REMOVE_REVOCATION => write!(f, "RCVD_REMOVE_REVOCATION"),
582+
HtlcState::RCVD_REMOVE_ACK_COMMIT => write!(f, "RCVD_REMOVE_ACK_COMMIT"),
583+
HtlcState::SENT_REMOVE_ACK_REVOCATION => write!(f, "SENT_REMOVE_ACK_REVOCATION"),
584+
}
585+
}
586+
}
587+
511588
impl<'de> Deserialize<'de> for Amount {
512589
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
513590
where

contrib/msggen/msggen/patch.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,7 @@ class OverridePatch(Patch):
216216
"channel_state_changed.old_state": "ChannelState",
217217
"channel_state_changed.new_state": "ChannelState",
218218
"ListPeerChannels.channels[].state": "ChannelState",
219+
"Wait.htlcs.state": "HtlcState",
219220
}
220221

221222
def visit(self, f: model.Field, parent: Optional[model.Field] = None) -> None:

contrib/msggen/msggen/schema.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21056,7 +21056,7 @@
2105621056
"SENT_REMOVE_ACK_REVOCATION"
2105721057
],
2105821058
"description": [
21059-
"The first 10 states are for `in`, the next 10 are for `out`."
21059+
"The first 10 states are for `out`, the next 10 are for `in`."
2106021060
]
2106121061
}
2106221062
}
@@ -34660,7 +34660,7 @@
3466034660
],
3466134661
"added": "v25.05",
3466234662
"description": [
34663-
"The first 10 states are for `in`, the next 10 are for `out`."
34663+
"The first 10 states are for `out`, the next 10 are for `in`."
3466434664
]
3466534665
},
3466634666
"htlc_id": {

contrib/pyln-grpc-proto/pyln/grpc/node_pb2.py

Lines changed: 408 additions & 410 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

doc/schemas/listhtlcs.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@
148148
"SENT_REMOVE_ACK_REVOCATION"
149149
],
150150
"description": [
151-
"The first 10 states are for `in`, the next 10 are for `out`."
151+
"The first 10 states are for `out`, the next 10 are for `in`."
152152
]
153153
}
154154
}

doc/schemas/wait.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -482,7 +482,7 @@
482482
],
483483
"added": "v25.05",
484484
"description": [
485-
"The first 10 states are for `in`, the next 10 are for `out`."
485+
"The first 10 states are for `out`, the next 10 are for `in`."
486486
]
487487
},
488488
"htlc_id": {

0 commit comments

Comments
 (0)