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

Function printwire_encoded_short_ids

devtools/print_wire.c:177–215  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

175}
176
177static bool printwire_encoded_short_ids(const u8 **cursor, size_t *plen, size_t len)
178{
179 struct short_channel_id *scids;
180 u8 *arr = fromwire_tal_arrn(tmpctx, cursor, plen, len);
181
182 if (!arr)
183 return false;
184
185 printf("[");
186 scids = decode_short_ids(tmpctx, arr);
187 if (scids) {
188 switch (arr[0]) {
189 case ARR_UNCOMPRESSED:
190 printf(" (UNCOMPRESSED)");
191 break;
192 case ARR_ZLIB_DEPRECATED:
193 printf(" (ZLIB)");
194 break;
195 default:
196 abort();
197 }
198 for (size_t i = 0; i < tal_count(scids); i++)
199 printf(" %s",
200 short_channel_id_to_str(tmpctx, &scids[i]));
201 } else {
202 /* If it was unknown, that's different from corrupt */
203 if (len == 0
204 || arr[0] == ARR_UNCOMPRESSED
205 || arr[0] == ARR_ZLIB_DEPRECATED) {
206 printf(" **CORRUPT**");
207 return true;
208 } else {
209 printf(" UNKNOWN:");
210 print_hexstring(cursor, plen, len);
211 }
212 }
213 printf(" ]\n");
214 return true;
215}
216
217bool printwire_u8_array(const char *fieldname, const u8 **cursor, size_t *plen, size_t len)
218{

Callers 1

printwire_u8_arrayFunction · 0.85

Calls 5

abortFunction · 0.85
short_channel_id_to_strFunction · 0.85
print_hexstringFunction · 0.85
fromwire_tal_arrnFunction · 0.50
decode_short_idsFunction · 0.50

Tested by

no test coverage detected