Commit Graph

448 Commits

Author SHA1 Message Date
Wilmer Paulino
99d9e3caeb server: use custom wtclient policy instead of default 2019-07-24 18:16:18 -07:00
Conner Fromknecht
807012f960
Merge pull request #3143 from Crypt-iQ/pipelining_settle_0525
htlcswitch: pipeline settles to switch
2019-07-19 18:12:59 -07:00
Olaoluwa Osuntokun
111cbeaa99
Merge pull request #3165 from halseth/autopilot-spend-coins
[funding+autopilot] Make the funding manager and autopilot fee aware
2019-07-18 20:45:49 -07:00
nsa
00814dc7c1 htlcswitch: pipeline settles to switch
This commit makes the outgoing link pipeline the settle to the
switch as soon as it receives it. Previously, it would wait for a
revocation before sending it, which caused increased latency on
payments as well as possibly never settling on the incoming link.
A duplicate settle is still sent to the switch, but it is handled
gracefully. A new AckEventTicker was added to the switch which
acknowledges any pending settle / fail entries in an outgoing
link's fwd pkgs in batch. This was needed in order to reduce the
number of db txn's which would have been incurred by acking whenever
we receive a duplicate settle without batching.
2019-07-18 17:20:40 -04:00
Joost Jager
34b264a3d8
routing: create PathFindingConfig for global parameters 2019-07-18 15:49:25 +02:00
Johan T. Halseth
b9816259cb
fundingmanager+server: define subtractFees
Let one initiate a funding request with the remaining funds in the
wallet.
2019-07-18 00:58:12 +02:00
Johan T. Halseth
e716251805
server+funding: remove unused remoteFundingAmt 2019-07-18 00:33:14 +02:00
Johan T. Halseth
452ee6aad4
fundingmanager+server: define MaxPendingChans. RejectPush in funding config
This commit makes the funding manager access the MaxPendingChannels and
RejectPush values from the fundingConfig instead of the global config
struct.

Done to avoid sharing state between tests.
2019-07-18 00:33:14 +02:00
Joost Jager
37e2751695
routing+routerrpc: isolate payment session source from mission control 2019-07-13 22:38:19 +02:00
Joost Jager
2b47632b26
htlcswitch+routing+routerrpc: return error source as index 2019-07-11 10:37:26 +02:00
Olaoluwa Osuntokun
0470d27603
server: add an exponential back off to initialPeerBootstrap
In this commit we add exponential back off to the `initialPeerBootstrap`
method. Before this change, if the DNS seed was down, we would hammer it
in an attempt to get our initial set of peers. This makes this section a
bit less aggressive, but saves log spam and also will hit the DNS
servers less frequently.
2019-06-28 16:10:50 -07:00
Olaoluwa Osuntokun
efab9cb584
server: extract backOffCeiling into bootstrapBackOffCeiling as constant 2019-06-28 16:10:49 -07:00
Olaoluwa Osuntokun
abe73ca6c1
server: don't re-use existing wait group for loops within initialPeerBootstrap 2019-06-28 16:10:48 -07:00
Wilmer Paulino
dff7fba40a
server: properly set stopping atomic var upon shutdown 2019-06-18 19:38:20 -07:00
Conner Fromknecht
a543c781fe
watchtower/wtpolicy: add basic validity constraints 2019-06-13 19:54:22 -07:00
Conner Fromknecht
7c0a03c7c8
server+utxonursery: generate pkscript closures
This commit moves the newSweepPkScript function
previously in the nursery to be a helper function
within the server. Additionally, the function now
returns a closure that satisfies the configuration
interfaces of several other subsystems.

As a result, the configuration sites contain much
less boilerplate, as it's now encapsulated in
the newSweepPkScriptGen helper.
2019-06-13 19:54:19 -07:00
Conner Fromknecht
d2f3d5ef6c
server: add watchtower client 2019-06-13 19:54:18 -07:00
Johan T. Halseth
00a86696a8
Merge pull request #3145 from federicobond/avoid-pubkey-serialization
discovery,fundingmanager: avoid serialization in NotifyWhenOnline
2019-06-12 10:50:35 +02:00
Joost Jager
f03533c67a
routerrpc: convert sendpayment to async
Modify the routerrpc SendPayment api to asynchronous. This allows
callers to pick up a payment after the rpc connection was lost or lnd
was restarted.
2019-06-05 12:41:53 +02:00
Joost Jager
87d3207baf
channeldb+routing: move control tower interface to routing
This commit creates an empty shall for control tower in the routing
package. It is a preparation for adding event notification.
2019-06-05 12:41:47 +02:00
Federico Bond
9bd3055fb8 discovery,fundingmanager: avoid serialization in NotifyWhenOnline 2019-06-04 16:36:21 -03:00
Joost Jager
054e42f680
routing+routerrpc: expose mission control parameters in lnd config
This commit exposes the three main parameters that influence mission
control and path finding to the user as command line or config file
flags. It allows for fine-tuning for optimal results.
2019-06-04 13:22:50 +02:00
Joost Jager
b6102ad191
routing: remove querybandwidth self node check
This function is only ever called for channels connected to self.
2019-06-04 10:00:19 +02:00
Joost Jager
68f2a04f42
routerrpc: expose mission control reset rpc 2019-06-04 10:00:17 +02:00
Conner Fromknecht
f802ebddba
Merge pull request #3087 from joostjager/move-itest
lntest: move itest into package
2019-05-29 16:29:06 -07:00
Conner Fromknecht
f8287b0080
Merge pull request #2985 from johng/sub-batch
Broadcast gossip announcements in sub batches
2019-05-28 17:05:06 -07:00
Joost Jager
dff0387363
lntest: move itest into package 2019-05-28 21:43:23 +02:00
Olaoluwa Osuntokun
19fafd7a9a
Merge pull request #2761 from halseth/reliable-payments-router-state-machine
[reliable payments] router payment state machine
2019-05-27 16:46:19 -07:00
Johan T. Halseth
3f76bc0629
routing+server: define PaymentSessionSource 2019-05-27 20:18:59 +02:00
Johan T. Halseth
de1bf8a518
routing/router: persist payment state machine
This commit makes the router use the ControlTower to drive the payment
life cycle state machine, to keep track of active payments across
restarts.  This lets the router resume payments on startup, such that
their final results can be handled and stored when ready.
2019-05-27 20:18:58 +02:00
Wilmer Paulino
5172a5e255
multi: support arbitrary client fee preferences to UtxoSweeper
In this commit, we introduce support for arbitrary client fee
preferences when accepting input sweep requests. This is possible with
the addition of fee rate buckets. Fee rate buckets are buckets that
contain inputs with similar fee rates within a specific range, e.g.,
1-10 sat/vbyte, 11-20 sat/vbyte, etc. Having these buckets allows us to
batch and sweep inputs from different clients with similar fee rates
within a single transaction, allowing us to save on chain fees.

With this addition, we can now get rid of the UtxoSweeper's default fee
preference. As of this commit, any clients using the it to sweep inputs
specify the same fee preference to not change their behavior. Each of
these can be fine-tuned later on given their use cases.
2019-05-24 15:30:38 -07:00
John Griffith
f6058b4117 server: added new variables to gossiper config 2019-05-23 10:51:25 +01:00
Johan T. Halseth
c9e8ff6a34
switch+router+server: move NextPaymentID to router
This commit moves the responsibility of generating a unique payment ID
from the switch to the router. This will make it easier for the router
to keep track of which HTLCs were successfully forwarded onto the
network, as it can query the switch for existing HTLCs as long as the
paymentIDs are kept.

The router is expected to maintain a map from paymentHash->paymentID,
such that they can be replayed on restart. This also lets the router
check the status of a sent payment after a restart, by querying the
switch for the paymentID in question.
2019-05-16 23:56:06 +02:00
Johan T. Halseth
f1cb54f943
routing/router: define PaymentAttemptDispatcher interface
The switch satisfies this interface, and makes it easy to mock the send
method from the router.
2019-05-16 23:53:08 +02:00
Joost Jager
064e8492de
cnct+htlcswitch+invoices: move invoice parameter check out of link
This commit is the final step in making the link unaware of invoices. It
now purely offers the htlc to the invoice registry and follows
instructions from the invoice registry about how and when to respond to
the htlc.

The change also fixes a bug where upon restart, hodl htlcs were
subjected to the invoice minimum cltv delta requirement again. If the
block height has increased in the mean while, the htlc would be canceled
back.

Furthermore the invoice registry interaction is aligned between link and
contract resolvers.
2019-05-15 14:42:12 +02:00
Joost Jager
1a80a1e540
witness_beacon: do not look up invoice preimages
This commit isolates preimages of forwarded htlcs from invoice
preimages. The reason to do this is to prevent the incoming contest
resolver from settling exit hop htlcs for which the invoice isn't marked
as settled.
2019-05-15 14:41:58 +02:00
Johan T. Halseth
ee257fd0eb
multi: move Route to sub-pkg routing/route 2019-04-29 14:52:33 +02:00
Olaoluwa Osuntokun
a783f35ad4
Merge pull request #2932 from wpaulino/sync-manager-improvements
discovery: SyncManager improvements
2019-04-26 15:59:38 -07:00
Wilmer Paulino
5db2cf6273
discovery+server: remove roundRobinHandler and related code
Since ActiveSync GossipSyncers no longer synchronize our state with the
remote peers, none of the logic surrounding the round-robin is required
within the SyncManager.
2019-04-24 13:19:07 -07:00
Johan T. Halseth
b53899c43c
lnd: rename package main->lnd 2019-04-23 20:57:33 +02:00
Wilmer Paulino
760f38736e
fundingmanager: populate additional edge info after adding to graph
This commit serves as another stop-gap for light clients since they are
unable to obtain the capacity and channel point of graph edges. Since
they're aware of these things for their own channels, they can populate
the information within the graph themselves once each channel has been
successfully added to the graph.
2019-04-18 21:57:40 -07:00
Wilmer Paulino
5173ef6f85
Merge pull request #2014 from frennkie/re-create-port-mappings
Re-create forwardings after externalIP change
2019-04-18 17:38:02 -07:00
Robert Habermann
a27ac66eed server: add periodic renewal of port forwarding
The check prevented the creation of port forwardings which were assumed
to be present already. After this change the port forwardings which
might have been removed from the NAT device can be re-created.
2019-04-13 13:49:31 +00:00
Olaoluwa Osuntokun
d817b8c9db
server: remove duplicate HistoricalSyncTicker param 2019-04-11 16:01:17 -07:00
Wilmer Paulino
be727ab0be config+server: expose HistoricalSyncInterval flag
This allows us to set how often the daemon should routinely perform
historical graph syncs.
2019-04-11 15:45:19 -07:00
Olaoluwa Osuntokun
4b57fb199f server: add new errPeerAlreadyConnected error type 2019-04-10 17:27:58 -07:00
Conner Fromknecht
25d2b1b537
Merge pull request #2885 from cfromknecht/stagger-initial-reconnect
server: stagger initial reconnects
2019-04-05 15:46:12 -07:00
Joost Jager
ab4da0f53d
cnct: define separate broadcast delta for outgoing htlcs
This commits exposes the various parameters around going to chain and
accepting htlcs in a clear way.

In addition to this, it reverts those parameters to what they were
before the merge of commit d1076271456bdab1625ea6b52b93ca3e1bd9aed9.
2019-04-05 11:36:07 +02:00
Conner Fromknecht
cf80476e01
server: stagger initial reconnects
This commit adds optional jitter to our initial reconnection to our
persistent peers. Currently we will attempt reconnections to all peers
simultaneously, which results in large amount of contention as the
number of channels a node has grows.

We resolve this by adding a randomized delay between 0 and 30 seconds
for all persistent peers. This spreads out the load and contention to
resources such as the database, read/write pools, and memory
allocations. On my node, this allows to start up with about 80% of the
memory burst compared to the all-at-once approach.

This also has a second-order effect in better distributing messages sent
at constant intervals, such as pings. This reduces the concurrent jobs
submitted to the read and write pools at any given time, resulting in
better reuse of read/write buffers and fewer bursty allocation and
garbage collection cycles.
2019-04-05 02:31:58 -07:00
Wilmer Paulino
70be812747
discovery+server: use new gossiper's SyncManager subsystem 2019-04-03 15:44:43 -07:00