Commit Graph

101 Commits

Author SHA1 Message Date
Conner Fromknecht
821ec9e550
lnd: compute funding params for ltc if active 2018-03-14 16:57:42 -07:00
PaddyQuinn
75e45b830b funding: implement reservation zombie sweeper
Before previous commits were squashed into this commit, zombie
reservations were cleaned up individually when they timed out.
However, this made the code more complex because each reservation
had its own individual timer and thus it would have required the
timer being cancelled any time the reservation was cancelled,
which would have been harder to maintain. With this commit,
zombie reservations are cleaned up by a zombie sweeper that is
set off by a ticker instead, to make the code more maintainable.
2018-03-12 21:58:51 -04:00
Conner Fromknecht
e754db44d2
lnd: configure fmgr with PublishTransaction 2018-03-11 13:58:41 -07:00
Olaoluwa Osuntokun
78cbe7a141
lnd: verify proper keychain derivation version upon initial creation 2018-03-06 16:04:06 -05:00
Olaoluwa Osuntokun
1669e3d5ec
lnd: use first key in keychain.KeyFamilyNodeKey as our nodeID
In this commit, we update lnd to now access the deterministic
keychain.KeyRing struct in order to obtain our identity public key.
With this change, if the user recovers their wallet with the same seed,
then they’ll have access to the same prior node identity. This change
also makes it easy for us to support node key rotation in the future by
bumping up our requested index.
2018-03-06 16:04:04 -05:00
Olaoluwa Osuntokun
6289a2fb84
lnd: move seed generation outside wallet to allow for user supplied entropy
In this commit, we extend the initial wallet creation set up case with
the goal of giving the user the ability to restore a prior wallet from
seed, or obtain the mnemonic for a newly generated wallet.

As the WalletUnlocker has been extended to allow passing a user source
of entropy, if this is detected, then we’ll use BIP39 to covert it into
an HD wallet seed. Otherwise, we’ll generate our own entropy, then
convert that into the wallet seed.

In order to make this change, we’ll now manually create the default
wallet ourselves. In the case that the user didn’t provide their own
seed, we’ll send the seed we generated back to the user. This will allow
frontends to display the newly generated seed to the end user.
2018-03-05 11:07:06 -05:00
Olaoluwa Osuntokun
158c78da60
lnd: remove invalid cipher suite 2018-02-26 13:29:19 -08:00
Olaoluwa Osuntokun
c846c4d2e0
lnd: correct typo in cipher suite sets, use sha2 2018-02-26 13:04:52 -08:00
Olaoluwa Osuntokun
f7eeea71e2
lnd: switch to using ECC certs for the rpcserver
In this commit, we modify our initial cert generation to *only* generate
and advertise cipher suites that purely use ECC. We do this is as
switching to ECC results in much faster startup time for a fresh
installation, and is also more modern crypto.  # Please enter the commit
message for your changes. Lines starting
2018-02-23 18:24:23 -08:00
Jason Dufair
84551c616f lnwallet/lnrpc: Expose sync status to gRPC interface
This commit adds wallet_best_block_timestamp to the gRPC interface.
This is done in order to allow clients to calculate progress while
lnd syncs to the blockchain. wallet_best_block_timestamp is exposed
via the GetInfo() rpc call. Additionally, IsSynced() returns the
WalletBestBlockTimestamp as the second value in the tuple
that is returned, providing additional detail when querying about the
status of the sync. The BtcWallet interface has also been updated
accordingly.

This commit was created to support the issue to
[Add progress bar for chain sync] (lightninglabs/lightning-app#10) in
lightning-app
2018-02-20 19:00:06 -08:00
Olaoluwa Osuntokun
3fcce9959b
lnd: pass through the custom dialer+DNS to neutrino
In this commit, we modify our initialization of neutrino to also pass
in the custom dialer and name resolver function. With this change, if
lnd is configured to use Tor, then neutrino will as well. This means
that *both* the Bitcoin P2P as well as the Lightning P2P traffic will
be proxied over Tor.
2018-02-09 12:16:17 -08:00
Johan T. Halseth
a3a0efbeb0
lnd: populate channel constraints closures in fundingConfig. 2018-02-08 18:35:24 -05:00
Juan Ignacio Donoso
bb42cb55ba config: adds an extra tls ip to config
This commit adds the `tlsextraip` flag to the cli to add an
ip to the generated certificate. This is usefull when using
a loadbalancer to access the node.
2018-02-08 15:23:52 -08:00
practicalswift
a93736d21e multi: comprehensive typo fixes across all packages 2018-02-06 19:11:11 -08:00
Alex
de6efbd1a1 multi: macaroon root key encryption 2018-02-05 21:44:06 -08:00
Olaoluwa Osuntokun
30dbbd69a0
funding+htlcswitch: dynamically update short chan id of existing link
In this commit, we fix an existing bug that would result in some
payments getting “stuck”. This would happen if one side restarted
before the channel was fully locked in. In this case, since upon
re-connection, the link will get added to the switch with a *short
channel ID of zero*. If A then tries to make a multi-hop payment
through B, B will fail to forward the payment, as it’ll mistakenly
think that the payment originated from a local-subsystem as the channel
ID is zero. A short channel ID of zero is used to map local payments
back to their caller.

With fix this by allowing the funding manager to dynamically update the
short channel ID of a link after it discovers the short channel ID.

In this commit, we fix a second instance of reported “stuck” payments
by users.
2018-02-03 18:14:15 -08:00
Olaoluwa Osuntokun
bb174292b1
lnd: remove redundant server shutdown for REST wallet unlock
In this commit, we remove a server shutdown statement that was executed
after we obtained the wallet’s password from the user over RPC. This
was unnecessary as we already close the listener below. Before this
commit, users would see a weird benign error message. With these code
deletion, the message disappears.
2018-02-03 17:59:03 -08:00
Conner Fromknecht
84c947edeb lnd: move channeldb to graph dir 2018-01-31 17:37:08 -08:00
Alex
21c29c33d7 multi: upgrade macaroons to v2, replace per-method auth with interceptors
This commit reworks the macaroon authentication framework to use the
v2 macaroon format and bakery API. It also replaces the code in each
RPC method which calls the macaroon verifier with interceptors which
call the macaroon verifier instead. In addition, the operation
permissions are reworked to fit the new format of "allow" commands
(specifically, entity/operation permissions instead of method
permissions).
2018-01-31 17:14:49 -08:00
Olaoluwa Osuntokun
d4e650c85d
peer: the chancloser no longer needs to notify the breach arb of settled transactions 2018-01-22 19:19:59 -08:00
Olaoluwa Osuntokun
69e6ec9954
peer+funding: remove unneeded channel handoff code with the breach arbiter
We no longer need to hand off new channels that come online as the
chainWatcher will be persistent, and always have an active signal for
the entire lifetime of the channel.
2018-01-22 19:19:50 -08:00
Olaoluwa Osuntokun
b391049e49
lnd+test: update unit tests to account for recent API changes 2018-01-22 19:19:46 -08:00
Matt Drollette
86133e559b config: add peer, rpc, and rest listener options
This commit removes the `peerport` and `rpcport` config options and
adds `listen`, `rpclisten`, and `restlisten` options to allow setting
one or multiple interfaces to listen on for incoming connections.

It also adds a `nolisten` option to allow disabling the listener for
incoming peer connections.
2018-01-21 17:35:03 -08:00
Alex
9a02884d0b main/lntest: factor out node config options, add options for bitcoind
This commit factors out the btcd and ltcd options into their own sections
similar to neutrino, and adds a bitcoind section as well. Now, you specify
node options similarly to:

--ltcd.rpchost=...
or
--btcd.rpcuser=...
or
--bitcoind.zmqpath=...

For Bitcoin, you specify an alternate back-end to btcd as follows:

--bitcoin.node=bitcoind
or
--bitcoin.node=neutrino

You can also specify the default option:
--bitcoin.node=btcd

For Litecoin, only `btcd` mode is valid, and corresponds to the `ltcd`
section. For example:

--litecoin.node=btcd
--ltcd.rpchost=...

The new code also attempts to read the correct options and auth info
from bitcoin.conf just as it does from btcd.conf/ltcd.conf.
2018-01-15 13:59:34 -08:00
Johan T. Halseth
43d7dd3d99
lnd: make NumRequiredConfs and RequiredRemoteDelay scale with chanAmt
This commit makes the value returned fomr NumRequiredConfs
and RequiredRemoteDelay used during the funding process scale
linearly with the channel size. This is done to ensure that
in cases there are more at stake in a channel, we have more
time to react to reorgs, or unilateral closes.

If the user explicitly specified values for these two at
startup, we return those instead, without doing the scaling.
2018-01-12 22:57:02 +01:00
Johan T. Halseth
4ee3bff771
lnd: use cfg.Bitcoin.DefaultNumChanConfs 2018-01-12 22:56:59 +01:00
Matt Drollette
12677f08b2 correct wording on error log 2018-01-03 17:40:42 +01:00
Olaoluwa Osuntokun
0952b68e64
multi: retain original copyright on files copied/modified from btcsuite
Early in the lifetime of the project here were a few files we either
copied entirely, or used as the basis for code within lnd. Before this
PR, this was not recognized by retaining the original copyright. With
this commit, we remedy that by explicitly noting the copyright in the
relevant files.

Fixes #423.
2017-11-27 16:19:36 -08:00
Olaoluwa Osuntokun
8358349b2d
lnd: revert back to prior default wallet public passphrase
In this commit we ensure the behavior of lnd with the —noencryptwallet
command line option heaves as it did before user initiated wallet
encryption was implemented. We do this by modifying the
waitForWalletPassword method to instead return two pass phrases: one
public and one private. The default wallet public passphrase is then
restarted back to the value which was used stoically in the codebase
before the latest merged PR.
2017-10-19 19:53:28 -07:00
Johan T. Halseth
824e0c2982 daemon: wait for encryption passoword at startup
This commit makes use of the UnlockerService within lnd, waiting
for the user to provide a wallet encryption passord over RPC at
startup. When the passoword is received, startup continues as
normal, either using the passowrd to create the wallet for first
time use, or unlocking an existing wallet database.

This can be skipped by setting the --noencryptwallet flag, causing
the wallet database to be encypted using the default passoword.
2017-10-19 19:17:35 -07:00
Olaoluwa Osuntokun
7a2ce62346
config+lnd: add new option --cpuprofile for writing cpuprofile to file
In this commit we add a new option to lnd, cpuprofile. With this option
we add additional telemetry hooks into and, allowing users to generate
CPU profiling files to measure hot spots within the daemon.
2017-10-14 17:08:34 -07:00
Johan T. Halseth
b8cadf881c
fundingManager: use NotifyWhenOnline when sending fundingLocked.
The fundingManager will register with the server to get notified
when the targetted peer comes online, in case of a failed send
of the fundingLocked message. This is necessary because if the
peer is not connected yet (or was disconnected while we were
waiting for the funding tx to confirm), we cannot continue the
the opening process before the peer successfully has received
the fundingLocked.
2017-10-02 13:29:52 +02:00
whythat
1379488e72 macaroons: rename PermissionsConstraint to AllowConstraint 2017-09-19 16:46:20 -07:00
whythat
7df503575c macaroons: add error reporting for macaroon constraints 2017-09-19 16:46:20 -07:00
whythat
a6b9155150 macaroons: use constraint layer for macaroon tweaking 2017-09-19 16:46:20 -07:00
John
8fc14a7308 rpc: add additional go 1.8 TLS cipher suites 2017-09-19 05:45:31 +02:00
Olaoluwa Osuntokun
e0bed8bc27
config: use a single global macaroon database, scope macaroons in datadir
This commit modifies the way that we create the macaroon database, and
also create the initial macaroons themselves. Rather than creating a
new macaroon DB for each chain, we instead create a single instance for
all chains. Additionally, if the datadir has been modified, and the
macaroon paths haven’t been modified, the macaroons are now scoped to
those paths.
2017-08-22 00:53:38 -07:00
Olaoluwa Osuntokun
01b0ddf1c5
lnd+rpc: update RPC responses to convert mSAT to SAT 2017-08-22 00:52:56 -07:00
Alex
f67ce4e6d7 main: fix TLS cert autogen and server configuration 2017-08-18 12:05:08 -07:00
Alex
922b065de5 main: integrate macaroons into config, startup, and RPC server 2017-08-17 19:20:41 -07:00
Olaoluwa Osuntokun
ece1d09a9f
lnd: initialize an autopilot.Agent instance if set in the config file 2017-08-10 21:40:16 -07:00
Conner Fromknecht
d3dc546108 lnd+rpcserver: use new public server API 2017-08-10 16:14:01 -07:00
Johan T. Halseth
849d0b93b1 fundingManager: persist state in opening process.
Persists the state of a channel opening process after funding
transaction is confirmed. This tracks the messages sent to
the peer such that the process can be continued in case of a
restart. Also introduces that the receiver side forgets about
channel if funding transaction is not confirmed in 48hrs.
2017-08-10 13:14:25 -07:00
Johan T. Halseth
5c89ec6288 fundingManager: let CurrentNodeAnnouncement return copy instead of ref 2017-08-08 12:29:27 -07:00
Olaoluwa Osuntokun
43b736225b
multi: add new method to generate fresh node announcments 2017-08-04 18:32:33 -07:00
Alex
59f9065213 rpc: force TLS for both grpc endpoint and grpc gateway 2017-08-03 18:21:22 -07:00
Johan T. Halseth
e2112702e7 fundingmanager: send node announcements after channel open.
Make the fundingmanager send an updated node announcement
each time it opens a new channel. This is to make sure
our node announcement is propagated in the network, since
peers will ignore our node announcements if we haven't
opened any channels yet.
2017-08-02 15:58:58 -07:00
Olaoluwa Osuntokun
828c650bbc
config: add new command line param --defaultchanconfs
This commit adds a new command line option that allows clients to
specify a default value to use when responding to a new channel funding
request. In a future change, a pure mapping will be added, with the
command line option having higher precedence.
2017-07-30 20:21:51 -07:00
Olaoluwa Osuntokun
db10772bd0
lnd: add initial skeleton functions for RequiredRemoteDelay+ NumRequiredConfs 2017-07-30 17:52:11 -07:00
Olaoluwa Osuntokun
a73589f3e9
lnd: properly initialize LightningWallet with new config 2017-07-30 17:52:07 -07:00