mirror of
https://github.com/ACINQ/eclair.git
synced 2024-11-20 10:39:19 +01:00
Initialize global feerate with default from conf (#1019)
`Globals.feeratePerKB` is an atomic reference initialized to `null` and is asynchronously set by the fee provider only once it's ready. This means that it is possible to retrieve a null object from feeratePerKB, scenario that must be handled separately to prevent any issues. This commit now initialize `Globals.feeratePerKB` with the default values set in the configuration file. This makes sure that the feerate is always set to a meaningful value.
This commit is contained in:
parent
c4b7ade038
commit
3e46475f9f
@ -179,14 +179,19 @@ class Setup(datadir: File,
|
||||
tcpBound = Promise[Done]()
|
||||
routerInitialized = Promise[Done]()
|
||||
|
||||
defaultFeerates = FeeratesPerKB(
|
||||
block_1 = config.getLong("default-feerates.delay-blocks.1"),
|
||||
blocks_2 = config.getLong("default-feerates.delay-blocks.2"),
|
||||
blocks_6 = config.getLong("default-feerates.delay-blocks.6"),
|
||||
blocks_12 = config.getLong("default-feerates.delay-blocks.12"),
|
||||
blocks_36 = config.getLong("default-feerates.delay-blocks.36"),
|
||||
blocks_72 = config.getLong("default-feerates.delay-blocks.72")
|
||||
)
|
||||
defaultFeerates = {
|
||||
val confDefaultFeerates = FeeratesPerKB(
|
||||
block_1 = config.getLong("default-feerates.delay-blocks.1"),
|
||||
blocks_2 = config.getLong("default-feerates.delay-blocks.2"),
|
||||
blocks_6 = config.getLong("default-feerates.delay-blocks.6"),
|
||||
blocks_12 = config.getLong("default-feerates.delay-blocks.12"),
|
||||
blocks_36 = config.getLong("default-feerates.delay-blocks.36"),
|
||||
blocks_72 = config.getLong("default-feerates.delay-blocks.72")
|
||||
)
|
||||
Globals.feeratesPerKB.set(confDefaultFeerates)
|
||||
Globals.feeratesPerKw.set(FeeratesPerKw(confDefaultFeerates))
|
||||
confDefaultFeerates
|
||||
}
|
||||
minFeeratePerByte = config.getLong("min-feerate")
|
||||
smoothFeerateWindow = config.getInt("smooth-feerate-window")
|
||||
feeProvider = (nodeParams.chainHash, bitcoin) match {
|
||||
|
Loading…
Reference in New Issue
Block a user