Commit Graph

186 Commits

Author SHA1 Message Date
Matt Drollette
87333ba829 config: bind naked ports to localhost
If only a port is given as a config value for a listener we'll
default to only binding that port to localhost.
2018-03-31 16:00:56 -07:00
Corné Plooy
c2e5ba3b43 config: determine the bitcoind chain directory from the chain params instead of the config file. This is more reliable in case the chain was selected with a bitcoind commandline option instead of a line in the config file. 2018-03-28 15:19:00 -07:00
François
9997014420 config: invoice macaroon path fix 2018-03-25 19:28:47 -07:00
Olaoluwa Osuntokun
18e6705d97
config: fix linter error (gofmt -s) 2018-03-23 19:26:43 -07:00
Olaoluwa Osuntokun
ead55783c7
Merge pull request #916 from PWKad/master
Fix error labels when missing LTC configuration
2018-03-23 18:45:47 -07:00
Brenden Matthews
8a51043462
config: Fix formatting, missing param check.
Fixed formatting for autopilot config params, as well as added check for
`MaxChannels` param which was presumably a mistaken copypaste from the
`MaxChannelSize' param.
2018-03-23 21:11:45 -04:00
Patrick Walters
484b12c0f3 config: return proper daemon name for config errors
Fix #915 by capturing the current daemonName and using that in
error messages.
2018-03-22 18:05:14 -05:00
Olaoluwa Osuntokun
7d14ed7a06
Merge pull request #904 from Roasbeef/invoice-macaroon
rpc+lnd: add new invoice-only macaroon
2018-03-21 15:27:31 -07:00
Olaoluwa Osuntokun
0155bcfd5c
Merge pull request #881 from Roasbeef/autopilot-target-chan-size
funding+pilot: increase min channel size, allow specifying chan size range for autopilot
2018-03-21 15:11:25 -07:00
Olaoluwa Osuntokun
4c0dcdafa5
config+lnd: introduce new invoice-only macaroon
In this commit, we wrap up the prior ones and introduce config
settings, as well as proper generation for a new invoice-only macaroon.
All prior invoice path rules are also properly enforced of this new
invoice.macaroon.
2018-03-21 15:08:54 -07:00
Jonathan Underwood
237ed4fc6e lnd+config: add TLSExtraDomain to config
Self explanatory.

Needed for NodeJS, as the grpc library only allows TLS connections to domains and not IP addresses.
2018-03-20 15:57:14 -07:00
Olaoluwa Osuntokun
76f7a66259
config+pilot: add new config params to specify min+max autopilot chan size
In this commit, we add two new configuration parameters to allow users
to specify the min and max size that the autopilot agent will create.
This is useful as now users can set the values to more or less the same
size, which will allow them to control the size of each created
channel.

Before this commit, if this wasn’t set, then the agent would try to
shove as much money into a channel up until the max chan size. This was
nice on testnet, but on main net, users will likely not want all their
funds to be in a single channel, and instead be distributed across many
channels. With things like AMP, have more channels becomes more
desirable.
2018-03-18 17:10:28 -07:00
Olaoluwa Osuntokun
71a5fac9c7
lnd+config: add flags for mainnet 2018-03-15 06:38:45 -07:00
Conner Fromknecht
5e21c38fdb
config: adds litecoind+ltcd backend node options 2018-03-14 16:24:58 -07:00
Wilmer Paulino
9bf1b5399b
config: ensure all paths are cleaned and expanded after parsing options
In this commit, we ensure all paths to directories and files related to
LND are cleand and expanded before attempting to use them.

For example, in POSIX systems:
  - ~/lnd.conf would be expanded to /home/user/lnd.conf
  - $HOME/lnd.conf would be expanded to /home/user/lnd.conf
2018-03-12 22:24:32 -04:00
Wilmer Paulino
862729809e
config+cmd/lncli: ensure tilde in path is expanded to home dir
Since we're now able to create a base LND directory that no longer lives
under the OS specific application data directory, we modify
cleanAndExpandPath to replace the `~` in a path to the current user's
home directory, rather than the user's application data directory.
2018-03-12 22:24:04 -04:00
Wilmer Paulino
36e06cdd35
config: add flag to specify the dir for the supported backend nodes
In this commit, we introduce a new flag to set a custom path for a
backend node's data directory.
2018-03-12 22:24:03 -04:00
Wilmer Paulino
44bc563396
config+cmd/lncli: add flag to specify the base dir for lnd
In this commit, we introduce a new flag `--lnddir` that allows us to
set a different base directory, other than the OS specific application
data directory, for all related lnd files and directories.
2018-03-12 22:23:56 -04:00
Conner Fromknecht
b8254803be
config: add unsafe-disconnect and unsafe-replay for testing 2018-03-09 21:18:14 -08:00
Olaoluwa Osuntokun
abcf822bf9
config: add new option to the tor config for stream isolation 2018-02-09 12:16:13 -08: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
MeshCollider
61eedfbeb7 config: Clarify the default behaviour of externalip 2018-02-08 15:21:04 -08:00
practicalswift
a93736d21e multi: comprehensive typo fixes across all packages 2018-02-06 19:11:11 -08:00
MeshCollider
69f207e23f torsvc: Replace MultiNet with polymorphic Net interface 2018-02-05 17:37:46 -08:00
MeshCollider
4affab7bd7 multi: Addressing Tor support review comments 2018-02-05 17:37:46 -08:00
nsa
698df2ac16 torsvc: added new type that multiplexes torsvc and net packages
This commit adds the `lnnet` package which contains an
implementation of the newly created LightningNet interface which
multiplexes the Dial and DNS-related functions to use net
by default and torsvc if a flag is specified. This modularization
makes for cleaner code.
2018-02-05 17:37:46 -08:00
nsa
8c482f2be7 multi: Added a NetInterface to clean up config.go
This commit adds a new interface named NetInterface and two
implementations of it: RegularNet & TorProxyNet. These two structs
are used in config.go in an attempt to clean up the code and
abstract away the dialer and DNS functions.
2018-02-05 17:37:46 -08:00
nsa
e132ad8433 torsvc: Added new module to house Tor functions
This commit adds a new module named 'torsvc' which houses all Tor
functionality in an attempt to isolate it and make it reusable in
other projecs. Some additional tweaks were made to config.go and
to the bootstrapper.
2018-02-05 17:37:46 -08:00
nsa
e2142c778f multi: Added Tor support
This commit adds Tor support. Users can set the --TorSocks flag
to specify which port Tor's SOCKS5 proxy is listening on so that
lnd can connect to it. When this flag is set, ALL traffic gets
routed over Tor including DNS traffic. Special functions for
DNS lookups were added, and since Tor doesn't natively support
SRV requests, the proxySRV function routes connects us to
a DNS server via Tor and SRV requests can be issued directly
to the DNS server.

Co-authored-by: MeshCollider <dobsonsa68@gmail.com>
2018-02-05 17:37:46 -08:00
Conner Fromknecht
6286a93cf5 config: separate chain directory 2018-01-31 17:37:08 -08:00
Olaoluwa Osuntokun
e953c6abcf
config: add stricter config parsing to avoid dangerous RPC auth combos
In this commit, we add an additional constraint to the RPC
configuration parsing. Before this commit, it was possible to start lnd
with either RPC server listening on an external interface *without*
authentication disabled. After this commit, if a user tries to start
the RPC server listening on an external interface without any sort of
RPC authentication, then the daemon will fail to start up.
2018-01-28 15:03:29 -08:00
Alex
4559438c4b config.go: check for RPCUser AND RPCPass (AND ZMQPath for bitcoind)
This commit causes the configuration parser to accept the values of
RPCUser, RPCPass, and (for the bitcoind back-end) ZMQPath configured
in lnd.conf or on the command line ONLY when all are specified. It
causes the configuration parser to look in btcd.conf or bitcoin.conf
ONLY when none are specified, and causes an error to be returned when
only some are specified, as users have done so erroneously and the
lack of clear feedback has caused difficulties.
2018-01-24 21:53:31 -08:00
Olaoluwa Osuntokun
4f91b66c51
Merge pull request #467 from bcongdon/feature/customize-alias-and-color
cmd/lncli+lnd: Add alias and color customization
2018-01-24 16:48:36 -08:00
Olaoluwa Osuntokun
f8adab1f1c
test: add comprehensive integration tests for on-chain HTLC handling
In this commit, we add 6 new integration tests to test the various
actions that may need to be performed when either side goes on-chain to
fully resolve HTLC’s. Many of the tests are mirrors of each other as
they test sweeping/resolving HTLC’s from both commitment transactions.
2018-01-22 19:20:02 -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
Benjamin Congdon
a40ee8fe8a
config: Add settings for Alias and Color
This commit adds configuration variables for setting the Color and Alias
of the Node.
2018-01-18 07:39:37 -06: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
0815bd4eb0
config: make DefaultNumChanConfs part of chainConfig
This commit moves the definition of DefaultNumChanConfs into
the chainConfig (such that it is set as e.g.
"--bitcoin.defaultchanconfs"), making it possible to set
individually for different chains.

It also adds the flag DefaultRemoteDelay to the chainConfig,
which can be used to set the CSV delay we will require the remote
to wait before retrieving its own funds in case of an
uncooperative close of the channel.

Both these are set 0 by default (if not specified by the user),
which in that case we will dynamically set the values, scaling
them according to the channel size.
2018-01-12 22:56:54 +01:00
Johan T. Halseth
f4feb1e697
config: add forwarding policy rules to config
This commit moves the forwarding policy rules for Bitcoin
and Litecoin, previously defined in the chainregistry, to
config.go, making them possible to define by the user.
We validate that the TimeLockDelta set is at least 4, the
other rules we let the user specify arbitrarily, even 0.
2018-01-12 22:56:40 +01:00
Matt Drollette
adf0d98194 multi: fix several typos in godoc comments 2017-12-17 18:40:05 -08:00
Olaoluwa Osuntokun
c5049125f8
config+test: increase default num confs for funding flows to 3
In this commit, we increase the default number of confirmations we
require for funding flows from 1 to 3. The value of 1 was rather
unstable on testnet due to the frequent multi-block re-orgs.
Additionally, a value of 3 ensures our funding transaction is
sufficiently buried before we deem is usable.
2017-12-05 17:46:20 -08: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
Laura Cressman
7408aa6c8d config+pathfind_test+notifications_test: format and fix newVertex import
Run go fmt so config file is formatted correctly. Also rename
newVertex to NewVertex in pathfind_test and notifications_test
as it is now exported from the routing package.
2017-11-15 16:50:19 -08:00
Laura Cressman
ed6ad22e85 config+server+networktest: make trickleDelay configurable
Add option to set trickleDelay for AuthenticatedGossiper in
command line, with default value of 300 milliseconds. Pass this
value to newServer, which uses it when creating a new instance of
AuthenticatedGossiper. Also set this value to 300 milliseconds when
creating nodes in integration tests.
2017-11-15 16:50:19 -08:00
Johan T. Halseth
f1c7dc1cbd config: add --noencryptwallet flag
This commit add the --noencryptwallet flag to lnd config, to be
used by users wanting to disable wallet encryption.
2017-10-19 19:17:35 -07:00
Olaoluwa Osuntokun
dff3ad05f0
config: add sanity check to ensure either BTC or LTC is specified 2017-10-17 19:44:15 -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
Conner Fromknecht
74322a99be config+htlclink+peer: htlc hodl mode!
This commit adds a new debug mode for lnd
  called hodlhtlc. This mode instructs a node
  to refrain from settling incoming HTLCs for
  which it is the exit node. We plan to use
  this in testing to more precisely control
  the states a node can take during
  execution.
2017-09-19 11:31:52 -07:00
Olaoluwa Osuntokun
53500127e3
test+config: add new --nobootstrap option to disable connection bootstrapping
This commit adds a new config option to allow callers to optionally
disable connection bootstrapping. This may be desirable for several
reasons, but primary, we add this so we can keep our integration tests
under the same context as before bootstrapping existed.
2017-09-03 17:05:05 -07:00
Olaoluwa Osuntokun
9f0efddc20
multi: switch from btcrpcclient to rpcclient 2017-08-24 18:54:24 -07:00
Olaoluwa Osuntokun
625b80b311
config: update default port to be 9735 to match BOLT-0001 2017-08-22 00:54:10 -07: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
Alex
922b065de5 main: integrate macaroons into config, startup, and RPC server 2017-08-17 19:20:41 -07:00
Olaoluwa Osuntokun
629793a249
config: add configuration options for autopilot mode 2017-08-10 21:26:52 -07:00
Alex
59f9065213 rpc: force TLS for both grpc endpoint and grpc gateway 2017-08-03 18:21:22 -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
Christian Decker
352461d551 config: add regtest support to lnd
Support for regtest allows us to create integration tests to verify
interoperability with other implementations. This seems to work, and
allows to connect to `btcd` and indirectly to `bitcoind` so we can run
lnd on the same network as eclair and c-lightning.

For details about my integration framework check this repo:
cdecker/lightning-integration
2017-07-11 16:54:43 -07:00
Max Fang
dc0ab06d91 config: Specify gRPC proxy port with --restport command line arg 2017-07-05 11:57:12 -07:00
Andrey Samokhvalov
aed2e5865f test: hack fix of panic by disabling btcrpcclient log 2017-06-25 14:19:56 +01:00
Andrey Samokhvalov
8fa2b95c12 lnd: remove seelog logger
The btclog package has been changed to defining its own logging
interface (rather than seelog's) and provides a default implementation
for callers to use.

There are two primary advantages to the new logger implementation.

First, all log messages are created before the call returns.  Compared
to seelog, this prevents data races when mutable variables are logged.

Second, the new logger does not implement any kind of artifical rate
limiting (what seelog refers to as "adaptive logging").  Log messages
are outputted as soon as possible and the application will appear to
perform much better when watching standard output.

Because log rotation is not a feature of the btclog logging
implementation, it is handled by the main package by importing a file
rotation package that provides an io.Reader interface for creating
output to a rotating file output.  The rotator has been configured
with the same defaults that btcd previously used in the seelog config
(10MB file limits with maximum of 3 rolls) but now compresses newly
created roll files.  Due to the high compressibility of log text, the
compressed files typically reduce to around 15-30% of the original
10MB file.
2017-06-25 14:19:56 +01:00
Olaoluwa Osuntokun
a95d56741d
config: don't log to stderr if lnd.conf isn't found
This commit fixes a bit of a wart in the configuration file handling
wherein if the config file isn’t found, an error was printed to stderr.
At times, this would cause the testing framework to erroneously mark as
test as failed. Instead, we now keep a particular config file error,
and check that, printing to a warning log level.
2017-06-19 16:44:30 +02:00
Olaoluwa Osuntokun
4b29c70c45
lnd: rename light client cmd line option to --neutrino.X=K 2017-06-05 19:23:09 -07:00
Olaoluwa Osuntokun
42a50224aa
config: add config to toggle light client for bitcoin only 2017-06-05 18:45:41 -07:00
Olaoluwa Osuntokun
b89a39d341
config: set chain directory _after_ the command line+config has been parsed
This commit fixes a bug introduced by the new multi-chain features of
and which disallowed multiple nodes from beings started locally.
Previously if two local nodes were set to, the _same_ chain, then
they’d both share the same chain data directory which would prevent one
of the nodes from being able to start up properly.
2017-05-02 20:29:14 -07:00
Olaoluwa Osuntokun
60f43cecf4
config: modify configuration to be aware of multi-chain paramters
This commit modifies the existing configuration to create instances
that are capable of housing configuration options for a particular
chain such as the rpcuser or rpcpass to distinct structures within
greater configuration. With this new change, it will now be possible
for lnd to be resident on either the litecoin testnets, with simple a
toggle in the main configuration.

The new configuration file will look like the following:
   [Bitcoin]
   bitcoin.active
   bitcoin.testnet=1
   bitcoin.rpcuser=kek
   bitcoin.rpcuass=kek

Similarly, one would mirror a similar set up in order to be active on
the latest litecoin testnet.
2017-05-02 19:57:49 -07:00
Faris Amali Alis
5e7655be54 docker: update instructions and Dockerfile for recent p2p port change
Error `connection refused` was thrown when user tries to get "Alice" to
connect to "Bob" node due to port mismatch introduced in this change [1]
here.

This commit updates the port value to reflect the new change introduced in
[1].

Reference: [1]
72772ce4df

Chanes in this commit:
  * Update references to old port value
  * Omit specifying port during lncli connect
  * Fix typo
2017-04-04 14:28:05 +02:00
Olaoluwa Osuntokun
58690d96f2
config: add automatic btcd RPC configuration for testnet
A common pitfall with new users setting up lnd on test net has been
observed to be the initial RPC credential set up between btcd and lnd.
As of a recent version of btcd now performs automatic RPC credential
set up by generating a random rpcuser and rpcpass on start up.

We now take advantage of this by reading the RPC credentials (if
possible and running in simmer mode). As a result, it is now possible
to simply run: `lnd—testnet` assuming a fresh installation of bcd (with
a set btcd.conf).

Fixes #68.
2017-04-01 20:14:16 +02:00
Olaoluwa Osuntokun
72772ce4df
config+lnd: the default p2p port is now 5656 2017-03-29 21:19:27 -07:00
Trevin Hofmann
40c7bac3aa multi: fix a variety of typos throughout the repo 2017-01-17 17:02:56 -08:00
Olaoluwa Osuntokun
d7a050b353
config: remove deprecated configuration parameters 2017-01-16 17:29:17 -08:00
Olaoluwa Osuntokun
ad76899a57
config+test: use default port for RPC server if one isn't specified
This commit alters the configuration parsing a bit along with the
documentation to expect the RPCHost configuration paramter to also have
the target port specified. If the port isn’t included, then the default
btcd RPC port for that chain is used.

Additionally, within the integration testing framework, when creating
the lnd nodes, we now use the configuration from the btcd harness to
set the proper RPC host.
2017-01-05 13:18:26 -08:00
Olaoluwa Osuntokun
8fe5c09e21
lnd: remove support for the now obsolete SegNet4 2017-01-05 13:08:15 -08:00
Olaoluwa Osuntokun
bd89a9312d
lnd: switch to using the connmgr for listening and persistent conns
This commit revamps the way in bound and outbound connections are
handled within lnd. Instead of manually managing listening goroutines
and also outbound connections, all the duty is now assigned to the
connmgr, a new btcsuite package.

The connmgr now handles accepting inbound (brontide) connections and
communicates with the server to hand off new connections via a
callback. Additionally, any outbound connection attempt is now made
persistent by default, with the assumption that (for right now),
connections are only to be made to peers we wish to make connections
to. Finally, on start-up we now attempt to connection to all/any of our
direct channel counter parties in order to promote the availability of
our channels to the daemon itself and any RPC users.
2016-12-14 18:15:55 -08:00
Andrey Samokhvalov
19d8abade8 config: add --pendingchannel lnd flag 2016-10-22 02:11:18 +03:00
Olaoluwa Osuntokun
39c9dfb9e4
config: add a new --debughtlc config parameter
This commit adds a new configuration parameter to the deamon:
‘DebugHTLC’. When true, all outgoing HTLC’s sent via the RPC interface
will be sent paying to a special rHash value which all lnd nodes also
with the flag activated know the preimage to. Therefore all payments
sent to a 1-hop node will immediately be settled by that node.

By default, this flag is false, it it only intended to be used to
exercise local changes to 1-hop behavior manually.
2016-09-21 19:48:25 -07:00
Olaoluwa Osuntokun
0085e2a38a
config: add an option to pass in a hex-encoded rpc cert (--rawrpccert)
This commit adds an option to pass in a raw hex-encoded rpc cert via
lnd’s configuration file. Such a change allows for programmatically
creating lnd nodes which can connect to an existing btcd instance
without requiring a file for the rpc cert to be specified.
Additionally, this commit makes the creation of an integration testing
harness easier.
2016-08-29 21:39:06 -07:00
Olaoluwa Osuntokun
a03126ed83
config: remove rpckey parameter 2016-08-29 21:33:12 -07:00
Olaoluwa Osuntokun
06f32cd5bc
lnd: drop the port from the default rpc host
Drop the port from the default RPC host as the proper port will be
filled in depending on which net is chosen.
2016-07-24 16:38:52 -07:00
Olaoluwa Osuntokun
a56ab46e97
lnd: properly switch RPC port with target net change
With this commit, support for changing the target network (testnet,
simnet, etc) has been finalized. Previously a command line option was
present to swap networks, but the RPC port wouldn’t automatically be
updated to reflect the network.
2016-07-13 18:37:59 -07:00
Olaoluwa Osuntokun
cad0d54e43
lnd: make the http profiling server optional w/ a config param 2016-06-21 13:12:51 -07:00
Olaoluwa Osuntokun
fcff17c336
multi: change all imports to roasbeef's forks
This commit will allow the general public to build lnd without jumping
through hoops setting up their local git branches nicely with all of
our forks.
2016-05-15 17:22:37 +03:00
Olaoluwa Osuntokun
3e3c028313 default net params to segnet4 2016-04-24 12:36:45 -07:00
Olaoluwa Osuntokun
670d441dea finalize initial draft of config.go
lnd now supports parsing configuration via the command line, and its
dedicated AppDataDir
2016-03-22 18:44:17 -07:00
Olaoluwa Osuntokun
90063e1431 run go fmt on config file 2016-03-22 13:30:54 -07:00
mkl
e07086a523 Integrate basic configuration functionality 2016-03-22 13:28:56 -07:00
Olaoluwa Osuntokun
a10a678505 add some daemon related skeleton files 2015-12-26 00:09:17 -06:00