Commit Graph
100 Commits
Author SHA1 Message Date
Joost Jager 49df2d6f8b lnrpc: expose forwarding channel for htlcs in ListChannels 2020-10-16 09:03:24 +02:00
Joost Jager d13b813dbb lnrpc: add htlc index to ListChannels pending htlcs 2020-10-14 17:44:22 +02:00
Joost Jager 856abade3d routerrpc: map errors to grpc status code
The 'payment already exists' case is common in restart scenarios. With
this commit it is no longer necessary to string-match on the error
message. Implementation is identical to SendPaymentV2.
2020-10-14 16:15:08 +02:00
Joost Jager 2236813c95 htlcswitch: randomize non-strict forwarding 2020-09-29 11:05:53 +02:00
Joost Jager 6ae05c6bac Merge pull request #4592 from joostjager/sweep-deadline
cnct+sweep: cpfp-aware anchor sweeping
2020-09-18 20:15:03 +02:00
Joost Jager 29602e88e8 cnct: cpfp-sweep anchors
For unconfirmed commit tx anchors, supply the sweeper with cpfp info and
a confirmation target fee estimate.

The sweeper will try to pay for the parent commit tx as long as the
current fee estimate exceeds the pre-signed commit tx fee rate.
2020-09-17 12:30:41 +02:00
Joost Jager 681496b474 sweep: make sweeper aware of unconfirmed parent transactions.
Extend the fee estimator to take into account parent transactions with
their weights and fees.

Do not try to cpfp parent transactions that have a higher fee rate than
the sweep tx fee rate.
2020-09-17 12:30:39 +02:00
Joost Jager 3531c3fbbe Merge pull request #4602 from joostjager/proportional-attempt-cost
routing: proportional attempt cost
2020-09-16 14:12:19 +02:00
Joost Jager 3e3d8487fb sweep: wrap weight estimator
Preparation for a cpfp-aware weight estimator. For cpfp, a regular
weight estimator isn't sufficient, because it needs to take into account
the weight of the parent transaction(s) as well.
2020-09-16 11:49:22 +02:00
Joost Jager 2ebfb64b9b Merge pull request #4606 from joostjager/cpfp-sweep-prep
cnct+sweep+itest: preparations for cpfp-aware sweeper
2020-09-16 11:48:39 +02:00
Joost Jager 08bb8ec54e cnct: clear exclusive group on anchor sweep after confirmation
The sweeper call UpdateParams does not update the exclusive group
property of a pending sweep. This led to anchor outputs being swept
after confirmation with an exclusive group restriction, which is not
necessary.

This commit changes the anchor resolver to not use UpdateParams anymore,
but instead always re-offer the anchor input to the sweeper. The sweeper
is modified so that a re-offering also updates the sweep parameters.
2020-09-16 08:17:40 +02:00
Joost Jager 6df4fa84df sweep: clean up state mutation
The add function tries to add an input to the current set. It therefore
calculates what the new set would look like before actually adding. This
commit isolates the state of the tentative set so that there is less
opportunity for bugs to creep in.
2020-09-16 08:17:38 +02:00
Joost Jager cdbde5dd4c sweep: do not combine exclusive and non-exclusive inputs 2020-09-16 08:17:36 +02:00
Joost Jager b6ebf3f27d lntest: use web fee estimator in itests 2020-09-16 08:17:34 +02:00
Joost Jager cf6eee80db Merge pull request #2428 from joostjager/letsencrypt
lnrpc: let's encrypt certificates
2020-09-15 13:08:15 +02:00
Joost Jager fc3fd26a3d config: allow web fee estimation on regtest 2020-09-15 10:29:14 +02:00
Joost JagerandVegard Engen 403d72b468 lnrpc: lets encrypt
This commit enables lnd to request and renew a Let's Encrypt
certificate. This certificate is used both for the grpc as well as the
rest listeners. It allows clients to connect without having a copy of
the (public) server certificate.

Co-authored-by: Vegard Engen <vegard@engen.priv.no>
2020-09-15 09:59:09 +02:00
Joost Jager 999ffffa37 lnd: join imports to form three groups
In line with https://github.com/pavius/impi
2020-09-14 14:52:07 +02:00
Joost Jager dae0e2194d lnd: start fee estimator at a single point 2020-09-14 11:51:05 +02:00
Joost Jager 166be979dd lnwallet: add no cache option to web api estimator 2020-09-14 11:51:03 +02:00
Joost Jager 23cd2f40eb lnwallet: remove unused WebAPIEstimator field 2020-09-14 11:51:01 +02:00
Joost Jager bbfeeec8b1 routing: add proportional attempt cost 2020-09-08 15:47:08 +02:00
Joost Jager 60a22ff09d routing/test: parametrize test amount 2020-09-08 15:28:49 +02:00
Joost Jager 17a6175e8b routing+routerrpc: rename PaymentAttemptPenalty to AttemptCost
Make field names consistent with the command line flag.
2020-09-08 14:07:56 +02:00
Joost Jager 49edc045d8 Merge pull request #4461 from joostjager/anchor-vector-fix
lnwallet/test: extend anchor test vector set
2020-08-19 11:05:03 +02:00
Joost Jager f7d85555a4 lnwallet/test: add anchor vector for no local anchor 2020-08-19 08:44:04 +02:00
Joost Jager a682e3cb7e lnwallet/test: add anchor vector for no remote anchor 2020-08-19 08:44:02 +02:00
Joost Jager 793b21b79e lnwallet/test: make use of test htlcs explicit
Previously whether or not to add test htlcs was implictly controlled by
a nil value of the HtlcDescs test parameter. With the conversion to
json, that nil value got lost.

The reason that the test still passed is because with the fee rate of
the no-htlc test case, the htlcs were trimmed. Also because in the test
json, balances are specified after applying htlcs, the test didn't fail
with a mismatching balance.
2020-08-19 08:44:00 +02:00
Joost Jager f9c6a1b73f Merge pull request #4418 from joostjager/anchor-vectors
lnwallet/test: anchor vectors
2020-07-06 13:38:28 +02:00
Joost Jager 16577d7d0e lnwallet/test: anchor test vectors 2020-07-06 12:45:17 +02:00
Joost Jager 1c775d131b lnwallet/test: close database after test 2020-07-06 12:45:15 +02:00
Joost Jager c65f60b101 lnwallet/test: convert test vectors to json 2020-07-06 12:45:13 +02:00
Joost Jager 2903505164 htlcswitch: expose custom records on intercepted packet 2020-06-27 11:00:46 +02:00
Joost Jager 363142de33 htlcswitch: expose additional fields for intercepted packets 2020-06-27 11:00:44 +02:00
Joost Jager 74db43282c htlcswitch: encapsulate exposed packet info 2020-06-27 10:59:08 +02:00
Joost Jager 607927634d routerrpc: remove redundant htlc prefix from proto field
The message name already sets the context to an htlc.
2020-06-27 10:59:06 +02:00
Joost Jager f6f8e3221b routerrpc: clarify proto fields to be outgoing 2020-06-27 10:59:04 +02:00
Joost Jager 24e3234dfa invoices: optionally hold and auto-cancel keysend payments
Adds a new configuration flag to lnd that will keep keysend payments in
the accepted state. An application can then inspect the payment
parameters and decide whether to settle or cancel.

The on-the-fly inserted keysend invoices get a configurable expiry time.
This is a safeguard in case the application that should decide on the
keysend payments isn't active.
2020-06-27 09:54:11 +02:00
Joost Jager 8f2a2fc5da Merge pull request #4018 from breez/intercept-forward-htlc
Intercept forward htlc
2020-06-22 10:18:14 +02:00
Joost Jager f1fbdb1b84 lnwallet/test: remove unused index field 2020-06-17 22:59:14 +02:00
Joost Jager 24e1126776 lnwallet/test: reproduce test vectors in commit and htlc tx test
This commit changes the verification of our code against the spec test
vectors to use a more black box approach. It exercises the channel state
machine via its external interface as much as possible, making this test
more robust. A consequence of this is that the test now runs from the
'root' data from which the test vectors are also derived, meaning that
more code is covered too.

Running from the root data is also a preparation for _producing_ test
vectors for the new anchor commitment format. This will be a matter of
changing the channel type and recording the produced commitment and htlc
txes.

Previously the success transaction was skipped during verification. With
this commit, the proper preimage insertion is carried out, allowing the
success tx to be checked too.
2020-06-17 22:59:12 +02:00
Joost Jager 4a7cefdab3 Merge pull request #4264 from joostjager/itest-err-detector-doc
doc: describe usage of log levels
2020-06-16 16:33:50 +02:00
Joost Jager 4e945f6083 lnwallet/test: name test cases 2020-06-15 13:51:07 +02:00
Joost Jager 8b55c10e45 lnwallet/test: name testCase struct 2020-06-15 13:51:05 +02:00
Joost Jager 997bab0343 lnwallet/test: move htlcDesc struct 2020-06-15 13:51:03 +02:00
Joost Jager c27406b579 lnwallet/test: move test htlcs out of function 2020-06-15 13:51:01 +02:00
Joost Jager 98ec8bf502 lnwallet/test: move test cases out of function 2020-06-15 13:50:59 +02:00
Joost Jager 3b7f084509 lnwallet/test: remove impossible test case
In this test case, the funder cannot pay the commit fee.
2020-06-15 13:50:57 +02:00
Joost Jager 4421894c4c lnwallet/test: remove zero fee test case
This is currently not supported in lnd.
2020-06-15 13:50:55 +02:00
Joost Jager d1e049fa68 docs: describe log levels 2020-06-12 11:22:35 +02:00
Joost Jager 9f32942a90 Merge pull request #4334 from joostjager/hold-keysend-part1
invoices: add explicit hodl invoice flag
2020-06-02 10:59:47 +02:00
Joost Jager d416ed59ea multi: add explicit hodl invoice flag to invoice
Previously it wasn't possible to store a preimage in the invoice
database and signal that a payment should not be settled right away. The
only way to hold a payment was to insert the magic UnknownPreimage value
in the invoice database. This commit introduces a distinct flag to
signal that an invoice is a hold invoice and thereby allows the preimage
to be present in the database already.

Preparation for (key send) hodl invoices for which we already know the
preimage.
2020-06-02 07:34:23 +02:00
Joost Jager df7a05da84 rpcserver+routerrpc: remove payment limit 2020-05-28 19:34:17 +02:00
Joost Jager 24c865450a Merge pull request #4331 from cfromknecht/stray-read-bucket
channeldb/invoices: correct stray kvdb.ReadBucket to RBucket
2020-05-28 07:25:58 +02:00
Joost Jager 3ef68baf4a routing: don't treat bad features as an unexpected error
Previous behavior led to the payment loop being abandoned immediately,
resulting in a payment stuck in state in_flight.
2020-05-27 12:15:53 +02:00
Joost Jager a8d5c32983 Merge pull request #4132 from joostjager/itests-on-routerrpc
itest: switch over to routerrpc.SendPaymentV2
2020-05-22 08:56:10 +02:00
Joost Jager d2f6140818 itest: extend whitelist 2020-05-20 17:24:36 +02:00
Joost Jager e201ed8106 itest: switch over to routerrpc.SendPaymentV2 2020-05-20 17:23:52 +02:00
Joost Jager ca9c58aec9 Merge pull request #4183 from joostjager/sync-local-payment
htlcswitch: sync local payment hand-off to link
2020-05-20 11:23:15 +02:00
Joost Jager 8119dc7a88 htlcswitch: rename to getLocalLink
Align function name with the contained logic.
2020-05-20 08:03:52 +02:00
Joost Jager e00840e2ab htlcswitch: return local add failure to caller
Fixes a pre-existing issue where nil was returned when a failure had
occurred during commiting of the circuit.
2020-05-20 08:03:50 +02:00
Joost Jager c325bf8c57 htlcswitch: sync link hand-off
This commit extends the link with a new synchronous delivery point for
local UpdateAddHTLC messages. The switch method SendHTLC is updated to
use this delivery point and thereby becomes a synchronous call.

For MPP payments, synchronous hand-off is important. Otherwise the next
pathfinding round could start without the channel balance updated yet.
2020-05-20 08:03:48 +02:00
Joost Jager de2df5606a htlcswitch: extract handleDownstreamUpdateAdd in link
To be able to call just the UpdateAdd logic for synchronously handled
local adds in a later commit.
2020-05-20 08:03:46 +02:00
Joost Jager 55930df70d htlcswitch: update commit tx per downstream msg type
Unroll common code to allow splitting in separate handlers per message
type.
2020-05-20 08:03:44 +02:00
Joost Jager b559811bf5 htlcswitch: extract updateCommitTxOrFail in link
Deduplicate code and prepare for further split of
handleDownstreamPkt.
2020-05-20 08:03:42 +02:00
Joost Jager 7afb43a012 htlcswitch: bypass main loop for local sends
There is no concurrent access in this code path, so there is no need to
pass the call through the main event loop.
2020-05-20 08:03:40 +02:00
Joost Jager fe35d35458 htlcswitch: simplify local sends
Embed forward method into SendHTLC and remove redundant type check.
2020-05-20 08:03:38 +02:00
Joost Jager babb0a36b4 switch/test: use external interface for testing
Previously the forward(...) method was used in forwarding tests,
while that code path isn't used for forwards in reality.
2020-05-20 08:03:36 +02:00
Joost Jager 1bd211a722 Merge pull request #4147 from joostjager/unify-pay-responses
router+routerrpc: unify sendtoroute and payment responses
2020-05-13 20:36:14 +02:00
Joost Jager 341308327e htlcswitch: refactor handleLocalDispatch
Move creation of the goroutine as a preparation for sync local routing
2020-05-13 17:47:19 +02:00
Joost Jager 2d7c942d47 lnrpc: direct to SendPaymentV2 2020-05-12 19:57:02 +02:00
Joost Jager 5a56a6870e lnrpc: deprecate main SendToRoute rpc 2020-05-12 19:57:00 +02:00
Joost Jager 261588cc8e itest: switch over to routerrpc.SendToRouteV2 2020-05-12 19:56:58 +02:00
Joost Jager 0f6eacb4fa lncli: switch to routerrpc.SendToRouteV2 2020-05-12 19:56:56 +02:00
Joost Jager b6170788ea routerrpc: add SendToRouteV2 that returns an HTLCAttempt message
Unify data structure with SendPayment/ListPayments.
2020-05-12 19:56:54 +02:00
Joost Jager 674c199047 routing: return full htlc attempt from router 2020-05-12 19:56:52 +02:00
Joost Jager cc37485432 routing: return full htlc attempt from shard handler 2020-05-12 19:56:50 +02:00
Joost Jager 8e7c0757ec routerrpc: expose preimage on the htlc level 2020-05-12 19:56:49 +02:00
Joost Jager 7c4e57c53d lnwallet: return signer error 2020-05-12 13:33:50 +02:00
Joost Jager 185813abb1 Merge pull request #4257 from joostjager/multi-outgoing-chan-restriction
routing+routerrpc: add multiple outgoing channel restriction
2020-05-12 13:07:36 +02:00
Joost Jager 25a50b62fb itest: extend whitelist 2020-05-12 09:13:41 +02:00
Joost Jager c33d94ff27 routing+routerrpc: add multiple outgoing channel restriction 2020-05-12 07:17:24 +02:00
Joost Jager 53e4876a1d routing/test: add channel id constants 2020-05-12 07:17:22 +02:00
Joost Jager e1e4c8ef6b itest: extend whitelist 2020-05-08 13:40:31 +02:00
Joost Jager c0da0675c1 itest: add error detection explanation 2020-05-08 13:40:29 +02:00
Joost Jager 6f153d6eaa itest: extend whitelist 2020-05-06 21:21:51 +02:00
Joost Jager b59c0e1349 itest: add SendPaymentV2 to whitelist 2020-05-04 23:42:57 +02:00
Joost Jager 542e1466b1 itest: case insensitive log errors check 2020-05-04 22:20:24 +02:00
Joost Jager f6b2410011 routing+routerrpc: rename max_shards to max_parts
Don't introduce a new term and align with the P in MPP.
2020-04-22 14:49:19 +02:00
Joost Jager 8d7e07d96b lncli: live table-based payment updates 2020-04-22 14:49:17 +02:00
Joost Jager 6ffdf7ef1f lncli: live table-based payment updates 2020-04-21 17:02:15 -07:00
Joost Jager d51bb65536 routerrpc+lncli: add flag to suppress in-flight updates
This is a preparation for enabling the REST interface on routerrpc.
It provides REST clients that don't support server-side streaming
via keep-alive connections to use the streaming endpoint in the
typical request/response pattern. The url just needs to contain
?no_inflight_updates=true and only the terminal response is sent
back before the connection is closed.
2020-04-21 17:02:09 -07:00
Joost Jager 7fe100bcfb routerrpc: bring back legacy track and send rpcs
To soften the transition for routerrpc users to the V2 messages.
2020-04-21 20:37:45 +02:00
Joost Jager ad5f1404cb lnrpc: remove experimental tag from payment htlcs 2020-04-21 20:36:59 +02:00
Joost Jager d451ef4ee1 routerrpc: rename rpcs to SendPaymentV2 and TrackPaymentV2
The message in the response stream changed. Rename the calls themselves,
to prevent older applications from getting decode errors. Especially
troublesome is the case where the request is executed (send payment),
but the application can't read the outcome (payment sent or not?)
2020-04-21 20:36:58 +02:00
Joost Jager 1307a96624 itest: check for new errors in logs 2020-04-20 14:02:23 +02:00
Joost Jager 7b7edfbde6 fundingmanager: fix log 2020-04-20 14:02:21 +02:00
Joost Jager 7fc1938f10 routing: payment splitting pre-check
This commit reverts cb4cd49dc8 to bring
back the insufficient local balance failure.

Distinguishing betweeen this failure and a regular "no route" failure
prevents meaningless htlcs from being sent out.
2020-04-18 08:30:26 +02:00
Joost Jager f44a9e1d4c routing/test: make test channel capacities configurable 2020-04-17 15:56:19 +02:00
Joost Jager 9c4f9416d5 Merge pull request #4199 from joostjager/no-legacy-split
routing: do not split payment if destination does not support mpp
2020-04-17 15:54:43 +02:00