| 3381 | } |
| 3382 | |
| 3383 | static const char *init(struct command *init_cmd, |
| 3384 | const char *buf UNUSED, const jsmntok_t *config UNUSED) |
| 3385 | { |
| 3386 | struct plugin *plugin = init_cmd->plugin; |
| 3387 | struct xpay *xpay = xpay_of(plugin); |
| 3388 | struct out_req *req; |
| 3389 | |
| 3390 | xpay->global_gossmap = gossmap_load(xpay, |
| 3391 | GOSSIP_STORE_FILENAME, |
| 3392 | plugin_gossmap_logcb, |
| 3393 | plugin); |
| 3394 | if (!xpay->global_gossmap) |
| 3395 | plugin_err(plugin, "Could not load gossmap %s: %s", |
| 3396 | GOSSIP_STORE_FILENAME, strerror(errno)); |
| 3397 | xpay->counter = 0; |
| 3398 | if (!pubkey_from_hexstr("02" "0000000000000000000000000000000000000000000000000000000000000001", 66, &xpay->fakenode)) |
| 3399 | abort(); |
| 3400 | |
| 3401 | /* Cannot use rpc_scan, as we intercept rpc_command: would block. */ |
| 3402 | req = jsonrpc_request_start(aux_command(init_cmd), "getchaininfo", |
| 3403 | getchaininfo_done, |
| 3404 | plugin_broken_cb, |
| 3405 | "getchaininfo"); |
| 3406 | json_add_u32(req->js, "last_height", 0); |
| 3407 | send_outreq(req); |
| 3408 | |
| 3409 | req = jsonrpc_request_start(aux_command(init_cmd), "getinfo", |
| 3410 | getinfo_done, |
| 3411 | plugin_broken_cb, |
| 3412 | "getinfo"); |
| 3413 | send_outreq(req); |
| 3414 | |
| 3415 | req = jsonrpc_request_start(aux_command(init_cmd), "askrene-create-layer", |
| 3416 | xpay_layer_created, |
| 3417 | plugin_broken_cb, |
| 3418 | "askrene-create-layer"); |
| 3419 | json_add_string(req->js, "layer", "xpay"); |
| 3420 | json_add_bool(req->js, "persistent", true); |
| 3421 | send_outreq(req); |
| 3422 | |
| 3423 | return NULL; |
| 3424 | } |
| 3425 | |
| 3426 | static const struct plugin_command commands[] = { |
| 3427 | { |
no test coverage detected