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
+18 -10
+18 -10
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"
@@ -16,41 +17,47 @@ var activeNetParams = bitcoinTestNetParams
// corresponding RPC port of a daemon running on the particular network. // corresponding RPC port of a daemon running on the particular network.
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
// corresponding RPC port of a daemon running on the particular network. // corresponding RPC port of a daemon running on the particular network.
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
// test network. // test network.
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
// network. // network.
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
// test network. // test network.
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
} }