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

Function json_openchannel2_call

plugins/funder.c:840–963  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

838}
839
840static struct command_result *
841json_openchannel2_call(struct command *cmd,
842 const char *buf,
843 const jsmntok_t *params)
844{
845 struct open_info *info = new_open_info(cmd);
846 struct amount_msat max_htlc_inflight, htlc_minimum;
847 u64 commitment_feerate_perkw,
848 feerate_our_max, feerate_our_min;
849 u32 to_self_delay, max_accepted_htlcs;
850 u16 channel_flags;
851 const char *err;
852
853 err = json_scan(tmpctx, buf, params,
854 "{openchannel2:"
855 "{id:%"
856 ",channel_id:%"
857 ",their_funding_msat:%"
858 ",max_htlc_value_in_flight_msat:%"
859 ",htlc_minimum_msat:%"
860 ",funding_feerate_per_kw:%"
861 ",commitment_feerate_per_kw:%"
862 ",feerate_our_max:%"
863 ",feerate_our_min:%"
864 ",to_self_delay:%"
865 ",max_accepted_htlcs:%"
866 ",channel_flags:%"
867 ",locktime:%"
868 ",channel_max_msat:%}}",
869 JSON_SCAN(json_to_node_id, &info->id),
870 JSON_SCAN(json_to_channel_id, &info->cid),
871 JSON_SCAN(json_to_msat_as_sats, &info->their_funding),
872 JSON_SCAN(json_to_msat, &max_htlc_inflight),
873 JSON_SCAN(json_to_msat, &htlc_minimum),
874 JSON_SCAN(json_to_u64, &info->funding_feerate_perkw),
875 JSON_SCAN(json_to_u64, &commitment_feerate_perkw),
876 JSON_SCAN(json_to_u64, &feerate_our_max),
877 JSON_SCAN(json_to_u64, &feerate_our_min),
878 JSON_SCAN(json_to_u32, &to_self_delay),
879 JSON_SCAN(json_to_u32, &max_accepted_htlcs),
880 JSON_SCAN(json_to_u16, &channel_flags),
881 JSON_SCAN(json_to_u32, &info->locktime),
882 JSON_SCAN(json_to_msat_as_sats, &info->channel_max));
883
884 if (err)
885 plugin_err(cmd->plugin,
886 "`openchannel2` payload did not scan %s: %.*s",
887 err, json_tok_full_len(params),
888 json_tok_full(buf, params));
889
890 /* Channel lease info isn't necessarily included, ignore any err */
891 json_scan(tmpctx, buf, params,
892 "{openchannel2:{"
893 "requested_lease_msat:%"
894 ",lease_blockheight_start:%"
895 ",node_blockheight:%}}",
896 JSON_SCAN(json_to_msat_as_sats, &info->requested_lease),
897 JSON_SCAN(json_to_u32, &info->lease_blockheight),

Callers

nothing calls this directly

Calls 12

new_open_infoFunction · 0.85
amount_sat_is_zeroFunction · 0.85
funding_queue_joinFunction · 0.85
plugin_errFunction · 0.70
plugin_logFunction · 0.70
command_hook_successFunction · 0.70
jsonrpc_stream_successFunction · 0.70
command_finishedFunction · 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