Helper to fetch out SCB from the RPC call */
| 28 | |
| 29 | /* Helper to fetch out SCB from the RPC call */ |
| 30 | static bool json_to_scb_chan(const char *buffer, |
| 31 | const jsmntok_t *tok, |
| 32 | struct scb_chan ***channels) |
| 33 | { |
| 34 | size_t i; |
| 35 | const jsmntok_t *t; |
| 36 | *channels = tok->size ? tal_arr(tmpctx, |
| 37 | struct scb_chan *, |
| 38 | tok->size) : NULL; |
| 39 | |
| 40 | json_for_each_arr(i, t, tok) { |
| 41 | const u8 *scb_tmp = tal_hexdata(tmpctx, |
| 42 | json_strdup(tmpctx, |
| 43 | buffer, |
| 44 | t), |
| 45 | strlen(json_strdup(tmpctx, |
| 46 | buffer, |
| 47 | t))); |
| 48 | size_t scblen_tmp = tal_count(scb_tmp); |
| 49 | |
| 50 | (*channels)[i] = fromwire_scb_chan(tmpctx, |
| 51 | &scb_tmp, |
| 52 | &scblen_tmp); |
| 53 | } |
| 54 | |
| 55 | return true; |
| 56 | } |
| 57 | |
| 58 | /* This writes encrypted static backup in the recovery file */ |
| 59 | static void write_scb(struct plugin *p, |
no test coverage detected