Commit Graph

750 Commits

Author SHA1 Message Date
Olaoluwa Osuntokun
b73a6e2c61
routing: if MaxShardAmt is set, then use that as a ceiling for our splits
In this commit, we thread through the necessary state to allow users to
set a max shard amount. If this value is set, then this'll effectively
serve as a ceiling for all our split attempts. If we need to split,
we'll first try to use `paymentAmt/2`, if that's bigger than
`MaxShardAmt, then we'll use the latter instead.

Ideally in the future we have a dynamic way to automatically set both
the `MaxShardAmt` as well as `MaxParts` for users. Until then exposing
these two new fields will allow us to experiment with setting them
automatically using the RPC interface, and also give users a bit more
control over how we attempt to route payments, akin to coin control for
on-chain payments.

Fixes #4730
2021-02-15 19:31:52 -08:00
Olaoluwa Osuntokun
7398e59927
lnrpc/routerrpc+routing: add new MaxShardAmt field to LightningPayment 2021-02-15 19:31:49 -08:00
Olaoluwa Osuntokun
7b0ea3c029
Merge pull request #4909 from carlaKC/mc-paramsapi
routing: allow runtime updates to mission control config
2021-02-10 18:51:53 -08:00
Johan T. Halseth
7e34132c53
routing: let graph methods take scheduler option 2021-02-10 23:54:03 +01:00
Olaoluwa Osuntokun
107f19a049
routing: add new TestPaymentAddrOnlyNoSplit test case
This test case ensures that we won't try to split payment if the dest
has the payment addr bit, but NOT the mpp optional/require bit.
2021-02-03 17:53:40 -08:00
Olaoluwa Osuntokun
27c1779757
routing: allow custom dest feature bits in integratedRoutingContext.testPayment
This is a preparatory commit for a new test to ensure that if a node
only has the TLV and payment addr feature bits, we don't try to split a
payment.
2021-02-03 17:53:32 -08:00
Olaoluwa Osuntokun
301f1a870e
Merge pull request #4924 from champo/check_payreq_multipart
routerrpc,routing: limit max parts if the invoice doesn't declare MPP support
2021-02-03 16:53:49 -08:00
Oliver Gugger
02267565fe
multi: unify code blocks in READMEs 2021-01-22 09:14:11 +01:00
carla
64dad77e2e
multi: add get and set mission control to routerrpc 2021-01-19 10:57:15 +02:00
carla
edac5bb868
routing: add getter and setter for mission control config 2021-01-19 10:57:14 +02:00
carla
e10e8f11de
routing: extract probability estimator cfg and add validation
In preparation for allowing live update of mc config, we extract our
probability estimator cfg for easy update and add validation.
2021-01-19 10:57:13 +02:00
carla
7b24b586a0
routing: move locking for ReportPaymentSuccess and ReportPaymentFailure
All of the other mission control exported functions acquire their locks
immediately, and do not lock in the subsequent unexported functions.
This commit moves the lock up for the report payment functions so that
mission control's config values are covered by this lock, in preparation
for allowing config to be updated at runtime. Moving this lock means
that we will hold the lock for the additional time it takes to store a
single result, AddResult, to the store.
2021-01-19 10:57:12 +02:00
carla
97442da8f7
routing: add string method for cfg 2021-01-19 10:57:11 +02:00
carla
0735d359b9
router: move self node out of config
We are going to use the config struct to allow getting and setting
of the mission control config in the commits that follow. Self node
is not something we want to change, so we move it out for better
separation.
2021-01-19 10:57:10 +02:00
Juan Pablo Civile
f574c150aa routing: limit max parts if the invoice doesn't declare MPP support 2021-01-15 14:56:32 -03:00
András Bánki-Horváth
669663bfc2
Merge pull request #4822 from bhandras/add_globalfeatures
routing: add missing features to NetworkNodeUpdate (and also depreacte GlobalFeatures)
2020-12-08 10:16:50 +01:00
Yong
582b164c46
kvdb: add timeout options for bbolt (#4787)
* mod: bump btcwallet version to accept db timeout

* btcwallet: add DBTimeOut in config

* kvdb: add database timeout option for bbolt

This commit adds a DBTimeout option in bbolt config. The relevant
functions walletdb.Open/Create are updated to use this config. In
addition, the bolt compacter also applies the new timeout option.

* channeldb: add DBTimeout in db options

This commit adds the DBTimeout option for channeldb. A new unit
test file is created to test the default options. In addition,
the params used in kvdb.Create inside channeldb_test is updated
with a DefaultDBTimeout value.

* contractcourt+routing: use DBTimeout in kvdb

This commit touches multiple test files in contractcourt and routing.
The call of function kvdb.Create and kvdb.Open are now updated with
the new param DBTimeout, using the default value kvdb.DefaultDBTimeout.

* lncfg: add DBTimeout option in db config

The DBTimeout option is added to db config. A new unit test is
added to check the default DB config is created as expected.

* migration: add DBTimeout param in kvdb.Create/kvdb.Open

* keychain: update tests to use DBTimeout param

* htlcswitch+chainreg: add DBTimeout option

* macaroons: support DBTimeout config in creation

This commit adds the DBTimeout during the creation of macaroons.db.
The usage of kvdb.Create and kvdb.Open in its tests are updated with
a timeout value using kvdb.DefaultDBTimeout.

* walletunlocker: add dbTimeout option in UnlockerService

This commit adds a new param, dbTimeout, during the creation of
UnlockerService. This param is then passed to wallet.NewLoader
inside various service calls, specifying a timeout value to be
used when opening the bbolt. In addition, the macaroonService
is also called with this dbTimeout param.

* watchtower/wtdb: add dbTimeout param during creation

This commit adds the dbTimeout param for the creation of both
watchtower.db and wtclient.db.

* multi: add db timeout param for walletdb.Create

This commit adds the db timeout param for the function call
walletdb.Create. It touches only the test files found in chainntnfs,
lnwallet, and routing.

* lnd: pass DBTimeout config to relevant services

This commit enables lnd to pass the DBTimeout config to the following
services/config/functions,
  - chainControlConfig
  - walletunlocker
  - wallet.NewLoader
  - macaroons
  - watchtower
In addition, the usage of wallet.Create is updated too.

* sample-config: add dbtimeout option
2020-12-07 15:31:49 -08:00
Andras Banki-Horvath
98c61be342
routing: add missing GlobalFeatures to NetworkNodeUpdate 2020-12-07 15:47:09 +01:00
Oliver Gugger
2edc3cf98f
multi: update to latest btcd version
With this commit we update btcd to the latest version which allows us to
specify the btcd binary we want to use when spinning up a new node.
2020-12-03 11:30:22 +01:00
Olaoluwa Osuntokun
7e298f1434
Merge pull request #3367 from cfromknecht/batched-graph-updates
Batched graph updates
2020-11-25 18:40:40 -08:00
Olaoluwa Osuntokun
d996607470
routing+lnrpc: extend BuildRoute to accept raw payAddr
In this commit, we extend the `BuildRoute` method and RPC on the router
sub-server to accept a raw payment address which will be included as
part of an MPP payload for the finla hop. This change actually also
allows users to craft their own MPP paths using BuildRoute+SendToRoute.
Our primary goal however, was to fix some broken itests since we now
require the payAddr to be present for ALL payments other than key send
payments.
2020-11-25 16:32:02 -08:00
Conner Fromknecht
e8c545e909
routing/router: increase validation barrier size to 1000
This allows for a 1000 different persistent operations to proceed
concurrently. Now that we are batching operations at the db level, the
average number of outstanding requests will be higher since the commit
latency has increased. To compensate, we allow for more outstanding
requests to keep the router busy while batches are constructed.
2020-11-24 16:40:10 -08:00
Johan T. Halseth
df049ad755
routing: promote shard logs on resume and terminal failure to Info 2020-11-24 14:59:39 +01:00
Johan T. Halseth
f8493a7522
routing: define errShardHandlerExiting 2020-11-24 14:59:39 +01:00
Andras Banki-Horvath
d89f51d1d0
multi: add reset closure to kvdb.Update
Similarly as with kvdb.View this commits adds a reset closure to the
kvdb.Update call in order to be able to reset external state if the
underlying db backend needs to retry the transaction.
2020-11-05 17:57:12 +01:00
Andras Banki-Horvath
2a358327f4
multi: add reset closure to kvdb.View
This commit adds a reset() closure to the kvdb.View function which will
be called before each retry (including the first) of the view
transaction. The reset() closure can be used to reset external state
(eg slices or maps) where the view closure puts intermediate results.
2020-11-05 17:57:12 +01:00
carla
c92b030652
multi: remove experimential build flag for assumechanvalid 2020-10-21 14:13:50 +02:00
Johan T. Halseth
90a59fe70f
router: call CleanStore on startup 2020-10-06 10:46:04 +02:00
Johan T. Halseth
d1a118388d
payment_control: remove unused Attempts field 2020-10-06 10:41:25 +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
Conner Fromknecht
6622c4814e
multi: enforce routing.MinCLTVDelta=18 for invoices + chanupd
This commit clamps all user-chosen CLTVs in LND to be at least 18, which
is the new conservative value used in the sepc. This minimum is applied
uniformly to forwarding CLTV deltas (via channel updates) as well as
final CLTV deltas for new invoices.
2020-07-24 13:13:56 -07:00
Olaoluwa Osuntokun
bdc0d875bc
Merge pull request #4327 from joostjager/stuck-payment-loop
routing: don't treat bad features as an unexpected error
2020-05-28 15:43:09 -07: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
Conner Fromknecht
d0d2ca403d
multi: rename ReadTx to RTx 2020-05-26 18:20:37 -07:00
Conner Fromknecht
2f84d1a819
Merge pull request #4280 from cfromknecht/read-for-each-node
channeldb: remove Tx arg from ForEachNode
2020-05-13 16:37:10 -07:00
Conner Fromknecht
90d3bf532d
channeldb+routing: remove tx arg for ForEachNode 2020-05-12 17:53:20 -07: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
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
Andras Banki-Horvath
556e3525ea misc: fix error formatting in multiple files 2020-04-24 19:15:08 +02:00
Andras Banki-Horvath
ebf058a2a5 routing: static check fix, time.Since instead of Now().Sub() 2020-04-24 19:15:08 +02:00
Andras Banki-Horvath
4773ae17d9 routing: remove unused code 2020-04-24 19:15:08 +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
7fc1938f10
routing: payment splitting pre-check
This commit reverts cb4cd49dc8d3b0255afe9ff29af9c46c2dbb2c98 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
805641adf5
routing: do not split payment if destination does not support mpp 2020-04-17 14:23:57 +02:00
Joost Jager
9bd7eb74b6
routing: add prefix logger for payment session 2020-04-17 14:23:55 +02:00