MCPcopy Create free account
hub / github.com/ElementsProject/lightning / openchannel_bump

Function openchannel_bump

lightningd/dual_open_control.c:2480–2526  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2478};
2479
2480static struct command_result *openchannel_bump(struct openchannel_bump_info *info)
2481{
2482 struct open_attempt *oa;
2483 struct channel_inflight *inflight;
2484 struct channel *channel;
2485 struct command *cmd = info->cmd;
2486
2487 /* We re-check channel in case it changed! */
2488 channel = channel_by_cid(cmd->ld, info->cid);
2489 if (!channel)
2490 return command_fail(cmd, FUNDING_UNKNOWN_CHANNEL,
2491 "Unknown channel %s",
2492 fmt_channel_id(tmpctx, info->cid));
2493
2494 inflight = channel_current_inflight(channel);
2495 if (!inflight) {
2496 return command_fail(cmd, FUNDING_STATE_INVALID,
2497 "No inflight for this channel exists.");
2498 }
2499
2500 if (!inflight->remote_tx_sigs) {
2501 return command_fail(cmd, FUNDING_STATE_INVALID,
2502 "Funding sigs for this channel not "
2503 "secured, see `openchannel_signed`");
2504 }
2505
2506 /* It's possible that the last open failed/was aborted.
2507 * So now we restart the attempt! */
2508 if (!channel->owner) {
2509 char *err = restart_dualopend(cmd, cmd->ld, channel, false);
2510 if (err)
2511 return command_fail(cmd, FUNDING_PEER_NOT_CONNECTED,
2512 "%s", err);
2513 }
2514
2515 channel->open_attempt = oa = new_channel_open_attempt(channel);
2516 oa->funding = *info->amount;
2517 oa->cmd = info->cmd;
2518 oa->our_upfront_shutdown_script
2519 = channel->shutdown_scriptpubkey[LOCAL];
2520
2521 subd_send_msg(channel->owner,
2522 take(towire_dualopend_rbf_init(NULL, *info->amount,
2523 *info->feerate_per_kw_funding,
2524 info->psbt)));
2525 return command_still_pending(cmd);
2526}
2527
2528/* sync_waiter must return void, so we use a simple wrapper */
2529static void openchannel_bump_after_sync(struct chain_topology *topo,

Callers 2

json_openchannel_bumpFunction · 0.85

Calls 8

channel_current_inflightFunction · 0.85
restart_dualopendFunction · 0.85
new_channel_open_attemptFunction · 0.85
channel_by_cidFunction · 0.70
command_failFunction · 0.70
subd_send_msgFunction · 0.70
command_still_pendingFunction · 0.70
fmt_channel_idFunction · 0.50

Tested by

no test coverage detected