From f21cb57d27c1f6d69e02258a7efca66e411929c5 Mon Sep 17 00:00:00 2001 From: ZmnSCPxj Date: Sat, 3 Feb 2018 11:20:24 +0000 Subject: [PATCH] pay: Also treat nonexistent peer as immediate routing failure. --- lightningd/pay.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lightningd/pay.c b/lightningd/pay.c index 6c5b613b7..8e67b59d0 100644 --- a/lightningd/pay.c +++ b/lightningd/pay.c @@ -434,6 +434,13 @@ static bool send_payment(struct command *cmd, peer = peer_by_id(cmd->ld, &ids[0]); if (!peer) { + /* Report routing failure to gossipd */ + fail = immediate_routing_failure(cmd, cmd->ld, + WIRE_UNKNOWN_NEXT_PEER, + &route[0].channel_id); + report_routing_failure(cmd->ld->log, cmd->ld->gossip, fail); + + /* Report routing failure to user */ command_fail(cmd, "No connection to first peer found"); return false; } @@ -458,7 +465,7 @@ static bool send_payment(struct command *cmd, &route[0].channel_id); report_routing_failure(cmd->ld->log, cmd->ld->gossip, fail); - /* Repor routing failure to user */ + /* Report routing failure to user */ command_fail(cmd, "First peer not ready: %s", onion_type_name(failcode)); return false;