From b89387a6dae798cc1ed607917423015c6483a62c Mon Sep 17 00:00:00 2001 From: Boris Nagaev Date: Thu, 7 Nov 2024 14:01:13 -0300 Subject: [PATCH 1/2] chainreg: use feerate estimator in regtest, simnet If feeurl is not provided and LND is running in bitcoind or btcd mode, use fee estimator provided by bitcoind or btcd instead of using static fee estimator (which always returns 50 sats/vbyte). This enables simulating high feerate environment in regtest and simnet not only via feeurl, but also by filling mempool with high feerate transactions, which is closer to what happens in mainnet. Also skip creating bitcoind or btcd fee estimator, if feeurl is provided. Before LND logged both "Initializing bitcoind backed fee estimator" and "Using external fee estimator" if running in bitcoind mode with feeurl provided, but actually feeurl was used, so this is not a change of behavior. --- chainreg/chainregistry.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/chainreg/chainregistry.go b/chainreg/chainregistry.go index da1f8e08ad..95f0d5b9eb 100644 --- a/chainreg/chainregistry.go +++ b/chainreg/chainregistry.go @@ -385,8 +385,7 @@ func NewPartialChainControl(cfg *Config) (*PartialChainControl, func(), error) { ) cc.ChainSource = bitcoindConn.NewBitcoindClient() - // If we're not in regtest mode, then we'll attempt to use a - // proper fee estimator for testnet. + // Initialize config to connect to bitcoind RPC. rpcConfig := &rpcclient.ConnConfig{ Host: bitcoindHost, User: bitcoindMode.RPCUser, @@ -396,7 +395,9 @@ func NewPartialChainControl(cfg *Config) (*PartialChainControl, func(), error) { DisableTLS: true, HTTPPostMode: true, } - if !cfg.Bitcoin.RegTest { + + // If feeurl is not provided, use bitcoind's fee estimator. + if cfg.Fee.URL == "" { log.Infof("Initializing bitcoind backed fee estimator "+ "in %s mode", bitcoindMode.EstimateMode) @@ -660,9 +661,8 @@ func NewPartialChainControl(cfg *Config) (*PartialChainControl, func(), error) { return checkOutboundPeers(chainRPC.Client) } - // If we're not in simnet or regtest mode, then we'll attempt - // to use a proper fee estimator for testnet. - if !cfg.Bitcoin.SimNet && !cfg.Bitcoin.RegTest { + // If feeurl is not provided, use btcd's fee estimator. + if cfg.Fee.URL == "" { log.Info("Initializing btcd backed fee estimator") // Finally, we'll re-initialize the fee estimator, as From 23b025cff69bb6ad52d909bb0defc7de5f668c32 Mon Sep 17 00:00:00 2001 From: Boris Nagaev Date: Wed, 27 Nov 2024 10:30:52 -0300 Subject: [PATCH 2/2] docs: add release notes (feerate estimator) --- docs/release-notes/release-notes-0.19.0.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/docs/release-notes/release-notes-0.19.0.md b/docs/release-notes/release-notes-0.19.0.md index 4429f5cf5c..bc2c456b1c 100644 --- a/docs/release-notes/release-notes-0.19.0.md +++ b/docs/release-notes/release-notes-0.19.0.md @@ -187,6 +187,11 @@ The underlying functionality between those two options remain the same. for the Gossip 1.75 protocol. ## Testing + +* LND [uses](https://github.com/lightningnetwork/lnd/pull/9257) the feerate + estimator provided by bitcoind or btcd in regtest and simnet modes instead of + static fee estimator if feeurl is not provided. + ## Database * [Migrate the mission control