mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-19 15:14:23 +01:00
paymod: Set the STOPPED_RETRYING status code if we stopped retrying
This commit is contained in:
committed by
Rusty Russell
parent
5776a33116
commit
02e44e9903
@@ -24,6 +24,7 @@ struct payment *payment_new(tal_t *ctx, struct command *cmd,
|
|||||||
p->label = NULL;
|
p->label = NULL;
|
||||||
p->failreason = NULL;
|
p->failreason = NULL;
|
||||||
p->getroute->riskfactorppm = 10000000;
|
p->getroute->riskfactorppm = 10000000;
|
||||||
|
p->abort = false;
|
||||||
|
|
||||||
/* Copy over the relevant pieces of information. */
|
/* Copy over the relevant pieces of information. */
|
||||||
if (parent != NULL) {
|
if (parent != NULL) {
|
||||||
@@ -45,7 +46,6 @@ struct payment *payment_new(tal_t *ctx, struct command *cmd,
|
|||||||
p->plugin = cmd->plugin;
|
p->plugin = cmd->plugin;
|
||||||
p->channel_hints = tal_arr(p, struct channel_hint, 0);
|
p->channel_hints = tal_arr(p, struct channel_hint, 0);
|
||||||
p->excluded_nodes = tal_arr(p, struct node_id, 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
|
/* 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;
|
break;
|
||||||
|
|
||||||
case WIRE_INCORRECT_OR_UNKNOWN_PAYMENT_DETAILS:
|
case WIRE_INCORRECT_OR_UNKNOWN_PAYMENT_DETAILS:
|
||||||
|
p->result->code = PAY_DESTINATION_PERM_FAIL;
|
||||||
case WIRE_MPP_TIMEOUT:
|
case WIRE_MPP_TIMEOUT:
|
||||||
/* These are permanent failures that should abort all of our
|
/* These are permanent failures that should abort all of our
|
||||||
* attempts right away. We'll still track pending partial
|
* 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,
|
static inline void retry_step_cb(struct retry_mod_data *rd,
|
||||||
struct payment *p)
|
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 retry_mod_data *rdata = payment_mod_retry_get_data(p);
|
||||||
struct timeabs now = time_now();
|
struct timeabs now = time_now();
|
||||||
|
|
||||||
@@ -1341,6 +1342,7 @@ static inline void retry_step_cb(struct retry_mod_data *rd,
|
|||||||
"%s/%d",
|
"%s/%d",
|
||||||
type_to_string(tmpctx, struct sha256, p->payment_hash),
|
type_to_string(tmpctx, struct sha256, p->payment_hash),
|
||||||
p->partid);
|
p->partid);
|
||||||
|
root->abort = true;
|
||||||
return payment_continue(p);
|
return payment_continue(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1401,7 +1401,7 @@ def test_htlc_send_timeout(node_factory, bitcoind, compat):
|
|||||||
err = excinfo.value
|
err = excinfo.value
|
||||||
# Complains it stopped after several attempts.
|
# Complains it stopped after several attempts.
|
||||||
# FIXME: include in pylightning
|
# FIXME: include in pylightning
|
||||||
PAY_STOPPED_RETRYING = 210 if compat('090') else 205
|
PAY_STOPPED_RETRYING = 210
|
||||||
assert err.error['code'] == PAY_STOPPED_RETRYING
|
assert err.error['code'] == PAY_STOPPED_RETRYING
|
||||||
|
|
||||||
status = only_one(l1.rpc.call('paystatus')['pay'])
|
status = only_one(l1.rpc.call('paystatus')['pay'])
|
||||||
|
|||||||
@@ -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)
|
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)
|
||||||
|
|
||||||
PAY_ROUTE_NOT_FOUND = 205
|
|
||||||
|
|
||||||
# This should a "could not find a route" because that's true.
|
# This should a "could not find a route" because that's true.
|
||||||
error = r'Ran out of routes'
|
error = r'Ran out of routes'
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user