Skip to content

Commit 9ed0014

Browse files
authored
Use fallback feerates on testnets (#3233)
When using testnet3 or testnet4, Bitcoin Core may fail to estimate fees because there isn't enough block data. We now use the configured default feerates when that happens to make it easier to run on testnets. We also update the default feerates to better match current values. Fixes #3105
1 parent 3ac122b commit 9ed0014

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

eclair-core/src/main/resources/reference.conf

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -271,11 +271,11 @@ eclair {
271271
smoothing-window = 6 // 1 = no smoothing
272272

273273
default-feerates { // the following values are in satoshis per byte
274-
minimum = 5
275-
slow = 5
276-
medium = 10
277-
fast = 20
278-
fastest = 30
274+
minimum = 1
275+
slow = 2
276+
medium = 5
277+
fast = 10
278+
fastest = 20
279279
}
280280

281281
// confirmation priority for each transaction type, can be slow/medium/fast

eclair-core/src/main/scala/fr/acinq/eclair/Setup.scala

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ import akka.actor.typed.scaladsl.adapter.{ClassicActorRefOps, ClassicActorSystem
2222
import akka.actor.{ActorRef, ActorSystem, Props, SupervisorStrategy, typed}
2323
import akka.pattern.after
2424
import akka.util.Timeout
25-
import fr.acinq.bitcoin.scalacompat.Crypto.PublicKey
2625
import fr.acinq.bitcoin.scalacompat.{Block, BlockHash, BlockId, ByteVector32, Satoshi, Script, ScriptElt, addressToPublicKeyScript}
2726
import fr.acinq.eclair.NodeParams.hashFromChain
2827
import fr.acinq.eclair.Setup.Seeds
@@ -250,7 +249,12 @@ class Setup(val datadir: File,
250249
feeProvider = nodeParams.chainHash match {
251250
case Block.RegtestGenesisBlock.hash | Block.SignetGenesisBlock.hash =>
252251
FallbackFeeProvider(ConstantFeeProvider(defaultFeerates) :: Nil, minFeeratePerByte)
252+
case Block.Testnet3GenesisBlock.hash | Block.Testnet4GenesisBlock.hash =>
253+
// On testnet, we fallback to default feerates when there aren't enough block data to estimate fees.
254+
val smoothFeerateWindow = config.getInt("on-chain-fees.smoothing-window")
255+
FallbackFeeProvider(SmoothFeeProvider(BitcoinCoreFeeProvider(bitcoin, defaultFeerates), smoothFeerateWindow) :: ConstantFeeProvider(defaultFeerates) :: Nil, minFeeratePerByte)
253256
case _ =>
257+
// On mainnet, we always use blockchain data to estimate fees and ignore configured fallbacks.
254258
val smoothFeerateWindow = config.getInt("on-chain-fees.smoothing-window")
255259
FallbackFeeProvider(SmoothFeeProvider(BitcoinCoreFeeProvider(bitcoin, defaultFeerates), smoothFeerateWindow) :: Nil, minFeeratePerByte)
256260
}

0 commit comments

Comments
 (0)