Skip to content

Commit

Permalink
openingd: make channel-type rejection message clearer.
Browse files Browse the repository at this point in the history
For example, lnprototest got the error 'You gave bad parameters: Did not support channel_type ' which doesn't make it clear that it's rejecting the empty channel type.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
  • Loading branch information
rustyrussell committed Jan 29, 2024
1 parent b805899 commit 6778f32
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion openingd/dualopend.c
Original file line number Diff line number Diff line change
Expand Up @@ -2433,7 +2433,7 @@ static void accepter_start(struct state *state, const u8 *oc2_msg)
state->channel_type = channel_type_from(state, open_tlv->channel_type);
} else {
negotiation_failed(state,
"Did not support channel_type %s",
"Did not support channel_type [%s]",
fmt_featurebits(tmpctx,
open_tlv->channel_type));
return;
Expand Down
2 changes: 1 addition & 1 deletion openingd/openingd.c
Original file line number Diff line number Diff line change
Expand Up @@ -974,7 +974,7 @@ static u8 *fundee_channel(struct state *state, const u8 *open_channel_msg)
state->channel_type = channel_type_from(state, open_tlvs->channel_type);
} else {
negotiation_failed(state,
"Did not support channel_type %s",
"Did not support channel_type [%s]",
fmt_featurebits(tmpctx,
open_tlvs->channel_type));
return NULL;
Expand Down
2 changes: 1 addition & 1 deletion tests/test_opening.py
Original file line number Diff line number Diff line change
Expand Up @@ -2654,7 +2654,7 @@ def test_opening_explicit_channel_type(node_factory, bitcoind):
l1.start()
l1.connect(l2)

with pytest.raises(RpcError, match=r'They sent ERROR .*: You gave bad parameters: Did not support channel_type 12,20'):
with pytest.raises(RpcError, match=r'They sent ERROR .*: You gave bad parameters: Did not support channel_type \[12,20\]'):
l1.rpc.fundchannel_start(l2.info['id'], FUNDAMOUNT, channel_type=[STATIC_REMOTEKEY, ANCHORS_OLD])

# Now make l2 accept it!
Expand Down

0 comments on commit 6778f32

Please sign in to comment.