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

Function init

plugins/xpay/xpay.c:3100–3141  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3098}
3099
3100static const char *init(struct command *init_cmd,
3101 const char *buf UNUSED, const jsmntok_t *config UNUSED)
3102{
3103 struct plugin *plugin = init_cmd->plugin;
3104 struct xpay *xpay = xpay_of(plugin);
3105 struct out_req *req;
3106
3107 xpay->global_gossmap = gossmap_load(xpay,
3108 GOSSIP_STORE_FILENAME,
3109 plugin_gossmap_logcb,
3110 plugin);
3111 if (!xpay->global_gossmap)
3112 plugin_err(plugin, "Could not load gossmap %s: %s",
3113 GOSSIP_STORE_FILENAME, strerror(errno));
3114 xpay->counter = 0;
3115 if (!pubkey_from_hexstr("02" "0000000000000000000000000000000000000000000000000000000000000001", 66, &xpay->fakenode))
3116 abort();
3117
3118 /* Cannot use rpc_scan, as we intercept rpc_command: would block. */
3119 req = jsonrpc_request_start(aux_command(init_cmd), "getchaininfo",
3120 getchaininfo_done,
3121 plugin_broken_cb,
3122 "getchaininfo");
3123 json_add_u32(req->js, "last_height", 0);
3124 send_outreq(req);
3125
3126 req = jsonrpc_request_start(aux_command(init_cmd), "getinfo",
3127 getinfo_done,
3128 plugin_broken_cb,
3129 "getinfo");
3130 send_outreq(req);
3131
3132 req = jsonrpc_request_start(aux_command(init_cmd), "askrene-create-layer",
3133 xpay_layer_created,
3134 plugin_broken_cb,
3135 "askrene-create-layer");
3136 json_add_string(req->js, "layer", "xpay");
3137 json_add_bool(req->js, "persistent", true);
3138 send_outreq(req);
3139
3140 return NULL;
3141}
3142
3143static const struct plugin_command commands[] = {
3144 {

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