Browse Source

pay: correctly blame the *next* node on BADONION error.

The node which sent the error is doing so because the following
one sent WIRE_UPDATE_FAIL_MALFORMED_HTLC.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
pr-2218
Rusty Russell 6 years ago
committed by Christian Decker
parent
commit
8f8783c0e3
  1. 13
      lightningd/pay.c
  2. 1
      tests/test_misc.py

13
lightningd/pay.c

@ -351,11 +351,22 @@ remote_routing_failure(const tal_t *ctx,
report_to_gossipd = true;
else
report_to_gossipd = false;
} else
erring_node = &route_nodes[origin_index];
} else {
/* Report the *next* channel as failing. */
erring_channel = &route_channels[origin_index + 1];
/* If the error is a BADONION, then it's on behalf of the
* following node. */
if (failcode & BADONION) {
log_debug(log, "failcode %u => erring_node %s",
failcode,
type_to_string(tmpctx, struct pubkey,
&route_nodes[origin_index + 1]));
erring_node = &route_nodes[origin_index + 1];
} else
erring_node = &route_nodes[origin_index];
}
routing_failure->erring_index = (unsigned int) (origin_index + 1);
routing_failure->failcode = failcode;

1
tests/test_misc.py

@ -1137,7 +1137,6 @@ def test_check_command(node_factory):
sock.close()
@pytest.mark.xfail(strict=True)
def test_bad_onion(node_factory, bitcoind):
"""Test that we get a reasonable error from sendpay when an onion is bad"""
l1, l2, l3, l4 = node_factory.line_graph(4, wait_for_announce=True)

Loading…
Cancel
Save