mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-01-18 21:35:11 +01:00
devtools: in decodemsg, add newline and fix decoding a node_announcement with tlvs
Terminal prompt got messed up because missing newline in case of empty fields. printwire_addresses expected it to be the last field, which is not the case of a node_announcement with tlv
This commit is contained in:
parent
05bd62fee4
commit
760c271381
@ -78,5 +78,6 @@ int main(int argc, char *argv[])
|
||||
tal_free(m);
|
||||
}
|
||||
}
|
||||
printf("\n");
|
||||
return 0;
|
||||
}
|
||||
|
@ -85,14 +85,18 @@ hexdump:
|
||||
static void printwire_addresses(const u8 **cursor, size_t *plen, size_t len)
|
||||
{
|
||||
struct wireaddr addr;
|
||||
size_t to_go = len;
|
||||
const size_t len_ref = *plen;
|
||||
|
||||
printf("[");
|
||||
while (*plen && fromwire_wireaddr(cursor, plen, &addr))
|
||||
while (to_go && fromwire_wireaddr(cursor, plen, &addr)) {
|
||||
to_go = len - (len_ref - *plen);
|
||||
printf(" %s", fmt_wireaddr(NULL, &addr));
|
||||
}
|
||||
if (!*cursor)
|
||||
return;
|
||||
|
||||
if (*plen != 0) {
|
||||
if (to_go) {
|
||||
printf(" UNKNOWN:");
|
||||
if (!print_hexstring(cursor, plen, len))
|
||||
return;
|
||||
|
Loading…
Reference in New Issue
Block a user