From 02e44e99038f2d5932f078592f29ffac8616f61e Mon Sep 17 00:00:00 2001 From: Christian Decker Date: Mon, 6 Jul 2020 22:39:04 +0200 Subject: [PATCH] paymod: Set the STOPPED_RETRYING status code if we stopped retrying --- plugins/libplugin-pay.c | 6 ++++-- tests/test_misc.py | 2 +- tests/test_pay.py | 2 -- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/plugins/libplugin-pay.c b/plugins/libplugin-pay.c index 93758665c..bb0a753ad 100644 --- a/plugins/libplugin-pay.c +++ b/plugins/libplugin-pay.c @@ -24,6 +24,7 @@ struct payment *payment_new(tal_t *ctx, struct command *cmd, p->label = NULL; p->failreason = NULL; p->getroute->riskfactorppm = 10000000; + p->abort = false; /* Copy over the relevant pieces of information. */ if (parent != NULL) { @@ -45,7 +46,6 @@ struct payment *payment_new(tal_t *ctx, struct command *cmd, p->plugin = cmd->plugin; p->channel_hints = tal_arr(p, struct channel_hint, 0); p->excluded_nodes = tal_arr(p, struct node_id, 0); - p->abort = false; } /* Initialize all modifier data so we can point to the fields when @@ -714,6 +714,7 @@ payment_waitsendpay_finished(struct command *cmd, const char *buffer, break; case WIRE_INCORRECT_OR_UNKNOWN_PAYMENT_DETAILS: + p->result->code = PAY_DESTINATION_PERM_FAIL; case WIRE_MPP_TIMEOUT: /* These are permanent failures that should abort all of our * attempts right away. We'll still track pending partial @@ -1327,7 +1328,7 @@ static bool payment_can_retry(struct payment *p) static inline void retry_step_cb(struct retry_mod_data *rd, struct payment *p) { - struct payment *subpayment; + struct payment *subpayment, *root = payment_root(p); struct retry_mod_data *rdata = payment_mod_retry_get_data(p); struct timeabs now = time_now(); @@ -1341,6 +1342,7 @@ static inline void retry_step_cb(struct retry_mod_data *rd, "%s/%d", type_to_string(tmpctx, struct sha256, p->payment_hash), p->partid); + root->abort = true; return payment_continue(p); } diff --git a/tests/test_misc.py b/tests/test_misc.py index 70b830b3f..2f201addb 100644 --- a/tests/test_misc.py +++ b/tests/test_misc.py @@ -1401,7 +1401,7 @@ def test_htlc_send_timeout(node_factory, bitcoind, compat): err = excinfo.value # Complains it stopped after several attempts. # FIXME: include in pylightning - PAY_STOPPED_RETRYING = 210 if compat('090') else 205 + PAY_STOPPED_RETRYING = 210 assert err.error['code'] == PAY_STOPPED_RETRYING status = only_one(l1.rpc.call('paystatus')['pay']) diff --git a/tests/test_pay.py b/tests/test_pay.py index b7fd2df74..43397b473 100644 --- a/tests/test_pay.py +++ b/tests/test_pay.py @@ -1680,8 +1680,6 @@ def test_pay_routeboost(node_factory, bitcoind, compat): 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) - PAY_ROUTE_NOT_FOUND = 205 - # This should a "could not find a route" because that's true. error = r'Ran out of routes'