Commit Graph

7101 Commits

Author SHA1 Message Date
Olaoluwa Osuntokun
c5933d45fb
server: feed through any SCBs on start up to be restored
In this commit, we modify the server to serve the role as the agent
which will carry out the SCB restoration protocol if the Init/Unlock
methods include a set of channels to be recovered.
2019-03-28 17:53:26 -07:00
Olaoluwa Osuntokun
af4c11c6c1
chanrestore: add new file to house chanbackup interface implementations
The `openChannelShell` method now includes the new config information
within the open channel shells. Additionally, we now properly re-derive
all keys from our local chan config so they're useable immediately in
the channel state machine.

We extend the `chanDBRestorer.RestoreChansFromSingles` method to also
add the new channels to the chain arbitrator once they've been restored
on disk. We do this in order to ensure that we catch the channel closure
on chain once the DLP protocol beings.
2019-03-28 17:53:25 -07:00
Olaoluwa Osuntokun
73eb37b3a9
peer: don't attempt to load any channels that have a non-default state, other then recovered
In this commit, we modify the filter we use to determine if we should
add a new channel to the switch to reflect the new channel restoration
state. For all other non-default states, we want to avoid loading in a
channel, but for the restoration state, we need to load the link in
order to ensure we initiate the data loss protection protocol once we
connect to the remote peer.
2019-03-28 17:53:24 -07:00
Olaoluwa Osuntokun
f0e9a1f753
walletunlock: exend the Init and Unlock methods to also return optional SCB's
In this commit, we we extend the Init and Unlock methods to also parse
out and return optional SCB instances. With this change, when the user
creates their node, if they have an existing seed and also a set of SCBs
(either single or multi), they'll be able to recover both their on-chain
balance, and also any funds that were settled within their existing
channels.
2019-03-28 17:53:23 -07:00
Olaoluwa Osuntokun
da3625fc02
lnrpc: add series of new methods for exporting, recovering, and subscribing to SBCs 2019-03-28 17:53:22 -07:00
Olaoluwa Osuntokun
1a488f4aef chains: upgrade the keyRing instance in chainControl to a SecretKeyRing
In this commit, we upgrade regular KeyRing instance to a SecretKeyRing
instance as we need the upgraded instance in order to recover SCB's. Due
to the fact that we don't currently store the full KeyLocator for the
key used to derive a shachain root for each channel, we instead need to
obtain the private key vanilla to re-derive this value.
2019-03-28 17:38:07 -07:00
Wilmer Paulino
0ab97957ea discovery: check if stale within isMsgStale for ChannelUpdate messages
In this commit, we address an assumption of the gossiper's recently
introduce reliable sender. The reliable sender is currently only used
for messages of unannounced channels. This makes sense as peers should
be able to retrieve messages from the network if they've previously
announced. However, within isMsgStale, we assumed that the reliable
sender would be used for every ChannelUpdate being sent, even if the
channel is already announced. Due to this, checking if the policy is
stale was unnecessary. But since this isn't the case, we should actually
be checking whether it is stale to prevent sending it later on.
2019-03-28 17:22:23 -07:00
Wilmer Paulino
93414bd27a discovery: clean up TestSignatureAnnouncementRetryAtStartup
In this commit, we remove code from
TestSignatureAnnouncementRetryAtStartup that is not crucial to the
assumptions the test is exercising.
2019-03-28 17:22:23 -07:00
Wilmer Paulino
95ed11b01b discovery: properly store and retrieve edge policies within mockGraphSource
In this commit, we address an issue with our router mock in which it was
not properly storing and retrieving edge policies. Previously, they were
being appended to a slice of policies, but this doesn't always work like
when you attempt to update the same edge twice. Instead, the slice can
only contain up to two entries, each one being the latest version of
each direction.
2019-03-28 17:22:22 -07:00
Wilmer Paulino
3a2c4ec594 discovery: add missing offline peer check before sending message reliably 2019-03-28 17:21:28 -07:00
Wilmer Paulino
3e81e89062 discovery: add log when attempting to send msg reliably and peer is offline 2019-03-28 17:21:28 -07:00
ccdle12
abfbdf6aec rpcserver: check for compatible network in SendCoins
lnd_test: adding address validation for send coins

The commit adds a test that checks that when a user calls sendcoins, the
receiving address is validated according to the current network. If the
address is not compatible with the current network, it will return an
error to the user.

rpcserver: adding a check for compatible network in SendCoins

This commit adds a check in SendCoins that checks whether the receiving
address is compatible with the current network.

Fixes #2677.
2019-03-28 16:42:44 -07:00
Olaoluwa Osuntokun
341f5e4329
Merge pull request #2846 from cfromknecht/lntest-darwin-timeouts
lntest/timeout: split into darwin and non-darwin timeouts
2019-03-28 16:14:38 -07:00
Conner Fromknecht
e3c65e1a49
Merge pull request #2845 from joostjager/routerrpc-log
routerrpc: register router sub server logger
2019-03-27 21:04:32 -07:00
Olaoluwa Osuntokun
43ba4a5a35
Merge pull request #2777 from wpaulino/reject-zombie-anns
channeldb+routing+discovery: reject zombie announcements
2019-03-27 19:22:15 -07:00
Conner Fromknecht
f3f4093ef0
lntest/timeouts: split into darwin and non-darwin timeouts 2019-03-27 19:00:39 -07:00
Conner Fromknecht
6e61ee2710
lnd_test: use one timeout context per AddInvoice 2019-03-27 19:00:27 -07:00
Olaoluwa Osuntokun
fff003f92e
Merge pull request #2832 from caldon/avg-out-degree-fix
rpcserver: correct avg degree in GetNetworkInfo
2019-03-27 18:11:57 -07:00
Olaoluwa Osuntokun
4688a4a0e7
Merge pull request #2843 from Roasbeef/btcwallet-utxo-remove-fix
build: update btcwallet to latest version
2019-03-27 18:10:08 -07:00
Olaoluwa Osuntokun
a069e78b74
Merge pull request #2797 from halseth/autopilot-prefattach-small-chan-penalize
[autopilot] penalize small channels in preferantial attachment heuristic
2019-03-27 18:09:31 -07:00
Olaoluwa Osuntokun
cddbf19aa2
Merge pull request #2759 from Roasbeef/cltv-lower-default
lnd: lower default CLTV delta from 144 to 40
2019-03-27 17:10:08 -07:00
Olaoluwa Osuntokun
55ddca6d2f
Merge pull request #2842 from Roasbeef/catch-all-signals
signal: catch all termination signals by default
2019-03-27 13:26:13 -07:00
Wilmer Paulino
5cec4513de
discovery: reject announcements for known zombie edges
In this commit, we leverage the recently introduced zombie edge index to
quickly reject announcements for edges we've previously deemed as
zombies. Care has been taken to ensure we don't reject fresh updates for
edges we've considered zombies.
2019-03-27 13:08:03 -07:00
Wilmer Paulino
44a01db0ef
routing: expose VerifyChannelUpdateSignature function 2019-03-27 13:07:47 -07:00
Wilmer Paulino
23796d3247
routing+discovery: extend ChannelGraphSource with zombie index methods 2019-03-27 13:07:30 -07:00
Wilmer Paulino
174645fcba
routing+server: expose DefaultChannelPruneExpiry 2019-03-27 13:07:13 -07:00
Wilmer Paulino
c82d73a826
channeldb+routing: extend edge lookup methods with zombie index check
In this commit, we extend the graph's FetchChannelEdgesByID and
HasChannelEdge methods to also check the zombie index whenever the edge
to be looked up doesn't exist within the edge index. We do this to
signal to callers that the edge is known, but only as a zombie, and the
only information that we have about the edge are the node public keys of
the two parties involved in the edge.

In the event that an edge does exist within the zombie index, we make
an additional check on edge policies to ensure they are not within the
router's pruning window, indicating that it is a fresh update.
2019-03-27 13:06:57 -07:00
Wilmer Paulino
e98f4d6d9d
channeldb: extend DeleteChannelEdge to mark edge as zombie
We mark the edges as zombies when pruning them to ensure we don't
attempt to reprocess them later on. This also applies to channels that
have been removed from the graph due to being stale.
2019-03-27 13:06:34 -07:00
Wilmer Paulino
b780dfacdb
channeldb: add zombie edge index
In this commit, we add a zombie edge index to the database. This allows
us to quickly determine across restarts whether we're attempting to
process an edge we've previously deemed as zombie.
2019-03-27 13:06:12 -07:00
Wilmer Paulino
a26a643273
channeldb: remove unused buckets 2019-03-27 13:05:48 -07:00
Olaoluwa Osuntokun
c731a99647
signal: catch all termination signals by default
In this commit, we modify the primary `signal` package to instead catch
all signals. Before this commit, it would only catch the interrupt
signal sent from the kernel. With this new commit, we'll now also catch
(or attempt to catch): `SIGABRT`, `SIGTERM`, `SIGSTOP`, and `SIGQUIT`.
2019-03-27 12:56:45 -07:00
Johan T. Halseth
ec70965c8a
Merge pull request #2824 from wpaulino/chanid-openchannel
rpcserver: retrieve Channel ChanId from OpenChannel record
2019-03-27 15:29:46 +01:00
Johan T. Halseth
59e3390f6c
Merge pull request #2750 from cryptagoras/patch-1
htlcswitch/switch: log target node on insufficient cap error
2019-03-27 15:10:08 +01:00
Johan T. Halseth
9d8e67d81e
autopilot/prefattach: count small channels negatively
Decrease scores of nodes having a large number of small channels.
2019-03-27 15:06:30 +01:00
Johan T. Halseth
d6d66e631a
rpcserver: calculate and populate medianChanSizeSat in NetworkInfo 2019-03-27 15:06:30 +01:00
Johan T. Halseth
f96dbd2377
lnrpc: add median_channel_size to NetworkInfo 2019-03-27 15:06:30 +01:00
Johan T. Halseth
6860ad9ac6
autopilot: add Median method 2019-03-27 15:06:30 +01:00
Joost Jager
6b6dd30aa7
routerrpc: register router sub server logger 2019-03-27 11:44:49 +01:00
Johan T. Halseth
4d8100cc9a
Merge pull request #2640 from joostjager/cltv-limit
routing: add cltv limit
2019-03-27 10:05:02 +01:00
Olaoluwa Osuntokun
d736454599
Merge pull request #2831 from philippgille/patch-3
docs/MAKEFILE: Remove mention of dep and Glide
2019-03-26 20:54:38 -07:00
Olaoluwa Osuntokun
6d3f0551b5
Merge pull request #2828 from philippgille/patch-2
docs: fix typo
2019-03-26 20:53:41 -07:00
Olaoluwa Osuntokun
07c0dbb199
Merge pull request #2806 from wpaulino/txnotifier-hint-logs
chainntnfs: fix RegisterSpend height hint logs
2019-03-26 20:53:01 -07:00
Olaoluwa Osuntokun
9a3c42fb52
build: update btcwallet to latest version
In this commit, we update the `btcwallet` dep to the latest version that
includes a fix related to zero conf spends. Before this new version, if
a single output was spent multiple time by conflicting transactions,
then upon removing them all after a new transaction confirms, a number
of zero conf UTXOs could be left over.
2019-03-26 20:49:43 -07:00
Olaoluwa Osuntokun
b935f69a6e
Merge pull request #2819 from cfromknecht/peer-write-retry
peer: catch write timeouts, retry with backoff
2019-03-26 18:44:30 -07:00
Wilmer Paulino
bde417e2ef
chainntnfs: fix RegisterSpend and RegisterConf height hint logs 2019-03-26 18:13:02 -07:00
Conner Fromknecht
c5365160fb
server: wrap peer connection tiebreaking to 80 chars 2019-03-26 16:41:30 -07:00
Conner Fromknecht
7358535725
peer+server: log pubkey@addr 2019-03-26 16:41:13 -07:00
Conner Fromknecht
60467bef7b
lncfg/workers: bump default read/write workers from 16 -> 100
Bumps the default read and write handlers to be well
above the average number of peers a node has. Since
the worker counts specify only a maximum number of
concurrent read/write workers, it is expected that
the actual usage would converge to the requirements
of the node anyway. However, in preparation for a
major release, this is a conservative measure to
ensure that the default values aren't too low and
improve network instability.
2019-03-26 16:40:57 -07:00
Conner Fromknecht
93e56f9ee8
peer: add symmetric write idle timeout
In this commit, we add a 5 minute idle timer to
the write handler. After catching the write
timeouts, it's been observed that some connections
have trouble reading a message for several hours.
This typically points to a deeper issue w/ the peer
or, e.g. the remote peer switched networks. This now
mirrors the idle timeout used in the read handler,
such that we will disconnect a peer if we are unable
to send or receive a message from the peer after 5
minutes.

We also modify the readHandler to drain its
idleTimer's channel in the even that the timer had
already fired, but we successfully sent the message.
2019-03-26 16:40:41 -07:00
Conner Fromknecht
b78e5f6742
peer: reduce write timeout to 5 seconds
This commit reduces the peer's write timeout to 5s.
Now that the peer catches write timeouts and doesn't
disconnect, this will ensure we spend less time blocking
in the write pool in case others also need to access the
workers concurrently. Slower peers will now only block
for 5s, after every reattempt w/ exponential backoff.
2019-03-26 16:40:24 -07:00