diff --git a/doc/lightning-pay.7 b/doc/lightning-pay.7 index 5e89cc4be..9b6e2cf53 100644 --- a/doc/lightning-pay.7 +++ b/doc/lightning-pay.7 @@ -2,12 +2,12 @@ .\" Title: lightning-pay .\" Author: [see the "AUTHOR" section] .\" Generator: DocBook XSL Stylesheets v1.79.1 -.\" Date: 02/05/2018 +.\" Date: 02/06/2018 .\" Manual: \ \& .\" Source: \ \& .\" Language: English .\" -.TH "LIGHTNING\-PAY" "7" "02/05/2018" "\ \&" "\ \&" +.TH "LIGHTNING\-PAY" "7" "02/06/2018" "\ \&" "\ \&" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -146,7 +146,7 @@ A routing failure object has the fields below: .sp -1 .IP \(bu 2.3 .\} -\fIorigin_index\fR\&. The index of the node along the route that reported the error\&. 0 for the first hop node, \-1 if the local node reported the error\&. +\fIerring_index\fR\&. The index of the node along the route that reported the error\&. 0 for the local node, 1 for the first hop, and so on\&. .RE .sp .RS 4 diff --git a/doc/lightning-pay.7.txt b/doc/lightning-pay.7.txt index c497ae886..30b665b32 100644 --- a/doc/lightning-pay.7.txt +++ b/doc/lightning-pay.7.txt @@ -52,9 +52,9 @@ The following error codes may occur: A routing failure object has the fields below: -* 'origin_index'. The index of the node along the route that - reported the error. 0 for the first hop node, -1 if the local - node reported the error. +* 'erring_index'. The index of the node along the route that + reported the error. 0 for the local node, 1 for the first + hop, and so on. * 'erring_node'. The hex string of the pubkey id of the node that reported the error. * 'erring_channel'. The short channel ID of the channel that diff --git a/doc/lightning-sendpay.7 b/doc/lightning-sendpay.7 index 06be452dd..93384d8c5 100644 --- a/doc/lightning-sendpay.7 +++ b/doc/lightning-sendpay.7 @@ -2,12 +2,12 @@ .\" Title: lightning-sendpay .\" Author: [see the "AUTHOR" section] .\" Generator: DocBook XSL Stylesheets v1.79.1 -.\" Date: 02/05/2018 +.\" Date: 02/06/2018 .\" Manual: \ \& .\" Source: \ \& .\" Language: English .\" -.TH "LIGHTNING\-SENDPAY" "7" "02/05/2018" "\ \&" "\ \&" +.TH "LIGHTNING\-SENDPAY" "7" "02/06/2018" "\ \&" "\ \&" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -137,7 +137,7 @@ A routing failure object has the fields below: .sp -1 .IP \(bu 2.3 .\} -\fIorigin_index\fR\&. The index of the node along the route that reported the error\&. 0 for the first hop node, \-1 if the local node reported the error\&. +\fIerring_index\fR\&. The index of the node along the route that reported the error\&. 0 for the local node, 1 for the first hop, and so on\&. .RE .sp .RS 4 diff --git a/doc/lightning-sendpay.7.txt b/doc/lightning-sendpay.7.txt index a0550e0f5..5863636a6 100644 --- a/doc/lightning-sendpay.7.txt +++ b/doc/lightning-sendpay.7.txt @@ -52,9 +52,9 @@ The following error codes may occur: A routing failure object has the fields below: -* 'origin_index'. The index of the node along the route that - reported the error. 0 for the first hop node, -1 if the local - node reported the error. +* 'erring_index'. The index of the node along the route that + reported the error. 0 for the local node, 1 for the first + hop, and so on. * 'erring_node'. The hex string of the pubkey id of the node that reported the error. * 'erring_channel'. The short channel ID of the channel that diff --git a/lightningd/pay.c b/lightningd/pay.c index 0bae35ce8..f8bb7dfb9 100644 --- a/lightningd/pay.c +++ b/lightningd/pay.c @@ -75,7 +75,7 @@ static void json_pay_success(struct lightningd *ld, } struct routing_failure { - int origin_index; + unsigned int erring_index; enum onion_type failcode; struct pubkey erring_node; struct short_channel_id erring_channel; @@ -100,7 +100,7 @@ json_pay_command_routing_failed(struct command *cmd, json_object_start(data, NULL); if (fail) { failure_code = fail->failcode; - json_add_snum(data, "origin_index", fail->origin_index); + json_add_num(data, "erring_index", fail->erring_index); json_add_num(data, "failcode", (unsigned) fail->failcode); json_add_hex(data, "erring_node", &fail->erring_node, sizeof(fail->erring_node)); @@ -203,7 +203,7 @@ immediate_routing_failure(const tal_t *ctx, assert(failcode); routing_failure = tal(ctx, struct routing_failure); - routing_failure->origin_index = -1; + routing_failure->erring_index = 0; routing_failure->failcode = failcode; routing_failure->erring_node = ld->id; routing_failure->erring_channel = *channel0; @@ -225,7 +225,7 @@ local_routing_failure(const tal_t *ctx, assert(hout->failcode); routing_failure = tal(ctx, struct routing_failure); - routing_failure->origin_index = -1; + routing_failure->erring_index = 0; routing_failure->failcode = hout->failcode; routing_failure->erring_node = ld->id; routing_failure->erring_channel = payment->route_channels[0]; @@ -295,7 +295,7 @@ remote_routing_failure(const tal_t *ctx, erring_node = &route_nodes[origin_index]; - routing_failure->origin_index = origin_index; + routing_failure->erring_index = (unsigned int) (origin_index + 1); routing_failure->failcode = failcode; routing_failure->erring_node = *erring_node; routing_failure->erring_channel = *erring_channel;