mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-02-22 14:42:40 +01:00
lightningd: set cid correctly in peer->uncommitted_channel.
Setting it to 0xfffff... is just confusing. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
98185dfc2b
commit
08e3e979c8
4 changed files with 6 additions and 5 deletions
|
@ -61,8 +61,6 @@ new_uncommitted_channel(struct peer *peer)
|
|||
*/
|
||||
uc->minimum_depth = ld->config.anchor_confirms;
|
||||
|
||||
memset(&uc->cid, 0xFF, sizeof(uc->cid));
|
||||
|
||||
/* Declare the new channel to the HSM. */
|
||||
new_channel_msg = towire_hsmd_new_channel(NULL, &uc->peer->id, uc->dbid);
|
||||
if (!wire_sync_write(ld->hsm_fd, take(new_channel_msg)))
|
||||
|
|
|
@ -28,7 +28,7 @@ struct uncommitted_channel {
|
|||
/* Reserved dbid for if we become a real struct channel */
|
||||
u64 dbid;
|
||||
|
||||
/* Channel id, v2 opens only */
|
||||
/* Channel id (temporary!) */
|
||||
struct channel_id cid;
|
||||
|
||||
/* For logging */
|
||||
|
|
|
@ -1142,6 +1142,8 @@ static struct command_result *json_fundchannel_start(struct command *cmd,
|
|||
return command_fail(cmd, FUNDING_PEER_NOT_CONNECTED,
|
||||
"Peer not connected");
|
||||
|
||||
temporary_channel_id(&tmp_channel_id);
|
||||
|
||||
if (!peer->uncommitted_channel) {
|
||||
if (feature_negotiated(cmd->ld->our_features,
|
||||
peer->their_features,
|
||||
|
@ -1168,6 +1170,8 @@ static struct command_result *json_fundchannel_start(struct command *cmd,
|
|||
"peer");
|
||||
}
|
||||
|
||||
peer->uncommitted_channel->cid = tmp_channel_id;
|
||||
|
||||
/* BOLT #2:
|
||||
* - if both nodes advertised `option_support_large_channel`:
|
||||
* - MAY set `funding_satoshis` greater than or equal to 2^24 satoshi.
|
||||
|
@ -1220,8 +1224,6 @@ static struct command_result *json_fundchannel_start(struct command *cmd,
|
|||
} else
|
||||
upfront_shutdown_script_wallet_index = NULL;
|
||||
|
||||
temporary_channel_id(&tmp_channel_id);
|
||||
|
||||
fc->open_msg
|
||||
= towire_openingd_funder_start(fc,
|
||||
*amount,
|
||||
|
|
|
@ -1339,6 +1339,7 @@ void peer_active(struct lightningd *ld, const u8 *msg, int fd)
|
|||
goto send_error;
|
||||
}
|
||||
peer->uncommitted_channel = new_uncommitted_channel(peer);
|
||||
peer->uncommitted_channel->cid = channel_id;
|
||||
peer_start_openingd(peer, peer_fd);
|
||||
break;
|
||||
case WIRE_OPEN_CHANNEL2:
|
||||
|
|
Loading…
Add table
Reference in a new issue