Helper to fetch out SCB from the RPC call */
| 109 | |
| 110 | /* Helper to fetch out SCB from the RPC call */ |
| 111 | static bool json_to_scb_chan(const char *buffer, |
| 112 | const jsmntok_t *tok, |
| 113 | struct modern_scb_chan ***channels) |
| 114 | { |
| 115 | size_t i; |
| 116 | const jsmntok_t *t; |
| 117 | *channels = tok->size ? tal_arr(tmpctx, |
| 118 | struct modern_scb_chan *, |
| 119 | tok->size) : NULL; |
| 120 | |
| 121 | json_for_each_arr(i, t, tok) { |
| 122 | const u8 *scb_tmp = tal_hexdata(tmpctx, |
| 123 | json_strdup(tmpctx, |
| 124 | buffer, |
| 125 | t), |
| 126 | strlen(json_strdup(tmpctx, |
| 127 | buffer, |
| 128 | t))); |
| 129 | size_t scblen_tmp = tal_count(scb_tmp); |
| 130 | |
| 131 | (*channels)[i] = fromwire_modern_scb_chan(tmpctx, |
| 132 | &scb_tmp, |
| 133 | &scblen_tmp); |
| 134 | } |
| 135 | |
| 136 | return true; |
| 137 | } |
| 138 | |
| 139 | /* This writes encrypted static backup in the recovery file */ |
| 140 | static void write_scb(struct plugin *p, |
no test coverage detected