Commit Graph

38 Commits

Author SHA1 Message Date
Christian Decker 2d95ed738e pay: Use `locktime_max` as maximum cumulative CLTV delta
Proposed by @rustyrussell.
Fixes #1586

Signed-off-by: Christian Decker <decker.christian@gmail.com>
2018-06-18 12:31:28 +02:00
Mark Beckwith 7f437715d5 Added error code parameter to command_fail
Until now, `command_fail()` reported an error code of -1 for all uses.
This PR adds an `int code` parameter to `command_fail()`, requiring the
caller to explicitly include the error code.

This is part of #1464.

The majority of the calls are used during parameter validation and
their error code is now JSONRPC2_INVALID_PARAMS.

The rest of the calls report an error code of LIGHTNINGD, which I defined to
-1 in `jsonrpc_errors.h`.  The intention here is that as we improve our error
reporting, all occurenaces of LIGHTNINGD will go away and we can eventually
remove it.

I also converted calls to `command_fail_detailed()` that took a `NULL` `data`
parameter to use the new `command_fail()`.

The only difference from an end user perspecive is that bad input errors that
used to be -1 will now be -32602 (JSONRPC2_INVALID_PARAMS).
2018-05-26 12:17:36 +02:00
conanoc c20e859f05 Modify comments about the precision 2018-05-26 12:16:50 +02:00
ZmnSCPxj c79b3de4d6 payalgo: Report reason to delay before clearing try memory.
We allocate the reason to delay, if any, from the `pay->try_parent`.
So we should not clear the `pay->try_parent` until after we print
the reason.
2018-05-08 07:08:37 +00:00
ZmnSCPxj 774af5f817 payalgo: Describe `maxdelay` argument of `pay`. 2018-04-17 17:29:36 +02:00
ZmnSCPxj, ZmnSCPxj jxPCSmnZ 11ca729d85 wallet, payalgo: Save detail of payment failures for later reporting. (#1345)
Pointless for remote failures as those are never sent by
the erring node, but for local failures we can give more
detail.
2018-04-16 15:29:40 +02:00
ZmnSCPxj 86290b54d4 routing: Use 64-bit msatoshi for messages to and from routing.
Internally both payment and routing use 64-bit, but the interface
between them used 32-bit.
Since both components already support 64-bit we should use that.
2018-04-09 20:45:26 +02:00
ZmnSCPxj 5a267eb831 pay, payalgo: Show erring_node as compressed DER pubkey.
For consistency with other node pubkeys.
2018-04-04 14:17:07 +02:00
ZmnSCPxj 26f7014813 payalgo: Add maximum delay.
Fixes: #1086
2018-04-03 04:29:48 +00:00
ZmnSCPxj c1a43a04af payalgo: Be willing to overpay up to maxfeepercent, for privacy.
This obscures how far an intermediate hop is from the ultimate
payee, and also obscures slightly the exact payment value.

Fixes: #1089
2018-03-30 15:40:32 +02:00
ZmnSCPxj bc5fc692d1 pay: Let `sendpay` modify the recorded `msatoshi` of payments. 2018-03-30 15:40:32 +02:00
practicalswift 7e9750ffee Reduce variable scopes 2018-03-26 01:31:21 +00:00
ZmnSCPxj 9efe123a0d lightningd/json: Move json helpers specific for lightningd to new module. 2018-03-19 00:27:55 +00:00
ZmnSCPxj 881eb80f6a payalgo: Make 'pay' return similar to 'listpayments' 2018-03-19 00:27:55 +00:00
ZmnSCPxj d181ecbeea payalgo: Implement retry_for for pay command. 2018-03-19 00:27:55 +00:00
ZmnSCPxj 981af478f1 payalgo: Keep and report route and route failures. 2018-03-19 00:27:55 +00:00
Rusty Russell 0a6e3d1e13 utils: remove tal_tmpctx altogether, use global.
In particular, we now only free tmpctx at the end of main().

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-03-16 00:16:10 +00:00
ZmnSCPxj a0c2686ebd pay: Have sendpay wait for payment to be saved.
The payment should be stored in a "timely" manner, i.e.
within 10ms.
2018-03-14 05:33:09 +00:00
ZmnSCPxj 1e4adb0359 pay: Make sendpay nonblocking. 2018-03-14 05:33:09 +00:00
Corné Plooy b857b2e843 Add assertions in various places to ensure tal_fmt doesn't receive NULL as argument for strings. 2018-03-06 19:26:21 +01:00
ZmnSCPxj 8e8d7c2aba pay/sendpay: Use spec names for rhash and r. 2018-03-05 20:21:37 +00:00
ZmnSCPxj 1f6008689d payalgo: Throttle pay command if failure is due to blockheight disagreement. 2018-03-03 18:19:53 +01:00
ZmnSCPxj 73cda2f2ae payalgo: Report route, and result of trying route. 2018-02-27 13:38:32 +01:00
ZmnSCPxj 21cfec816d payalgo: Report number of tries on failure. 2018-02-27 13:38:32 +01:00
ZmnSCPxj 6c9d81ef42 payalgo: Remove reporting PAY_TRY_ANOTHER_ROUTE and PAY_UNPARSEABLE_ONION.
These error codes will cause `pay` to retry, so `pay` will never
actually report those error codes.
Those error codes will only get reported at the `sendpay` level.
2018-02-27 13:38:32 +01:00
Rusty Russell cf3f19524e gossip: formalize passing of siphash_seed.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-02-26 06:35:02 +00:00
ZmnSCPxj d23650d2ed Explain fuzz initial values. 2018-02-26 02:36:27 +00:00
ZmnSCPxj 6767434ea9 routing: Use siphash24 for route randomization
Primary idea by @rustyrussell
2018-02-26 02:36:27 +00:00
ZmnSCPxj 61d0b50c54 payalgo: Randomize paths as long as we respect maxfeepercent. 2018-02-26 02:36:27 +00:00
ZmnSCPxj 9693843141 payalgo: Change sendpay_parent to try_parent.
Now try_parent is used as the parent for all allocations needed
  for a try.
2018-02-26 02:36:27 +00:00
ZmnSCPxj 216c52940d gossipd: Add fuzz and seed to getroute request. 2018-02-26 02:36:27 +00:00
practicalswift 91a9c2923f Mark intentionally unused parameters as such (with "UNUSED") 2018-02-22 01:09:12 +00:00
practicalswift 3dbace3421 Remove redundant casts to same type 2018-02-21 13:07:40 +01:00
Rusty Russell e92b710406 tools/generate-wire.py: remove length argument from fromwire_ routines.
We always hand in "NULL" (which means use tal_len on the msg), except
for two places which do that manually for no good reason.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-02-20 22:36:21 +01:00
practicalswift f351417905 Add assertions to clarify our assumptions about msg != NULL 2018-02-19 12:17:55 +01:00
ZmnSCPxj 38535fc36c payalgo: Create a new failure for paying expired invoice. 2018-02-18 13:51:37 +01:00
ZmnSCPxj 4ad1021c2c payalgo: Repeat pay command if possible.
Fixes: #863
2018-02-16 13:08:29 +01:00
ZmnSCPxj fda26bdcda payalgo: New file for pay command. 2018-02-16 13:08:29 +01:00