chainparams: add CoinType to parameters for HD derivation

This commit is contained in:
Conner Fromknecht committed 2018-03-13 16:33:45 -07:00
1 parent 4ced071a7d
commit 55da4cc547
1 file changed
+8
+8
View File
@@ -1,6 +1,7 @@
package main package main
import ( import (
"github.com/lightningnetwork/lnd/keychain"
litecoinCfg "github.com/ltcsuite/ltcd/chaincfg" litecoinCfg "github.com/ltcsuite/ltcd/chaincfg"
"github.com/roasbeef/btcd/chaincfg" "github.com/roasbeef/btcd/chaincfg"
bitcoinCfg "github.com/roasbeef/btcd/chaincfg" bitcoinCfg "github.com/roasbeef/btcd/chaincfg"
@@ -17,6 +18,7 @@ var activeNetParams = bitcoinTestNetParams
type bitcoinNetParams struct { type bitcoinNetParams struct {
*bitcoinCfg.Params *bitcoinCfg.Params
rpcPort string rpcPort string
CoinType uint32
} }
// litecoinNetParams couples the p2p parameters of a network with the // litecoinNetParams couples the p2p parameters of a network with the
@@ -24,6 +26,7 @@ type bitcoinNetParams struct {
type litecoinNetParams struct { type litecoinNetParams struct {
*litecoinCfg.Params *litecoinCfg.Params
rpcPort string rpcPort string
CoinType uint32
} }
// bitcoinTestNetParams contains parameters specific to the 3rd version of the // bitcoinTestNetParams contains parameters specific to the 3rd version of the
@@ -31,6 +34,7 @@ type litecoinNetParams struct {
var bitcoinTestNetParams = bitcoinNetParams{ var bitcoinTestNetParams = bitcoinNetParams{
Params: &bitcoinCfg.TestNet3Params, Params: &bitcoinCfg.TestNet3Params,
rpcPort: "18334", rpcPort: "18334",
CoinType: keychain.CoinTypeTestnet,
} }
// bitcoinSimNetParams contains parameters specific to the simulation test // bitcoinSimNetParams contains parameters specific to the simulation test
@@ -38,6 +42,7 @@ var bitcoinTestNetParams = bitcoinNetParams{
var bitcoinSimNetParams = bitcoinNetParams{ var bitcoinSimNetParams = bitcoinNetParams{
Params: &bitcoinCfg.SimNetParams, Params: &bitcoinCfg.SimNetParams,
rpcPort: "18556", rpcPort: "18556",
CoinType: keychain.CoinTypeTestnet,
} }
// liteTestNetParams contains parameters specific to the 4th version of the // liteTestNetParams contains parameters specific to the 4th version of the
@@ -45,12 +50,14 @@ var bitcoinSimNetParams = bitcoinNetParams{
var liteTestNetParams = litecoinNetParams{ var liteTestNetParams = litecoinNetParams{
Params: &litecoinCfg.TestNet4Params, Params: &litecoinCfg.TestNet4Params,
rpcPort: "19334", rpcPort: "19334",
CoinType: keychain.CoinTypeTestnet,
} }
// regTestNetParams contains parameters specific to a local regtest network. // regTestNetParams contains parameters specific to a local regtest network.
var regTestNetParams = bitcoinNetParams{ var regTestNetParams = bitcoinNetParams{
Params: &bitcoinCfg.RegressionNetParams, Params: &bitcoinCfg.RegressionNetParams,
rpcPort: "18334", rpcPort: "18334",
CoinType: keychain.CoinTypeTestnet,
} }
// applyLitecoinParams applies the relevant chain configuration parameters that // applyLitecoinParams applies the relevant chain configuration parameters that
@@ -91,4 +98,5 @@ func applyLitecoinParams(params *bitcoinNetParams) {
params.Checkpoints = checkPoints params.Checkpoints = checkPoints
params.rpcPort = liteTestNetParams.rpcPort params.rpcPort = liteTestNetParams.rpcPort
params.CoinType = liteTestNetParams.CoinType
} }