From 35fc4f48f78db59fbaab69e80945ebd13942d7e0 Mon Sep 17 00:00:00 2001 From: Nalin Bhardwaj Date: Thu, 22 Mar 2018 00:42:46 +0530 Subject: [PATCH 1/3] sample-lnd.conf: Litecoin fixes Fixes litecoin related configurations. Changes bitcoind.zmqpath to be consistent with recent changes. --- sample-lnd.conf | 40 ++++++++++++++++++++++++++++++---------- 1 file changed, 30 insertions(+), 10 deletions(-) diff --git a/sample-lnd.conf b/sample-lnd.conf index 59fe1f8a..569e1050 100644 --- a/sample-lnd.conf +++ b/sample-lnd.conf @@ -187,7 +187,7 @@ bitcoin.node=btcd ; bitcoind. By 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). -; bitcoind.zmqpath=tcp://127.0.0.1:18501 +; bitcoind.zmqpath=tcp://127.0.0.1:28332 [neutrino] @@ -207,18 +207,14 @@ bitcoin.node=btcd ; active. ; litecoin.active=1 -; Use Bitcoin's test network. +; Use Litecoin's test network. ; litecoin.testnet=1 -; -; Use Bitcoin's simulation test network -litecoin.simnet=1 -; Use Bitcoin's regression test network -; litecoin.regtest=false +; Use the ltcd back-end +litecoin.node=ltcd -; Use the ltcd back-end (marked as btcd). No other back-end type is currently -; supported for litecoin. -litecoin.node=btcd +; Use the litecoind back-end +; litecoin.node=litecoind [Ltcd] @@ -248,6 +244,30 @@ litecoin.node=btcd ; ltcd.rawrpccert= +[Litecoind] + +; The host that your local litecoind daemon is listening on. By default, this +; setting is assumed to be localhost with the default port for the current +; network. +; litecoind.rpchost=localhost + +; Username for RPC connections to litecoind. By default, lnd will attempt to +; automatically obtain the credentials, so this likely won't need to be set +; (other than for a remote litecoind instance). +; litecoind.rpcuser=kek + +; Password for RPC connections to litecoind. By default, lnd will attempt to +; automatically obtain the credentials, so this likely won't need to be set +; (other than for a remote litecoind instance). +; litecoind.rpcpass=kek + +; ZMQ socket which sends rawblock and (optionally) rawtx notifications from +; litecoind. By 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). +; litecoind.zmqpath=tcp://127.0.0.1:28332 + + [autopilot] ; If the autopilot agent should be active or not. The autopilot agent will From b2a4901aff728e8dde4202bc22dd3de8acda607b Mon Sep 17 00:00:00 2001 From: Nalin Bhardwaj Date: Sat, 24 Mar 2018 14:56:48 +0530 Subject: [PATCH 2/3] chainparams: create isTestnet function Tests if passed parameters correspond to a testnet configuration. --- chainparams.go | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/chainparams.go b/chainparams.go index 20510aa3..fa726bb3 100644 --- a/chainparams.go +++ b/chainparams.go @@ -3,10 +3,11 @@ package main import ( "github.com/lightningnetwork/lnd/keychain" litecoinCfg "github.com/ltcsuite/ltcd/chaincfg" + litecoinWire "github.com/ltcsuite/ltcd/wire" "github.com/roasbeef/btcd/chaincfg" bitcoinCfg "github.com/roasbeef/btcd/chaincfg" "github.com/roasbeef/btcd/chaincfg/chainhash" - "github.com/roasbeef/btcd/wire" + bitcoinWire "github.com/roasbeef/btcd/wire" ) // activeNetParams is a pointer to the parameters specific to the currently @@ -82,7 +83,7 @@ var regTestNetParams = bitcoinNetParams{ // abstract over _which_ chain (or fork) the parameters are for. func applyLitecoinParams(params *bitcoinNetParams, litecoinParams *litecoinNetParams) { params.Name = litecoinParams.Name - params.Net = wire.BitcoinNet(litecoinParams.Net) + params.Net = bitcoinWire.BitcoinNet(litecoinParams.Net) params.DefaultPort = litecoinParams.DefaultPort params.CoinbaseMaturity = litecoinParams.CoinbaseMaturity @@ -116,3 +117,14 @@ func applyLitecoinParams(params *bitcoinNetParams, litecoinParams *litecoinNetPa params.rpcPort = litecoinParams.rpcPort params.CoinType = litecoinParams.CoinType } + +// isTestnet tests if the given params correspond to a testnet +// parameter configuration. +func isTestnet(params *bitcoinNetParams) bool { + switch params.Params.Net { + case bitcoinWire.TestNet3, bitcoinWire.BitcoinNet(litecoinWire.TestNet4): + return true + default: + return false + } +} From bca87535b3e590174b35f25f0f12682f66b465cb Mon Sep 17 00:00:00 2001 From: Nalin Bhardwaj Date: Sat, 24 Mar 2018 14:58:20 +0530 Subject: [PATCH 3/3] rpcserver: fix GetInfo testnet detection Fixes bug with Litecoin testnet detection. --- rpcserver.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/rpcserver.go b/rpcserver.go index 2a8c6d09..dda85214 100644 --- a/rpcserver.go +++ b/rpcserver.go @@ -29,7 +29,6 @@ import ( "github.com/lightningnetwork/lnd/zpay32" "github.com/roasbeef/btcd/blockchain" "github.com/roasbeef/btcd/btcec" - "github.com/roasbeef/btcd/chaincfg" "github.com/roasbeef/btcd/chaincfg/chainhash" "github.com/roasbeef/btcd/txscript" "github.com/roasbeef/btcd/wire" @@ -1230,7 +1229,7 @@ func (r *rpcServer) GetInfo(ctx context.Context, BlockHeight: uint32(bestHeight), BlockHash: bestHash.String(), SyncedToChain: isSynced, - Testnet: activeNetParams.Params == &chaincfg.TestNet3Params, + Testnet: isTestnet(&activeNetParams), Chains: activeChains, Uris: uris, Alias: nodeAnn.Alias.String(),