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

Function init

plugins/xpay/xpay.c:3196–3237  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3194}
3195
3196static const char *init(struct command *init_cmd,
3197 const char *buf UNUSED, const jsmntok_t *config UNUSED)
3198{
3199 struct plugin *plugin = init_cmd->plugin;
3200 struct xpay *xpay = xpay_of(plugin);
3201 struct out_req *req;
3202
3203 xpay->global_gossmap = gossmap_load(xpay,
3204 GOSSIP_STORE_FILENAME,
3205 plugin_gossmap_logcb,
3206 plugin);
3207 if (!xpay->global_gossmap)
3208 plugin_err(plugin, "Could not load gossmap %s: %s",
3209 GOSSIP_STORE_FILENAME, strerror(errno));
3210 xpay->counter = 0;
3211 if (!pubkey_from_hexstr("02" "0000000000000000000000000000000000000000000000000000000000000001", 66, &xpay->fakenode))
3212 abort();
3213
3214 /* Cannot use rpc_scan, as we intercept rpc_command: would block. */
3215 req = jsonrpc_request_start(aux_command(init_cmd), "getchaininfo",
3216 getchaininfo_done,
3217 plugin_broken_cb,
3218 "getchaininfo");
3219 json_add_u32(req->js, "last_height", 0);
3220 send_outreq(req);
3221
3222 req = jsonrpc_request_start(aux_command(init_cmd), "getinfo",
3223 getinfo_done,
3224 plugin_broken_cb,
3225 "getinfo");
3226 send_outreq(req);
3227
3228 req = jsonrpc_request_start(aux_command(init_cmd), "askrene-create-layer",
3229 xpay_layer_created,
3230 plugin_broken_cb,
3231 "askrene-create-layer");
3232 json_add_string(req->js, "layer", "xpay");
3233 json_add_bool(req->js, "persistent", true);
3234 send_outreq(req);
3235
3236 return NULL;
3237}
3238
3239static const struct plugin_command commands[] = {
3240 {

Callers 2

mainFunction · 0.50
mainFunction · 0.50

Calls 9

xpay_ofFunction · 0.85
pubkey_from_hexstrFunction · 0.85
abortFunction · 0.85
json_add_u32Function · 0.85
json_add_boolFunction · 0.85
plugin_errFunction · 0.50
aux_commandFunction · 0.50
send_outreqFunction · 0.50
json_add_stringFunction · 0.50

Tested by

no test coverage detected