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

Function stfu_channels_get_result

plugins/spender/splice.c:1964–1998  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1962}
1963
1964static struct command_result *stfu_channels_get_result(struct command *cmd,
1965 const char *methodname,
1966 const char *buf,
1967 const jsmntok_t *toks,
1968 struct splice_cmd *splice_cmd)
1969{
1970 const jsmntok_t *jchannels, *jchannel;
1971 size_t i;
1972 const char *err;
1973 struct command_result *result;
1974
1975 jchannels = json_get_member(buf, toks, "channels");
1976 json_for_each_arr(i, jchannel, jchannels) {
1977 struct channel_id channel_id;
1978 struct amount_sat sat;
1979
1980 memset(&channel_id, 0, sizeof(channel_id));
1981 memset(&sat, 0, sizeof(sat));
1982
1983 err = json_scan(tmpctx, buf, jchannel,
1984 "{channel_id?:%,available_msat?:%}",
1985 JSON_SCAN(json_to_channel_id, &channel_id),
1986 JSON_SCAN(json_to_msat_to_sat_round_down, &sat));
1987 if (err)
1988 errx(1, "Bad stfu_channels.channels %zu: %s",
1989 i, err);
1990
1991 result = adjust_pending_out_ppm(splice_cmd->actions,
1992 channel_id, sat, splice_cmd);
1993 if (result)
1994 return result;
1995 }
1996
1997 return execute_splice(splice_cmd->cmd, splice_cmd);
1998}
1999
2000static struct command_result *splice_dryrun(struct command *cmd,
2001 struct splice_cmd *splice_cmd)

Callers

nothing calls this directly

Calls 5

json_get_memberFunction · 0.85
errxFunction · 0.85
adjust_pending_out_ppmFunction · 0.85
execute_spliceFunction · 0.85
json_scanFunction · 0.50

Tested by

no test coverage detected