Merge pull request #911 from nalinbhardwaj/litecoin

Litecoin fixes
This commit is contained in:
Olaoluwa Osuntokun 2018-03-28 14:59:16 -07:00 committed by GitHub
commit d5b218b286
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 45 additions and 14 deletions

View File

@ -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
}
}

View File

@ -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(),

View File

@ -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