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

Function printwire_encoded_short_ids

devtools/print_wire.c:228–266  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

226}
227
228static bool printwire_encoded_short_ids(const u8 **cursor, size_t *plen, size_t len)
229{
230 struct short_channel_id *scids;
231 u8 *arr = fromwire_tal_arrn(tmpctx, cursor, plen, len);
232
233 if (!arr)
234 return false;
235
236 printf("[");
237 scids = decode_short_ids(tmpctx, arr);
238 if (scids) {
239 switch (arr[0]) {
240 case ARR_UNCOMPRESSED:
241 printf(" (UNCOMPRESSED)");
242 break;
243 case ARR_ZLIB_DEPRECATED:
244 printf(" (ZLIB)");
245 break;
246 default:
247 abort();
248 }
249 for (size_t i = 0; i < tal_count(scids); i++)
250 printf(" %s",
251 fmt_short_channel_id(tmpctx, scids[i]));
252 } else {
253 /* If it was unknown, that's different from corrupt */
254 if (len == 0
255 || arr[0] == ARR_UNCOMPRESSED
256 || arr[0] == ARR_ZLIB_DEPRECATED) {
257 printf(" **CORRUPT**");
258 return true;
259 } else {
260 printf(" UNKNOWN:");
261 print_hexstring(cursor, plen, len);
262 }
263 }
264 printf(" ]\n");
265 return true;
266}
267
268bool printwire_u8_array(const char *fieldname, const u8 **cursor, size_t *plen, size_t len)
269{

Callers 1

printwire_u8_arrayFunction · 0.85

Calls 5

decode_short_idsFunction · 0.85
abortFunction · 0.85
fmt_short_channel_idFunction · 0.85
print_hexstringFunction · 0.85
fromwire_tal_arrnFunction · 0.50

Tested by

no test coverage detected