Commit Graph

63 Commits

Author SHA1 Message Date
Olaoluwa Osuntokun
10910318a2
lnd: extract neutrino initialization to new function 2019-03-13 17:20:38 -07:00
Wilmer Paulino
1fe6599fd8 lnd+chainregistry: initialize neutrino light client before wallet setup
In this commit, we slightly refactor the startup of lnd when running
with a Neutrino light client backend. We'll now begin syncing our
backend as soon as lnd starts and passes all configuration checks. Since
this is all done before lnd's wallet setup, the light client will be
syncing in the background while the user notes/inputs their wallet seed.
This is done in order to provide a better UX from the point of the user,
such that most of the chain will already be synced by the time they get
to deposit funds into the wallet.
2019-03-13 16:46:50 -07:00
Johan T. Halseth
c1ab49909f
Merge pull request #2517 from roeierez/chain_control_cleanup
Proper cleanup neutrino database in case of error
2019-02-07 17:26:44 +01:00
Joost Jager
9e012ecc93
multi: move Input interface and related code
This commit is a step to split the lnwallet package. It puts the Input
interface and implementations in a separate package along with all their
dependencies from lnwallet.
2019-01-31 13:25:33 +01:00
Roei Erez
ff172bdd3a proper cleanup neutrino database in case of error 2019-01-28 18:21:26 +02:00
Wilmer Paulino
c72da48111
multi: update to latest ChainNotifier impl New method 2019-01-21 13:57:43 -08:00
Joost Jager
91f3df07e4
lnwallet: prevent static fee estimator fees from being modified
Modifying the static fees is not thread safe. In this commit the fees
are made immutable.
2018-12-18 10:50:05 +01:00
Olaoluwa Osuntokun
b492114016
chainregistry: add the keyRing and walletController to chainControl 2018-12-06 16:25:35 -08:00
Wilmer Paulino
7d94c65afc
Revert "chainregistry: disable height hint cache"
This reverts commit 0e29a457e1f38b2841019dc6664de1697aa84b34.
2018-10-31 09:20:22 -07:00
Wilmer Paulino
2fa64dd6ff multi: update to new BitcoindClient API 2018-09-12 21:05:19 -07:00
Conner Fromknecht
0e29a457e1
chainregistry: disable height hint cache 2018-08-26 15:32:10 -07:00
Wilmer Paulino
4c2a0970b4
chainregistry: modify backends to use a height hint cache 2018-08-21 13:02:15 -04:00
Wilmer Paulino
dae5382fd4
chainregistry: correctly establish connection to bitcoind
In this commit, we fix a bug recently introduced where we would
construct the parameters required to connect to a bitcoind backend, but
never actually started the connection.
2018-08-09 23:29:49 -07:00
Wilmer Paulino
9d2eeb6304
multi: update to latest fee estimation interface 2018-08-09 17:29:52 -07:00
Wilmer Paulino
936fcc1f16
multi: update to latest BitcoindClient interface
In this commit, we introduce a nice optimization with regards to lnd's
interaction with a bitcoind backend. Within lnd, we currently have three
different subsystems responsible for watching the chain: chainntnfs,
lnwallet, and routing/chainview. Each of these subsystems has an active
RPC and ZMQ connection to the underlying bitcoind node. This would incur
a toll on the underlying bitcoind node and would cause us to miss ZMQ
events, which are crucial to lnd. We remedy this issue by sharing the
same connection to a bitcoind node between the different clients within
lnd.
2018-08-08 20:26:30 -07:00
Olaoluwa Osuntokun
71dfb1cdb1
build: update glide to point to latest neutrino+btcwallet 2018-07-13 17:15:13 -07:00
Olaoluwa Osuntokun
6f60f139f4 multi: switch over import paths from roasbeef/* to btcsuite/* 2018-07-13 17:05:39 -07:00
maurycy
ee65605495 chainregistry: fix ActiveChains comment 2018-07-10 16:57:09 -07:00
Oliver Gugger
8f2a8d6682 chainregistry: pass initialized wallet to chain control 2018-06-12 19:27:56 -07:00
Wilmer Paulino
e363766394
multi: increase max funding and payment amount 60x under Litecoin 2018-05-25 00:11:20 -04:00
Conner Fromknecht
1972a795e5
chainregistry: initialize wallet w/ recovery window 2018-04-26 16:03:27 -07:00
Wilmer Paulino
ead9555d40
chainregistry: remove txindex requirement for btcd and bitcoind
Now that we have a fallback method for when the transaction index is not
enabled, its requirement to be enabled for a full node is no longer
needed, so we can safely remove this check.
2018-04-17 14:59:52 -04:00
Olaoluwa Osuntokun
0162b93e13
Merge pull request #957 from cfromknecht/bump-ltc-dust-limit
chainregistery: correct ltc dust limit
2018-03-28 16:10:42 -07:00
ftufek
6c00de1865 neutrino: stop the chainservice before node DB
When in neutrino mode, it seems that the node is not closed during the cleanup, so if a block is received between the time the DB is closed and the server is closed (or if the process is still running after the server is shutdown like on a mobile app), the code panic's and crashes with:

panic: unable to write block header: database not open
goroutine 41 [running]:
github.com/lightningnetwork/lnd/vendor/github.com/lightninglabs/neutrino.(*blockManager).handleHeadersMsg(0x9a1ec0a0, 0x9a3e6030)
/ext-go/1/src/github.com/lightningnetwork/lnd/vendor/github.com/lightninglabs/neutrino/blockmanager.go:1164 +0x2224
github.com/lightningnetwork/lnd/vendor/github.com/lightninglabs/neutrino.(*blockManager).blockHandler(0x9a1ec0a0)
/ext-go/1/src/github.com/lightningnetwork/lnd/vendor/github.com/lightninglabs/neutrino/blockmanager.go:347 +0x3b4
created by github.com/lightningnetwork/lnd/vendor/github.com/lightninglabs/neutrino.(*blockManager).Start
/ext-go/1/src/github.com/lightningnetwork/lnd/vendor/github.com/lightninglabs/neutrino/blockmanager.go:200 +0xe8


Here's a log of shutdown before the change:
[INF] LTND: Gracefully shutting down the server...
[INF] FNDG: Funding manager shutting down
[INF] SPHX: Block epoch canceled, decaying hash log shutting down
[INF] CRTR: Channel Router shutting down
[INF] CRTR: FilteredChainView stopping
[INF] HSWC: HTLC Switch shutting down
[INF] UTXN: UTXO nursery shutting down
[INF] BRAR: Breach arbiter shutting down
[INF] DISC: Authenticated Gossiper is stopping
[INF] CNCT: Stopping ChainArbitrator
[INF] LTND: Shutdown complete


And here's a log of shutdown after the change:
[INF] LTND: Gracefully shutting down the server...
[INF] FNDG: Funding manager shutting down
[INF] SPHX: Block epoch canceled, decaying hash log shutting down
[INF] CRTR: Channel Router shutting down
[INF] CRTR: FilteredChainView stopping
[INF] HSWC: HTLC Switch shutting down
[INF] UTXN: UTXO nursery shutting down
[INF] BRAR: Breach arbiter shutting down
[INF] DISC: Authenticated Gossiper is stopping
[INF] CNCT: Stopping ChainArbitrator
[INF] LTND: Shutdown complete
[INF] BTCN: Block manager shutting down
[INF] BTCN: Address manager shutting down
2018-03-28 15:18:07 -07:00
Conner Fromknecht
8fd7b38e05
chainregistery: correct ltc dust limit
Corrects the ltc dust limit, making it 54600.
2018-03-28 01:02:07 -07:00
Olaoluwa Osuntokun
8f4a8fcf57
chains: add DNS seeds for mainnet BTC and LTC 2018-03-15 02:00:19 -07:00
Olaoluwa Osuntokun
68f842d90b
chains: add genesis hashes for BTC and LTC mainnet 2018-03-15 01:58:35 -07:00
Olaoluwa Osuntokun
620b552413
chains: switch to new DNS seed for bitcoin testnet
In this commit we switch over to the new DNS seed for Bitcoin’s
testnet. This seed will only serve active nodes that are found on
Bitcoin’s testnet.
2018-03-14 18:27:24 -07:00
Olaoluwa Osuntokun
0cd2448f49 chains: specify that current btc+ltc genesis hashes are for testnet 2018-03-14 18:24:26 -07:00
Conner Fromknecht
5f7a62913f
chainregistry: generalize bitcoind logic to handle litecoind 2018-03-14 16:57:37 -07:00
Conner Fromknecht
2447f3097f
chainregistry: init secret key ring wth CoinType from params 2018-03-13 16:33:45 -07:00
Olaoluwa Osuntokun
9981c4ce38
lnd: populate the secret key ring in the lnwallet config 2018-03-06 16:04:05 -05:00
Johan T. Halseth
6d5c0679f4
chainregistry: express fee rates in sat/vbyte 2018-02-26 22:42:25 +01: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
Conner Fromknecht
d0afac0407 chainregistry: move neutrino database to chain dir 2018-01-31 17:37:08 -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
10bd46ac72
chainregistry: use forwarding policy rules from config
This commit removes the definitions of
defaultBitcoinForwardingPolicy and defaultLitecoinForwardingPolicy
from the the chainregistry, and instead creates a routingPolicy
from the values found in the config.
2018-01-12 22:56:44 +01:00
Olaoluwa Osuntokun
f50b911ebc lnd: if using btcd backend, ensure that --txindex is active
In this commit, we add a new runtime assertion to ensure that the
backed btcd node (if this mode is active) has the proper indexes set
up. Atm, if btcd isn’t running with the txindex active, then the
current ChainNotifier implementation will be unable to properly handle
certain classes of historical notification dispatches.

In order to test that the running btcd node is configured properly,
we’ll fetch the latest block, then try to query a transaction within
that block using the txindex. If btcd isn’t running with this mode
active, then the request will fail. In this case, we’ll then fail to
start lnd with an error.

Fixes #525.
2018-01-08 19:47:37 -08:00
Olaoluwa Osuntokun
a036098e36
chains: increase default MInHTLC value to 1000 mSAT (1 SAT) 2017-12-13 17:10:30 -08:00
Olaoluwa Osuntokun
30b4ab2c74
chains: use proper genesis hash for Bitcoin's testnet 2017-12-02 18:04:08 -08:00
Olaoluwa Osuntokun
4d6cd2ee36
chain: the default minHTLC policy is now 1 2017-11-30 22:54:39 -08:00
Olaoluwa Osuntokun
f4f476fe9f
chainregistry: also disable fee estimation for regtest 2017-11-29 16:15:09 -08:00
Olaoluwa Osuntokun
ad364ae9a1
chains+server: if not in simnet mode, use BtcdFeeEstimator 2017-11-23 23:10:12 -06:00
Olaoluwa Osuntokun
991a2fbb5f
chainregistry: add shim for TCP fallback for current DNS seed 2017-10-30 19:02:56 -07: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
62dc6b81d2 chainregistry: take wallet password as parameter to newChainControlFromConfig
This let the caller of newChainControlFromConfig set the password
to be used when creating or unlocking the wallet database. The
provided password is used both as private and public password.
2017-10-19 19:17:35 -07:00
Olaoluwa Osuntokun
fe0a7b6a09
multi: fix linter errors 2017-09-03 17:05:11 -07:00
Olaoluwa Osuntokun
74ef963124
chains: add a set of BOLT-0010 DNS seeds for bitcoin 2017-09-03 16:53:33 -07:00
Olaoluwa Osuntokun
d5cc0441f4
chains: use distinct StaticFeeEstimator instances for Bitcoin and Litecoin 2017-09-03 16:53:09 -07:00
Olaoluwa Osuntokun
9f0efddc20
multi: switch from btcrpcclient to rpcclient 2017-08-24 18:54:24 -07:00