mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-01-18 05:12:45 +01:00
peer: log unexpected packets properly.
And only try to print the contents if they're PKT_ERR. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
4801f78aad
commit
f00ee00fd8
@ -2365,6 +2365,12 @@ void peer_unexpected_pkt(struct peer *peer, const Pkt *pkt)
|
||||
{
|
||||
const char *p;
|
||||
|
||||
log_unusual(peer->log, "Received unexpected pkt %u (%s)",
|
||||
pkt->pkt_case, pkt_name(pkt->pkt_case));
|
||||
|
||||
if (pkt->pkt_case != PKT__PKT_ERROR)
|
||||
return;
|
||||
|
||||
/* Check packet for weird chars. */
|
||||
for (p = pkt->error->problem; *p; p++) {
|
||||
if (cisprint(*p))
|
||||
@ -2372,11 +2378,11 @@ void peer_unexpected_pkt(struct peer *peer, const Pkt *pkt)
|
||||
|
||||
p = tal_hexstr(peer, pkt->error->problem,
|
||||
strlen(pkt->error->problem));
|
||||
log_unusual(peer->log, "Error pkt (hex) %s", p);
|
||||
log_add(peer->log, "hex: %s", p);
|
||||
tal_free(p);
|
||||
return;
|
||||
}
|
||||
log_unusual(peer->log, "Error pkt '%s'", pkt->error->problem);
|
||||
log_add(peer->log, "'%s'", pkt->error->problem);
|
||||
}
|
||||
|
||||
/* Create a bitcoin close tx, using last signature they sent. */
|
||||
|
Loading…
Reference in New Issue
Block a user