Commit Graph

141 Commits

Author SHA1 Message Date
Johan T. Halseth
cff42e06c8
pilot+lnd: let autopilot.Manager manage pilot-agent
This commit moves the responsibility of managing the life cycle of the
autopilot from main to the autopilot Manager. It utilizes the recently
introduced autopilot Manager, and just sets up the necessary interfaces
for the Manager to properly set up the required subscriptions when
starting the agent.
2018-12-13 12:26:29 +01:00
Olaoluwa Osuntokun
a8ac3cfe7d
lnd+rpc: fix linter errors 2018-11-28 20:57:10 -08:00
Olaoluwa Osuntokun
ff47ade13b
lnd+rpc: modify rpcServer to fully manaage listeners and gRPC, handle sub-servers
In this commit, we modify the existing rpcServer to fully manage the
macaroons, gRPC server, and also seek out and create all sub-servers.
With this change, the RPC server gains more responsibility, as it
becomes the "root" server in the hierarchy of gRPC sub-servers.

In addition to creating each sub-server, it will also merge the set of
macaroon permissions for each sub-server, with the permissions of the
rest of the RPC infra. As a result, each sub-server is able to
independently specify what it needs w.r.t macaroon permissions and have
that taken care of by the RPC server. In order to achieve this, we need
to unify the creation of the RPC interceptors, and also fully manage the
gRPC server ourselves.

Some examples with various build configs:
```
⛰i  make build
 Building debug lnd and lncli.
go build -v -tags="dev" -o lnd-debug -ldflags "-X github.com/lightningnetwork/lnd/build.Commit=v0.5-beta-143-gb2069914c4b76109b7c59320dc48f8a5f30deb75-dirty" github.com/lightningnetwork/lnd
go build -v -tags="dev" -o lncli-debug -ldflags "-X github.com/lightningnetwork/lnd/build.Commit=v0.5-beta-143-gb2069914c4b76109b7c59320dc48f8a5f30deb75-dirty" github.com/lightningnetwork/lnd/cmd/lncli

⛰i  ./lnd-debug --debuglevel=debug --signrpc.signermacaroonpath=~/sign.macaroon
unknown flag `signrpc.signermacaroonpath'
unknown flag `signrpc.signermacaroonpath'

⛰i  make build tags=signerrpc
 Building debug lnd and lncli.
go build -v -tags="dev signerrpc" -o lnd-debug -ldflags "-X github.com/lightningnetwork/lnd/build.Commit=v0.5-beta-143-gb2069914c4b76109b7c59320dc48f8a5f30deb75-dirty" github.com/lightningnetwork/lnd
go build -v -tags="dev signerrpc" -o lncli-debug -ldflags "-X github.com/lightningnetwork/lnd/build.Commit=v0.5-beta-143-gb2069914c4b76109b7c59320dc48f8a5f30deb75-dirty" github.com/lightningnetwork/lnd/cmd/lncli

⛰i  ./lnd-debug --debuglevel=debug --signrpc.signermacaroonpath=~/sign.macaroon
2018-10-22 17:31:01.132 [INF] LTND: Version: 0.5.0-beta commit=v0.5-beta-143-gb2069914c4b76109b7c59320dc48f8a5f30deb75-dirty, build=development, logging=default
2018-10-22 17:31:01.133 [INF] LTND: Active chain: Bitcoin (network=simnet)
2018-10-22 17:31:01.140 [INF] CHDB: Checking for schema update: latest_version=6, db_version=6
2018-10-22 17:31:01.236 [INF] LTND: Primary chain is set to: bitcoin
2018-10-22 17:31:02.391 [INF] LNWL: Opened wallet
2018-10-22 17:31:03.315 [INF] LNWL: The wallet has been unlocked without a time limit
2018-10-22 17:31:03.315 [INF] LTND: LightningWallet opened
2018-10-22 17:31:03.319 [INF] LNWL: Catching up block hashes to height 3060, this will take a while...
2018-10-22 17:31:03.320 [INF] HSWC: Restoring in-memory circuit state from disk
2018-10-22 17:31:03.320 [INF] LNWL: Done catching up block hashes
2018-10-22 17:31:03.320 [INF] HSWC: Payment circuits loaded: num_pending=0, num_open=0
2018-10-22 17:31:03.322 [DBG] LTND: Populating dependencies for sub RPC server: Signrpc
```

As for the config, an example is:
```
[signrpc]
signrpc.signermacaroonpath=~/signer.macaroon
```
2018-11-28 20:57:06 -08:00
Olaoluwa Osuntokun
3fda1029c0
Merge pull request #1786 from Roasbeef/golang-1.1
build+docs: bump to golang 1.11
2018-10-08 13:26:07 +09:00
Olaoluwa Osuntokun
d8e6085c17
multi: update to go 1.11 gofmt 2018-10-07 14:37:38 +09:00
Conner Fromknecht
0903fe3183
main+lnd: display build.Version() for commit hash 2018-10-05 13:04:45 +09:00
Conner Fromknecht
bbceec8bea
lnd: log shutdown before closing rotator 2018-10-05 13:04:45 +09:00
Olaoluwa Osuntokun
c5ece1e509
Merge pull request #1843 from cfromknecht/change-noencryptwallet
Start deprecating noencryptwallet
2018-09-12 21:07:23 -07:00
Olaoluwa Osuntokun
1ac1092aaa
lnd: ensure that we set the wallet birthday for --noencryptwallet
In this commit, we ensure that we always set the wallet birthday. If the
user has provided a seed, or is creating a new one, then it will be
overwritten below. However, before this commit, if a user started with
the --noencryptwallet flag, then we would _always_ start to rescan from
genesis with the recent bug fix to ensure that we always start after the
birthday.
2018-09-05 18:58:48 -07:00
Conner Fromknecht
fb3ace9b28
lnd: use default enc pw when noseedbackup is passed 2018-09-04 20:52:43 -07:00
Wilmer Paulino
9981fd8fa7 config+lnd: create macaroons files under the network dir
Co-Authored-By: Karl Ranna <karl@karlranna.com>
2018-08-23 18:05:00 -07:00
Conner Fromknecht
cf2c371042
multi: fix linting errors 2018-08-02 18:20:50 -07:00
Olaoluwa Osuntokun
33979b2636
funding+server: move initialization of funding manager into the server
In this commit, we move the initialization of the server into the
funding manager itself. We do this as it's no longer the case that _any_
RPC needs to access the funding manager. In the past, this was the
only reason that the funding manager was instantiated outside of the
server: to be able to respond to queries _before_ the server was
started.

This change also fixes a bug as atm, the funding manager will try to
register for notifications _before_ the ChainNotifier itself has fully
started.
2018-08-01 16:02:55 -07:00
Wilmer Paulino
38e01b259f
fundingmanager+lnd: remove no longer needed FindPeer and SendToPeer
callbacks

The FindPeer and SendToPeer callbacks are no longer needed within the
fundingManager due to the previous commit allowing us to send messages
to peers directly.
2018-07-19 12:34:12 -07:00
Wilmer Paulino
6b1982f50f
fundingmanager+lnd: modify WatchNewChannel callback to take in peer key 2018-07-19 12:32:30 -07:00
Olaoluwa Osuntokun
6f60f139f4 multi: switch over import paths from roasbeef/* to btcsuite/* 2018-07-13 17:05:39 -07:00
Olaoluwa Osuntokun
076fc71261
lnd: only print shutdown message if logs are initialized
In this commit, we fix a slight bug recently introduced by the addition
of the new signal package. As we now use a regular defer for many
actions, it may be possible that the logs aren't yet initialized (for
example, lnd -h), which can cause a panic if the shutdown procedure goes
to log before the logs have been initialized.
2018-06-29 12:18:19 -07:00
Conner Fromknecht
95440bc723
lnd: switch to lnd signal package 2018-06-28 16:17:02 -07:00
Oliver Gugger
c1b1dd96ef
lncfg: move configuration helper methods to new package 2018-06-14 08:19:09 +02:00
Oliver Gugger
460fa25871
config+lnd+server: add unix socket support 2018-06-14 08:19:09 +02:00
Oliver Gugger
7303a65ad1 lnd: use unlocked wallet from WalletUnlocker for chain control 2018-06-12 19:27:57 -07:00
Wilmer Paulino
978fc7ba08
config+lnd: update tor config to include onion services flags
In this commit, we update the set of Tor flags to use sane defaults when
not specified. We also include some new flags related to the recent
onion services changes. This allows users to easily get set up on Tor by
only specifying the tor.active flag. If needed, the defaults can still
be overridden.
2018-06-04 20:41:40 -07:00
Wilmer Paulino
58a3419283
lnd+walletunlocker: implement ChangePassword RPC 2018-05-31 17:24:00 -07:00
Wilmer Paulino
1a47d182d3
lnd+lnwallet: extract default wallet password vars into lnwallet 2018-05-31 17:23:58 -07:00
Wilmer Paulino
b32e0ced45
lnd+walletunlocker: remove macaroon dependency from UnlockerService 2018-05-31 17:23:57 -07:00
Kazato Sugimoto
9eef31d210 lnd: fix typo in log message on launch
`2018-05-24 01:14:14.503 [INF] LTND: Active chain: Bitcoin (network=simmnet)`
2018-05-24 14:56:33 -07:00
Wilmer Paulino
4a200d28eb
lnd: add interrupt handler to handle shutdown requests while syncing
chain backend
2018-05-23 11:26:07 -04:00
Oliver Gugger
3eff9804ee macaroons: add technical documentation, fix comments 2018-05-18 10:13:25 +02:00
Wilmer Paulino
2e076ba21e
fundingmanager+lnd: propose remote channel reserve above dust limit 2018-05-14 14:20:19 -04:00
Conner Fromknecht
d6628574ca
lnd: remove sid arg to UpdateShortChanID 2018-05-09 16:07:52 -07:00
Johan T. Halseth
cdf60b5f9d
lnd: remove ArbiterChan 2018-05-02 08:43:31 +02:00
Conner Fromknecht
603228ce79
lnd: threads recovery window param from walletunlocker 2018-04-26 16:03:27 -07:00
yohei okada
0720e83840 main: Stop setting GOMAXPROCS to NumCPU explicitly (#1096)
GOMAXPROCS will be set automatically after Go 1.5. The minimum version
supported at the moment is 1.9, so setting GOMAXPROCS to NumCPU is not
necessary anymore.

References
https://docs.google.com/document/d/1At2Ls5_fhJQ59kDK2DFVhFu3g5mATSXqqV5QrxinasI/edit
https://tip.golang.org/doc/go1.5#introduction
2018-04-17 18:59:23 -07:00
Olaoluwa Osuntokun
b422e4ec1e
lnwallet+funding+lnd: add new config option for min accepted channel size
In this commit we add a new command line option (and a sane default) to
allow users to specify the *smallest* inbound channel that they'll
accept. Having a higher-ish limit lets users limit their channels, and
also avoid a series of very low value "spam" channels.

The new option is --minchansize, and expressed in satoshis. If we
receive an inbound channel request for a value smaller than this, then
we'll immediately reject it.
2018-04-02 16:17:58 -07:00
Conner Fromknecht
7db7c9c493
lnd: correct docs in WatchNewChannel 2018-03-31 02:00:06 -07:00
Olaoluwa Osuntokun
956d20ebdc
funding+lnd: ensure we reconnect to new channel peers
In this commit, we fix a minor bug in the prior versions of lnd. Before
this commit, if we received a new inbound connection for channel
creation, the channel was created, and then the peer disconnected, we
wouldn't automatically reconnect.

In this commit we fix this issue by overloading the WatchNewChannel
method to also accept the peer's ID so we can add it to the set of
persistent connections.
2018-03-30 18:42:40 -07:00
Conner Fromknecht
3d29e9dc66
lnd: add Commit hook for git hash -ldflag 2018-03-28 18:19:15 -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
71a5fac9c7
lnd+config: add flags for mainnet 2018-03-15 06:38:45 -07:00
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