| 363 | } |
| 364 | |
| 365 | static 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 | |
| 394 | static const struct plugin_notification notifs[] = { |
| 395 | { |
nothing calls this directly
no test coverage detected