xpay: don't try to timeout things until after we have created xpay layer.

```
lightningd-1 2024-11-19T05:21:16.313Z DEBUG   lightningd: Looking for [askrene,layers]
lightningd-1 2024-11-19T05:21:16.314Z DEBUG   lightningd: Got [askrene,layers,xpay]
lightningd-1 2024-11-19T05:21:16.314Z DEBUG   lightningd: Printing
lightningd-1 2024-11-19T05:21:16.315Z **BROKEN** plugin-cln-xpay: askrene-age failed with {\"code\":-32602,\"message\":\"layer: Unknown layer: invalid token '\\\"xpay\\\"'\"}
lightningd-1 2024-11-19T05:21:16.318Z DEBUG   plugin-cln-askrene: datastore = {\"datastore\":[{\"key\":[\"askrene\",\"layers\",\"xpay\"],\"generation\":13,\"hex\":\"000300001000003f47af0100000000673c1fea010000000000d1b0d4000003000000000ce5066e0000000000673c1fea010000000000d1b0d400000300001000001a47050000000000673c1fea010000000000d1b0d400000300003f00005a72b40100000000673c1fea010000000000d1b0d400000300000000005a07e80100000000673c1fea010000000000d1b0d400000300001a0000e3564c0100000000673c1fea010000000000d1b0d40000030000e3000db69cf50000000000673c1fea0001000000000100637e\"}]}
lightningd-1 2024-11-19T05:21:16.318Z DEBUG   plugin-cln-askrene: Loaded level xpay (203 bytes)
lightningd-1 2024-11-19T05:21:16.391Z INFO    plugin-cln-xpay: Killing plugin: exited during normal operation
```

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2024-11-19 16:28:38 +10:30
parent 6c347a4050
commit 1380d36898

View File

@@ -1617,6 +1617,16 @@ static void start_aging_timer(struct plugin *plugin)
notleak(global_timer(plugin, time_from_sec(60), age_layer, NULL));
}
static struct command_result *xpay_layer_created(struct command *aux_cmd,
const char *method,
const char *buf,
const jsmntok_t *result,
void *unused)
{
start_aging_timer(aux_cmd->plugin);
return aux_command_done(aux_cmd);
}
static const char *init(struct command *init_cmd,
const char *buf UNUSED, const jsmntok_t *config UNUSED)
{
@@ -1656,14 +1666,13 @@ static const char *init(struct command *init_cmd,
send_outreq(req);
req = jsonrpc_request_start(aux_command(init_cmd), "askrene-create-layer",
ignore_and_complete,
xpay_layer_created,
plugin_broken_cb,
"askrene-create-layer");
json_add_string(req->js, "layer", "xpay");
json_add_bool(req->js, "persistent", true);
send_outreq(req);
start_aging_timer(plugin);
return NULL;
}