Commit Graph

6710 Commits

Author SHA1 Message Date
90d8a46ec6 lnwallet: allow DLP trigger transition in ProcessChanSyncMsg if chan restored
In this commit, we modify an existing case in `ProcessChanSyncMsg` to enter the DLP workflow if we detect that this is a restored channel.
2019-03-28 17:53:51 -07:00
d9c9d6ed73 lntest: add new ChanBackupPath method to expose channels.backup for node 2019-03-28 17:53:50 -07:00
b419179c86 lntest: extend RestartNode to also unlock node if password is present 2019-03-28 17:53:49 -07:00
e929142ff7 lntest: add new Unlock method to allow unlock of fresh node
In this commit, we convert the Unlock method to accept the
`lnrpc.UnlockWalletRequest`. This makes things a bit more generic as we
no longer need to continue to add params to the method each time a new
field is added to the Unlock method.
2019-03-28 17:53:48 -07:00
b62dd09430 lntest: exend newNode method to accept wallet password 2019-03-28 17:53:47 -07:00
441f010295 lntest: add new initClientWhenReady to connect RPC then init client 2019-03-28 17:53:46 -07:00
a508a62b8c lnwire: add bool types to codec for SCB format 2019-03-28 17:53:44 -07:00
64b8facf0e channeldb: don't read/write funding transactions if a restore channel 2019-03-28 17:53:43 -07:00
19ef4bbcb9 channeldb: within AddrsForNode don't fail if no graph node is found
In this commit, we modify the `AddrsForNode` method to not fail if no
graph node is found. We do this as when the backup is being
restored/created, it's possible that we don't yet have a
NodeAnnouncement for that node.
2019-03-28 17:53:42 -07:00
b93ff26265 channeldb: set restored chan status within RestoreChannelShells
In this commit, we move the location where we restore the channel status
to within the `RestoreChannelShells` method itself. Before this commit,
we attempted to use `ApplyChanStatus` which creates a DB transaction and
relies on a fully populated channel state, which in the restoration
case, we don't yet have.
2019-03-28 17:53:41 -07:00
13e7244d14 channeldb: also restore channel capacity in RestoreChannelShells 2019-03-28 17:53:40 -07:00
7cbf0326c7 chanbackup: extend channel backups to include entire local+remote chan config
In this commit, we extend the prior Single format to include the entire
channel config, other than the constraints, but including the CSV delay
for both sides. We do this as we'll need more of the keying information
in order to properly execute the DLP protocol. Additionally, in the
future, if warranted, this would allow channels to be resumed if deemed
safe.
2019-03-28 17:53:38 -07:00
d7bc93b6d3 chanbackup: add new NilMultiSizePacked constant 2019-03-28 17:53:37 -07:00
6bc20b1a14 server: assemble and start chanbackup.SubSwapper on startup 2019-03-28 17:53:36 -07:00
019ec2df6b rpcserver: implement the SubscribeChannelBackups RPC method 2019-03-28 17:53:35 -07:00
056decac2a log: hook up chanbackup logger 2019-03-28 17:53:34 -07:00
9512d7036f config: add new backupfilepath argument for SCBs
In this commit, we add a new config option: `backupfilepath` for the new
SCB implementation. This argument allows users to specify a custom
location for the SCB file such as NFS or distinct partition.
2019-03-28 17:53:32 -07:00
411000dbbc lnd: add new channelNotifier impl of chanbackup.ChannelNotifier
In this commit, we add the channelNotifier, and implementation fo the
chanbackup.ChannelNotifier interface. This will be our bridge from the
channelnotifier.ChannelNotifier sturct within lnd, and the interface
abstraction that the chanbackup.SubSwapper accpets. The role of this new
struct is simple: proxy the messages from the
channelnotifier.ChannelNotifier to the chanbackup.SubSwapper in a format
that it understands.

Along the way we introduce a tiny interface such that we don't need to
depend on the the channledb package.
2019-03-28 17:53:31 -07:00
af1dfe176e chanbackup: add new updateBackupFile method, write fresh backup on startup
In this commit, we modify the sub-swapper to update the set of backups
files time it's tarted. We do this to ensure that each time we start,
we're up to sync with the current set of open channels. This also ensure
that we'll create a new back up file if this is the first time we're
starting up with this new feature.
2019-03-28 17:53:30 -07:00
0b8131c3be cmd/lncli: add new exportchanbackup and restorechanbackup cli commands
In this commit, we add two new cli commands: exportchanbackup and
restorechanbackup. These two commands allow users to export backups
(single or multi) for one or all channels, and also restore these
backups (single or multi) from a file to attempt to recover the
channels.

Additionally, we extend the `lncli create` call to also accept these
backups so users can have a single command to restore both their
on-chain and off-chain funds.
2019-03-28 17:53:29 -07:00
1d7e42af0a rpc: implement new SCB related RPC calls 2019-03-28 17:53:28 -07:00
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
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
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
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
da3625fc02 lnrpc: add series of new methods for exporting, recovering, and subscribing to SBCs 2019-03-28 17:53:22 -07:00
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
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
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
e3c65e1a49 Merge pull request #2845 from joostjager/routerrpc-log
routerrpc: register router sub server logger
2019-03-27 21:04:32 -07:00
43ba4a5a35 Merge pull request #2777 from wpaulino/reject-zombie-anns
channeldb+routing+discovery: reject zombie announcements
2019-03-27 19:22:15 -07:00
f3f4093ef0 lntest/timeouts: split into darwin and non-darwin timeouts 2019-03-27 19:00:39 -07:00
6e61ee2710 lnd_test: use one timeout context per AddInvoice 2019-03-27 19:00:27 -07:00
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
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
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
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
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
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
44a01db0ef routing: expose VerifyChannelUpdateSignature function 2019-03-27 13:07:47 -07:00
23796d3247 routing+discovery: extend ChannelGraphSource with zombie index methods 2019-03-27 13:07:30 -07:00
174645fcba routing+server: expose DefaultChannelPruneExpiry 2019-03-27 13:07:13 -07:00
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
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
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
a26a643273 channeldb: remove unused buckets 2019-03-27 13:05:48 -07:00
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
ec70965c8a Merge pull request #2824 from wpaulino/chanid-openchannel
rpcserver: retrieve Channel ChanId from OpenChannel record
2019-03-27 15:29:46 +01:00
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
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