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

Function json_openchannel2_call

plugins/funder.c:524–665  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

522}
523
524static struct command_result *
525json_openchannel2_call(struct command *cmd,
526 const char *buf,
527 const jsmntok_t *params)
528{
529 struct open_info *info = tal(cmd, struct open_info);
530 struct amount_msat max_htlc_inflight, htlc_minimum;
531 u64 commitment_feerate_perkw,
532 feerate_our_max, feerate_our_min;
533 u32 to_self_delay, max_accepted_htlcs;
534 u16 channel_flags;
535 const char *err;
536 struct out_req *req;
537
538 err = json_scan(tmpctx, buf, params,
539 "{openchannel2:"
540 "{id:%"
541 ",channel_id:%"
542 ",their_funding_msat:%"
543 ",max_htlc_value_in_flight_msat:%"
544 ",htlc_minimum_msat:%"
545 ",funding_feerate_per_kw:%"
546 ",commitment_feerate_per_kw:%"
547 ",feerate_our_max:%"
548 ",feerate_our_min:%"
549 ",to_self_delay:%"
550 ",max_accepted_htlcs:%"
551 ",channel_flags:%"
552 ",locktime:%}}",
553 JSON_SCAN(json_to_node_id, &info->id),
554 JSON_SCAN(json_to_channel_id, &info->cid),
555 JSON_SCAN(json_to_msat_as_sats, &info->their_funding),
556 JSON_SCAN(json_to_msat, &max_htlc_inflight),
557 JSON_SCAN(json_to_msat, &htlc_minimum),
558 JSON_SCAN(json_to_u64, &info->funding_feerate_perkw),
559 JSON_SCAN(json_to_u64, &commitment_feerate_perkw),
560 JSON_SCAN(json_to_u64, &feerate_our_max),
561 JSON_SCAN(json_to_u64, &feerate_our_min),
562 JSON_SCAN(json_to_u32, &to_self_delay),
563 JSON_SCAN(json_to_u32, &max_accepted_htlcs),
564 JSON_SCAN(json_to_u16, &channel_flags),
565 JSON_SCAN(json_to_u32, &info->locktime));
566
567 if (err)
568 plugin_err(cmd->plugin,
569 "`openchannel2` payload did not scan %s: %.*s",
570 err, json_tok_full_len(params),
571 json_tok_full(buf, params));
572
573 err = json_scan(tmpctx, buf, params,
574 "{openchannel2:{"
575 "requested_lease_msat:%"
576 ",lease_blockheight_start:%"
577 ",node_blockheight:%}}",
578 JSON_SCAN(json_to_msat_as_sats, &info->requested_lease),
579 JSON_SCAN(json_to_u32, &info->node_blockheight),
580 JSON_SCAN(json_to_u32, &info->lease_blockheight));
581

Callers

nothing calls this directly

Calls 11

command_hook_successFunction · 0.85
amount_sat_zeroFunction · 0.85
plugin_errFunction · 0.70
plugin_logFunction · 0.70
jsonrpc_stream_successFunction · 0.70
command_finishedFunction · 0.70
send_outreqFunction · 0.70
json_scanFunction · 0.50
json_tok_full_lenFunction · 0.50
json_tok_fullFunction · 0.50
json_add_stringFunction · 0.50

Tested by

no test coverage detected