mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-22 08:34:20 +01:00
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>
This commit is contained in:
committed by
Christian Decker
parent
f5ced1ddd5
commit
8f8783c0e3
@@ -351,11 +351,22 @@ remote_routing_failure(const tal_t *ctx,
|
|||||||
report_to_gossipd = true;
|
report_to_gossipd = true;
|
||||||
else
|
else
|
||||||
report_to_gossipd = false;
|
report_to_gossipd = false;
|
||||||
} else
|
erring_node = &route_nodes[origin_index];
|
||||||
|
} else {
|
||||||
/* Report the *next* channel as failing. */
|
/* Report the *next* channel as failing. */
|
||||||
erring_channel = &route_channels[origin_index + 1];
|
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];
|
erring_node = &route_nodes[origin_index];
|
||||||
|
}
|
||||||
|
|
||||||
routing_failure->erring_index = (unsigned int) (origin_index + 1);
|
routing_failure->erring_index = (unsigned int) (origin_index + 1);
|
||||||
routing_failure->failcode = failcode;
|
routing_failure->failcode = failcode;
|
||||||
|
|||||||
@@ -1137,7 +1137,6 @@ def test_check_command(node_factory):
|
|||||||
sock.close()
|
sock.close()
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.xfail(strict=True)
|
|
||||||
def test_bad_onion(node_factory, bitcoind):
|
def test_bad_onion(node_factory, bitcoind):
|
||||||
"""Test that we get a reasonable error from sendpay when an onion is bad"""
|
"""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)
|
l1, l2, l3, l4 = node_factory.line_graph(4, wait_for_announce=True)
|
||||||
|
|||||||
Reference in New Issue
Block a user