chainregistry+config: enable neutrino fee estimation from external api

Co-authored-by: Valentine Wallace <vwallace@protonmail.com>
This commit is contained in:
Olaoluwa Osuntokun 2018-09-09 17:34:10 -07:00 committed by Valentine Wallace
parent 1179895d20
commit 1fa13e5cfc
3 changed files with 21 additions and 0 deletions

@ -208,6 +208,23 @@ func newChainControlFromConfig(cfg *config, chanDB *channeldb.DB,
return nil, err
}
// If the user provided an API for fee estimation, activate it now.
if cfg.NeutrinoMode.FeeURL != "" {
ltndLog.Infof("Using API fee estimator!")
estimator := lnwallet.NewWebAPIFeeEstimator(
lnwallet.SparseConfFeeSource{
URL: cfg.NeutrinoMode.FeeURL,
},
defaultBitcoinStaticFeePerKW,
)
if err := estimator.Start(); err != nil {
return nil, err
}
cc.feeEstimator = estimator
}
walletConfig.ChainSource = chain.NewNeutrinoClient(
activeNetParams.Params, neutrinoCS,
)

@ -130,6 +130,7 @@ type neutrinoConfig struct {
MaxPeers int `long:"maxpeers" description:"Max number of inbound and outbound peers"`
BanDuration time.Duration `long:"banduration" description:"How long to ban misbehaving peers. Valid time units are {s, m, h}. Minimum 1 second"`
BanThreshold uint32 `long:"banthreshold" description:"Maximum allowed ban score before disconnecting and banning misbehaving peers."`
FeeURL string `long:"feeurl" description:"Optional URL for fee estimation. If a URL is not specified, static fees will be used for estimation."`
}
type btcdConfig struct {

@ -233,6 +233,9 @@ bitcoin.node=btcd
; Add a peer to connect with at startup.
; neutrino.addpeer=
; Set a URL source for fee estimates.
; neutrino.feeurl=
[Litecoin]