mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-01-18 05:12:45 +01:00
lightningd: handle bad failure message.
We used to core dump if unwrap_onionreply() returned NULL! Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
55510ea27a
commit
f4d92813a0
@ -1187,10 +1187,15 @@ static int peer_failed_htlc(struct peer *peer, const u8 *msg)
|
|||||||
shared_secrets[i] = hend->path_secrets[i];
|
shared_secrets[i] = hend->path_secrets[i];
|
||||||
}
|
}
|
||||||
reply = unwrap_onionreply(msg, shared_secrets, numhops, reason);
|
reply = unwrap_onionreply(msg, shared_secrets, numhops, reason);
|
||||||
|
if (!reply) {
|
||||||
|
log_info(peer->log, "htlc %"PRIu64" failed with bad reply (%s)",
|
||||||
|
id, tal_hex(msg, msg));
|
||||||
|
failcode = WIRE_PERMANENT_NODE_FAILURE;
|
||||||
|
} else {
|
||||||
failcode = fromwire_peektype(reply->msg);
|
failcode = fromwire_peektype(reply->msg);
|
||||||
log_info(peer->log, "htlc %"PRIu64" failed with code 0x%04x (%s)",
|
log_info(peer->log, "htlc %"PRIu64" failed with code 0x%04x (%s)",
|
||||||
id, failcode, onion_type_name(failcode));
|
id, failcode, onion_type_name(failcode));
|
||||||
|
}
|
||||||
payment_failed(peer->ld, hend, NULL, failcode);
|
payment_failed(peer->ld, hend, NULL, failcode);
|
||||||
}
|
}
|
||||||
tal_free(hend);
|
tal_free(hend);
|
||||||
|
Loading…
Reference in New Issue
Block a user