mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-19 15:14:23 +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:
committed by
neil saitug
parent
98185dfc2b
commit
08e3e979c8
@@ -61,8 +61,6 @@ new_uncommitted_channel(struct peer *peer)
|
|||||||
*/
|
*/
|
||||||
uc->minimum_depth = ld->config.anchor_confirms;
|
uc->minimum_depth = ld->config.anchor_confirms;
|
||||||
|
|
||||||
memset(&uc->cid, 0xFF, sizeof(uc->cid));
|
|
||||||
|
|
||||||
/* Declare the new channel to the HSM. */
|
/* Declare the new channel to the HSM. */
|
||||||
new_channel_msg = towire_hsmd_new_channel(NULL, &uc->peer->id, uc->dbid);
|
new_channel_msg = towire_hsmd_new_channel(NULL, &uc->peer->id, uc->dbid);
|
||||||
if (!wire_sync_write(ld->hsm_fd, take(new_channel_msg)))
|
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 */
|
/* Reserved dbid for if we become a real struct channel */
|
||||||
u64 dbid;
|
u64 dbid;
|
||||||
|
|
||||||
/* Channel id, v2 opens only */
|
/* Channel id (temporary!) */
|
||||||
struct channel_id cid;
|
struct channel_id cid;
|
||||||
|
|
||||||
/* For logging */
|
/* For logging */
|
||||||
|
|||||||
@@ -1142,6 +1142,8 @@ static struct command_result *json_fundchannel_start(struct command *cmd,
|
|||||||
return command_fail(cmd, FUNDING_PEER_NOT_CONNECTED,
|
return command_fail(cmd, FUNDING_PEER_NOT_CONNECTED,
|
||||||
"Peer not connected");
|
"Peer not connected");
|
||||||
|
|
||||||
|
temporary_channel_id(&tmp_channel_id);
|
||||||
|
|
||||||
if (!peer->uncommitted_channel) {
|
if (!peer->uncommitted_channel) {
|
||||||
if (feature_negotiated(cmd->ld->our_features,
|
if (feature_negotiated(cmd->ld->our_features,
|
||||||
peer->their_features,
|
peer->their_features,
|
||||||
@@ -1168,6 +1170,8 @@ static struct command_result *json_fundchannel_start(struct command *cmd,
|
|||||||
"peer");
|
"peer");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
peer->uncommitted_channel->cid = tmp_channel_id;
|
||||||
|
|
||||||
/* BOLT #2:
|
/* BOLT #2:
|
||||||
* - if both nodes advertised `option_support_large_channel`:
|
* - if both nodes advertised `option_support_large_channel`:
|
||||||
* - MAY set `funding_satoshis` greater than or equal to 2^24 satoshi.
|
* - 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
|
} else
|
||||||
upfront_shutdown_script_wallet_index = NULL;
|
upfront_shutdown_script_wallet_index = NULL;
|
||||||
|
|
||||||
temporary_channel_id(&tmp_channel_id);
|
|
||||||
|
|
||||||
fc->open_msg
|
fc->open_msg
|
||||||
= towire_openingd_funder_start(fc,
|
= towire_openingd_funder_start(fc,
|
||||||
*amount,
|
*amount,
|
||||||
|
|||||||
@@ -1339,6 +1339,7 @@ void peer_active(struct lightningd *ld, const u8 *msg, int fd)
|
|||||||
goto send_error;
|
goto send_error;
|
||||||
}
|
}
|
||||||
peer->uncommitted_channel = new_uncommitted_channel(peer);
|
peer->uncommitted_channel = new_uncommitted_channel(peer);
|
||||||
|
peer->uncommitted_channel->cid = channel_id;
|
||||||
peer_start_openingd(peer, peer_fd);
|
peer_start_openingd(peer, peer_fd);
|
||||||
break;
|
break;
|
||||||
case WIRE_OPEN_CHANNEL2:
|
case WIRE_OPEN_CHANNEL2:
|
||||||
|
|||||||
Reference in New Issue
Block a user