mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-23 09:04:22 +01:00
pay: don't say "Could not find a route" unless we never tried a payment.
It's deeply confusing: we say this after exhausting all other routes. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
@@ -199,6 +199,12 @@ static struct command_result *next_routehint(struct command *cmd,
|
|||||||
return command_fail(cmd, PAY_ROUTE_TOO_EXPENSIVE,
|
return command_fail(cmd, PAY_ROUTE_TOO_EXPENSIVE,
|
||||||
"%s", pc->expensive_route);
|
"%s", pc->expensive_route);
|
||||||
|
|
||||||
|
if (tal_count(pc->ps->attempts) > 1)
|
||||||
|
return command_fail(cmd, PAY_STOPPED_RETRYING,
|
||||||
|
"Ran out of routes to try after"
|
||||||
|
" %zu attempts: see paystatus",
|
||||||
|
tal_count(pc->ps->attempts));
|
||||||
|
|
||||||
return command_fail(cmd, PAY_ROUTE_NOT_FOUND,
|
return command_fail(cmd, PAY_ROUTE_NOT_FOUND,
|
||||||
"Could not find a route");
|
"Could not find a route");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1465,7 +1465,7 @@ def test_pay_retry(node_factory, bitcoind):
|
|||||||
# This should make it fail.
|
# This should make it fail.
|
||||||
exhaust_channel(l4, l5, scid45, 10**8)
|
exhaust_channel(l4, l5, scid45, 10**8)
|
||||||
|
|
||||||
with pytest.raises(RpcError):
|
with pytest.raises(RpcError, match=r'5 attempts'):
|
||||||
l1.rpc.pay(l5.rpc.invoice(10**8, 'test_retry2', 'test_retry2')['bolt11'])
|
l1.rpc.pay(l5.rpc.invoice(10**8, 'test_retry2', 'test_retry2')['bolt11'])
|
||||||
|
|
||||||
|
|
||||||
@@ -1475,6 +1475,11 @@ def test_pay_routeboost(node_factory, bitcoind):
|
|||||||
# l1->l2->l3--private-->l4
|
# l1->l2->l3--private-->l4
|
||||||
l1, l2 = node_factory.line_graph(2, announce_channels=True, wait_for_announce=True)
|
l1, l2 = node_factory.line_graph(2, announce_channels=True, wait_for_announce=True)
|
||||||
l3, l4, l5 = node_factory.line_graph(3, announce_channels=False, wait_for_announce=False)
|
l3, l4, l5 = node_factory.line_graph(3, announce_channels=False, wait_for_announce=False)
|
||||||
|
|
||||||
|
# This should a "could not find a route" because that's true.
|
||||||
|
with pytest.raises(RpcError, match=r'Could not find a route'):
|
||||||
|
l1.rpc.pay(l5.rpc.invoice(10**8, 'test_retry', 'test_retry')['bolt11'])
|
||||||
|
|
||||||
l2.rpc.connect(l3.info['id'], 'localhost', l3.port)
|
l2.rpc.connect(l3.info['id'], 'localhost', l3.port)
|
||||||
scidl2l3 = l2.fund_channel(l3, 10**6)
|
scidl2l3 = l2.fund_channel(l3, 10**6)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user