chains: use distinct StaticFeeEstimator instances for Bitcoin and Litecoin

This commit is contained in:
Olaoluwa Osuntokun 2017-09-03 16:53:04 -07:00
parent f823a860c8
commit d5cc0441f4
No known key found for this signature in database
GPG Key ID: 9CC5B105D03521A2

@ -53,8 +53,8 @@ var defaultChannelConstraints = channeldb.ChannelConstraints{
MaxAcceptedHtlcs: lnwallet.MaxHTLCNumber / 2,
}
// chainCode is an enum-like structure for keeping track of the chains currently
// supported within lnd.
// chainCode is an enum-like structure for keeping track of the chains
// currently supported within lnd.
type chainCode uint32
const (
@ -112,34 +112,37 @@ func newChainControlFromConfig(cfg *config, chanDB *channeldb.DB) (*chainControl
ltndLog.Infof("Primary chain is set to: %v",
registeredChains.PrimaryChain())
estimator := lnwallet.StaticFeeEstimator{FeeRate: 50}
walletConfig := &btcwallet.Config{
PrivatePass: []byte("hello"),
DataDir: homeChainConfig.ChainDir,
NetParams: activeNetParams.Params,
FeeEstimator: estimator,
}
cc := &chainControl{
feeEstimator: estimator,
}
cc := &chainControl{}
switch registeredChains.PrimaryChain() {
case bitcoinChain:
cc.routingPolicy = defaultBitcoinForwardingPolicy
cc.feeEstimator = lnwallet.StaticFeeEstimator{
FeeRate: 50,
}
case litecoinChain:
cc.routingPolicy = defaultLitecoinForwardingPolicy
cc.feeEstimator = lnwallet.StaticFeeEstimator{
FeeRate: 100,
}
default:
return nil, nil, fmt.Errorf("Default routing policy for "+
"chain %v is unknown", registeredChains.PrimaryChain())
}
walletConfig := &btcwallet.Config{
PrivatePass: []byte("hello"),
DataDir: homeChainConfig.ChainDir,
NetParams: activeNetParams.Params,
FeeEstimator: cc.feeEstimator,
}
var (
err error
cleanUp func()
)
// If spv mode is active, then we'll be using a distimnct set of
// If spv mode is active, then we'll be using a distinct set of
// chainControl interfaces that interface directly with the p2p network
// of the selected chain.
if cfg.NeutrinoMode.Active {