chainreg: require FeeUrl when running neutrino mainnet

Fixes #4770.
This commit is contained in:
Olaoluwa Osuntokun 2020-12-09 18:47:47 -08:00
parent 8d8b13a7d1
commit 50323dcd56
No known key found for this signature in database
GPG Key ID: 3BBD59E99B280306

@ -582,8 +582,18 @@ func NewChainControl(cfg *Config) (*ChainControl, error) {
homeChainConfig.Node) homeChainConfig.Node)
} }
switch {
// If the fee URL isn't set, and the user is running mainnet, then
// we'll return an error to instruct them to set a proper fee
// estimator.
case cfg.FeeURL == "" && cfg.Bitcoin.MainNet &&
homeChainConfig.Node == "neutrino":
return nil, fmt.Errorf("--feeurl parameter required when " +
"running neutrino on mainnet")
// Override default fee estimator if an external service is specified. // Override default fee estimator if an external service is specified.
if cfg.FeeURL != "" { case cfg.FeeURL != "":
// Do not cache fees on regtest to make it easier to execute // Do not cache fees on regtest to make it easier to execute
// manual or automated test cases. // manual or automated test cases.
cacheFees := !cfg.Bitcoin.RegTest cacheFees := !cfg.Bitcoin.RegTest