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

Function splice_init

plugins/spender/splice.c:981–1012  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

979}
980
981static struct command_result *splice_init(struct command *cmd,
982 struct splice_cmd *splice_cmd,
983 size_t index)
984{
985 struct splice_script_result *action = splice_cmd->actions[index];
986 struct splice_cmd_action_state *state = splice_cmd->states[index];
987 struct out_req *req;
988
989 req = jsonrpc_request_start(cmd, "splice_init",
990 splice_init_get_result, splice_error,
991 splice_cmd);
992
993 json_add_channel_id(req->js, "channel_id", action->channel_id);
994 if (!amount_sat_is_zero(action->in_sat)) {
995 json_add_u64(req->js, "relative_amount",
996 action->in_sat.satoshis); /* Raw: signed RPC */
997 } else if (!amount_sat_is_zero(action->out_sat)) {
998 json_add_string(req->js, "relative_amount",
999 tal_fmt(req->js, "-%"PRIu64,
1000 action->out_sat.satoshis)); /* Raw: signed RPC */
1001 } else {
1002 json_add_sats(req->js, "relative_amount", amount_sat(0));
1003 }
1004 json_add_psbt(req->js, "initialpsbt", splice_cmd->psbt);
1005 json_add_u32(req->js, "feerate_per_kw", splice_cmd->feerate_per_kw);
1006 json_add_bool(req->js, "skip_stfu", true);
1007 json_add_bool(req->js, "force_feerate", splice_cmd->force_feerate);
1008
1009 state->state = SPLICE_CMD_INIT;
1010
1011 return send_outreq(req);
1012}
1013
1014static struct command_result *splice_update_get_result(struct command *cmd,
1015 const char *methodname,

Callers 1

continue_spliceFunction · 0.85

Calls 10

json_add_channel_idFunction · 0.85
amount_sat_is_zeroFunction · 0.85
json_add_u64Function · 0.85
json_add_satsFunction · 0.85
json_add_psbtFunction · 0.85
json_add_u32Function · 0.85
json_add_boolFunction · 0.85
amount_satClass · 0.70
json_add_stringFunction · 0.50
send_outreqFunction · 0.50

Tested by

no test coverage detected