Merge pull request #911 from nalinbhardwaj/litecoin

Litecoin fixes
This commit is contained in:
Olaoluwa Osuntokun authored and GitHub committed 2018-03-28 14:59:16 -07:00
commit d5b218b286
3 files changed
+45 -14

No files matched your search

+14 -2
View File
@@ -3,10 +3,11 @@ package main
import ( import (
"github.com/lightningnetwork/lnd/keychain" "github.com/lightningnetwork/lnd/keychain"
litecoinCfg "github.com/ltcsuite/ltcd/chaincfg" litecoinCfg "github.com/ltcsuite/ltcd/chaincfg"
litecoinWire "github.com/ltcsuite/ltcd/wire"
"github.com/roasbeef/btcd/chaincfg" "github.com/roasbeef/btcd/chaincfg"
bitcoinCfg "github.com/roasbeef/btcd/chaincfg" bitcoinCfg "github.com/roasbeef/btcd/chaincfg"
"github.com/roasbeef/btcd/chaincfg/chainhash" "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 // 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. // abstract over _which_ chain (or fork) the parameters are for.
func applyLitecoinParams(params *bitcoinNetParams, litecoinParams *litecoinNetParams) { func applyLitecoinParams(params *bitcoinNetParams, litecoinParams *litecoinNetParams) {
params.Name = litecoinParams.Name params.Name = litecoinParams.Name
params.Net = wire.BitcoinNet(litecoinParams.Net) params.Net = bitcoinWire.BitcoinNet(litecoinParams.Net)
params.DefaultPort = litecoinParams.DefaultPort params.DefaultPort = litecoinParams.DefaultPort
params.CoinbaseMaturity = litecoinParams.CoinbaseMaturity params.CoinbaseMaturity = litecoinParams.CoinbaseMaturity
@@ -116,3 +117,14 @@ func applyLitecoinParams(params *bitcoinNetParams, litecoinParams *litecoinNetPa
params.rpcPort = litecoinParams.rpcPort params.rpcPort = litecoinParams.rpcPort
params.CoinType = litecoinParams.CoinType 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
}
}
+1 -2
View File
@@ -29,7 +29,6 @@ import (
"github.com/lightningnetwork/lnd/zpay32" "github.com/lightningnetwork/lnd/zpay32"
"github.com/roasbeef/btcd/blockchain" "github.com/roasbeef/btcd/blockchain"
"github.com/roasbeef/btcd/btcec" "github.com/roasbeef/btcd/btcec"
"github.com/roasbeef/btcd/chaincfg"
"github.com/roasbeef/btcd/chaincfg/chainhash" "github.com/roasbeef/btcd/chaincfg/chainhash"
"github.com/roasbeef/btcd/txscript" "github.com/roasbeef/btcd/txscript"
"github.com/roasbeef/btcd/wire" "github.com/roasbeef/btcd/wire"
@@ -1230,7 +1229,7 @@ func (r *rpcServer) GetInfo(ctx context.Context,
BlockHeight: uint32(bestHeight), BlockHeight: uint32(bestHeight),
BlockHash: bestHash.String(), BlockHash: bestHash.String(),
SyncedToChain: isSynced, SyncedToChain: isSynced,
Testnet: activeNetParams.Params == &chaincfg.TestNet3Params, Testnet: isTestnet(&activeNetParams),
Chains: activeChains, Chains: activeChains,
Uris: uris, Uris: uris,
Alias: nodeAnn.Alias.String(), Alias: nodeAnn.Alias.String(),
+30 -10
View File
@@ -187,7 +187,7 @@ bitcoin.node=btcd
; bitcoind. By default, lnd will attempt to automatically obtain this ; 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 ; information, so this likely won't need to be set (other than for a remote
; bitcoind instance). ; bitcoind instance).
; bitcoind.zmqpath=tcp://127.0.0.1:18501 ; bitcoind.zmqpath=tcp://127.0.0.1:28332
[neutrino] [neutrino]
@@ -207,18 +207,14 @@ bitcoin.node=btcd
; active. ; active.
; litecoin.active=1 ; litecoin.active=1
; Use Bitcoin's test network. ; Use Litecoin's test network.
; litecoin.testnet=1 ; litecoin.testnet=1
;
; Use Bitcoin's simulation test network
litecoin.simnet=1
; Use Bitcoin's regression test network ; Use the ltcd back-end
; litecoin.regtest=false litecoin.node=ltcd
; Use the ltcd back-end (marked as btcd). No other back-end type is currently ; Use the litecoind back-end
; supported for litecoin. ; litecoin.node=litecoind
litecoin.node=btcd
[Ltcd] [Ltcd]
@@ -248,6 +244,30 @@ litecoin.node=btcd
; ltcd.rawrpccert= ; 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] [autopilot]
; If the autopilot agent should be active or not. The autopilot agent will ; If the autopilot agent should be active or not. The autopilot agent will