onion: Print the extracted channel_update and onionreply to debug

This adds one line with the onion and the channel_update we extract from
it. This in turn allows us to check that the channel_update in the onion is not
type prefixed, and that we patch it correctly before passing it to gossipd.
This commit is contained in:
Christian Decker
2018-07-30 18:01:34 +02:00
committed by Rusty Russell
parent 6bbea741d1
commit d3edfc8028
3 changed files with 19 additions and 3 deletions

View File

@@ -297,7 +297,8 @@ remote_routing_failure(const tal_t *ctx,
bool *p_retry_plausible,
bool *p_report_to_gossipd,
const struct wallet_payment *payment,
const struct onionreply *failure)
const struct onionreply *failure,
struct log *log)
{
enum onion_type failcode = fromwire_peektype(failure->msg);
u8 *channel_update;
@@ -318,6 +319,11 @@ remote_routing_failure(const tal_t *ctx,
channel_update
= channel_update_from_onion_error(routing_failure,
failure->msg);
if (channel_update)
log_debug(log, "Extracted channel_update %s from onionreply %s",
tal_hex(tmpctx, channel_update),
tal_hex(tmpctx, failure->msg));
retry_plausible = true;
report_to_gossipd = true;
@@ -521,7 +527,8 @@ void payment_failed(struct lightningd *ld, const struct htlc_out *hout,
fail = remote_routing_failure(tmpctx,
&retry_plausible,
&report_to_gossipd,
payment, reply);
payment, reply,
hout->key.channel->log);
}
}