Merge pull request #1717 from wpaulino/start-bitcoind-conn

chainregistry: correctly establish connection to bitcoind
This commit is contained in:
Olaoluwa Osuntokun 2018-08-10 01:07:07 -07:00 committed by GitHub
commit 6989316b11
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 11 deletions

@ -305,6 +305,8 @@ func newChainControlFromConfig(cfg *config, chanDB *channeldb.DB,
} }
} }
// Establish the connection to bitcoind and create the clients
// required for our relevant subsystems.
bitcoindConn, err := chain.NewBitcoindConn( bitcoindConn, err := chain.NewBitcoindConn(
activeNetParams.Params, bitcoindHost, activeNetParams.Params, bitcoindHost,
bitcoindMode.RPCUser, bitcoindMode.RPCPass, bitcoindMode.RPCUser, bitcoindMode.RPCPass,
@ -315,14 +317,13 @@ func newChainControlFromConfig(cfg *config, chanDB *channeldb.DB,
return nil, nil, err return nil, nil, err
} }
if err := bitcoindConn.Start(); err != nil {
return nil, nil, fmt.Errorf("unable to connect to "+
"bitcoind: %v", err)
}
cc.chainNotifier = bitcoindnotify.New(bitcoindConn) cc.chainNotifier = bitcoindnotify.New(bitcoindConn)
// Next, we'll create an instance of the bitcoind chain view to
// be used within the routing layer.
cc.chainView = chainview.NewBitcoindFilteredChainView(bitcoindConn) cc.chainView = chainview.NewBitcoindFilteredChainView(bitcoindConn)
// Create a special rpc+ZMQ client for bitcoind which will be
// used by the wallet for notifications, calls, etc.
walletConfig.ChainSource = bitcoindConn.NewBitcoindClient(birthday) walletConfig.ChainSource = bitcoindConn.NewBitcoindClient(birthday)
// If we're not in regtest mode, then we'll attempt to use a // If we're not in regtest mode, then we'll attempt to use a

@ -262,7 +262,7 @@ with `bitcoind` as your backend (as with `bitcoind`, you can create an
`lnd.conf` to save these options, more info on that is described further below): `lnd.conf` to save these options, more info on that is described further below):
``` ```
lnd --bitcoin.active --bitcoin.testnet --debuglevel=debug --bitcoin.node=bitcoind --bitcoind.rpcuser=REPLACEME --bitcoind.rpcpass=REPLACEME --bitcoind.zmqpubrawblock=tcp://127.0.0.1:28332 --bitcoind.zmqpubrawblock=tcp://127.0.0.1:28333 --externalip=X.X.X.X lnd --bitcoin.active --bitcoin.testnet --debuglevel=debug --bitcoin.node=bitcoind --bitcoind.rpcuser=REPLACEME --bitcoind.rpcpass=REPLACEME --bitcoind.zmqpubrawblock=tcp://127.0.0.1:28332 --bitcoind.zmqpubrawtx=tcp://127.0.0.1:28333 --externalip=X.X.X.X
``` ```
*NOTE:* *NOTE:*

@ -208,8 +208,8 @@ bitcoin.node=btcd
; ZMQ socket which sends rawblock and rawtx notifications from bitcoind. By ; ZMQ socket which sends rawblock and rawtx notifications from bitcoind. By
; default, lnd will attempt to automatically obtain this information, so this ; default, lnd will attempt to automatically obtain this information, so this
; likely won't need to be set (other than for a remote bitcoind instance). ; likely won't need to be set (other than for a remote bitcoind instance).
; bitcoind.zmqblockhost=tcp://127.0.0.1:28332 ; bitcoind.zmqpubrawblock=tcp://127.0.0.1:28332
; bitcoind.zmqtxhost=tcp://127.0.0.1:28333 ; bitcoind.zmqpubrawtx=tcp://127.0.0.1:28333
[neutrino] [neutrino]
@ -286,8 +286,8 @@ litecoin.node=ltcd
; ZMQ socket which sends rawblock and rawtx notifications from litecoind. By ; ZMQ socket which sends rawblock and rawtx notifications from litecoind. By
; default, lnd will attempt to automatically obtain this information, so this ; default, lnd will attempt to automatically obtain this information, so this
; likely won't need to be set (other than for a remote litecoind instance). ; likely won't need to be set (other than for a remote litecoind instance).
; litecoind.zmqblockhost=tcp://127.0.0.1:28332 ; litecoind.zmqpubrawblock=tcp://127.0.0.1:28332
; litecoind.zmqtxhost=tcp://127.0.0.1:28333 ; litecoind.zmqpubrawtx=tcp://127.0.0.1:28333
[autopilot] [autopilot]