Skip to content

Commit 42521f3

Browse files
committed
splice-script: channel id corner case
On the rare chance a channel id starts with 02 or 03 we need to check of it’s referring to a channel before parsing it node id, instead of after.
1 parent 7a2cd75 commit 42521f3

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

common/splice_script.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1114,12 +1114,6 @@ static struct splice_script_error *type_data(const tal_t *ctx,
11141114
input[i]->type = TOK_NODEID;
11151115
input[i]->node_id = tal(input[i],
11161116
struct node_id);
1117-
if (!node_id_from_hexstr(input[i]->str,
1118-
strlen(input[i]->str),
1119-
input[i]->node_id))
1120-
return new_error(ctx, INVALID_NODEID,
1121-
input[i],
1122-
"type_data");
11231117
/* Rare corner case where channel begins with
11241118
* prefix of 02 or 03 */
11251119
if (autocomplete_chan_id(input[i], channels,
@@ -1137,6 +1131,12 @@ static struct splice_script_error *type_data(const tal_t *ctx,
11371131
"type_data");
11381132
input[i]->type = TOK_CHANID;
11391133
input[i]->node_id = tal_free(input[i]->node_id);
1134+
} else if (!node_id_from_hexstr(input[i]->str,
1135+
strlen(input[i]->str),
1136+
input[i]->node_id)) {
1137+
return new_error(ctx, INVALID_NODEID,
1138+
input[i],
1139+
"type_data");
11401140
}
11411141
} else if (is_bitcoin_address(input[i]->str)) {
11421142
input[i]->type = TOK_BTCADDR;

0 commit comments

Comments
 (0)