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

Function init

plugins/chanbackup.c:365–392  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

363}
364
365static const char *init(struct plugin *p,
366 const char *buf UNUSED,
367 const jsmntok_t *config UNUSED)
368{
369 struct scb_chan **scb_chan;
370 const char *info = "scb secret";
371 u8 *info_hex = tal_dup_arr(tmpctx, u8, (u8*)info, strlen(info), 0);
372
373 rpc_scan(p, "staticbackup",
374 take(json_out_obj(NULL, NULL, NULL)),
375 "{scb:%}", JSON_SCAN(json_to_scb_chan, &scb_chan));
376
377 rpc_scan(p, "makesecret",
378 take(json_out_obj(NULL, "hex",
379 tal_hexstr(tmpctx,
380 info_hex,
381 tal_bytelen(info_hex)))),
382 "{secret:%}", JSON_SCAN(json_to_secret, &secret));
383
384 plugin_log(p, LOG_DBG, "Chanbackup Initialised!");
385
386 /* flush the tmp file, if exists */
387 unlink_noerr("scb.tmp");
388
389 maybe_create_new_scb(p, scb_chan);
390
391 return NULL;
392}
393
394static const struct plugin_notification notifs[] = {
395 {

Callers

nothing calls this directly

Calls 7

rpc_scanFunction · 0.85
json_out_objFunction · 0.85
tal_hexstrFunction · 0.85
tal_bytelenFunction · 0.85
unlink_noerrFunction · 0.85
maybe_create_new_scbFunction · 0.85
plugin_logFunction · 0.70

Tested by

no test coverage detected