1
0
Fork 0
mirror of https://github.com/bitcoin-s/bitcoin-s.git synced 2025-03-26 21:42:48 +01:00

Network specific filterHeaderBatchSize ()

* Network specific filterHeaderBatchSize

* Catch correct exceptions

* Add filter-header-batch-size-regtest to example configs
This commit is contained in:
Ben Carman 2020-04-03 17:36:29 -05:00 committed by GitHub
parent c7a350d8f3
commit aa2d88f396
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 32 additions and 3 deletions
app/server/src/main/resources
chain/src/main/scala/org/bitcoins/chain/config
docs/config
testkit/src/main/resources

View file

@ -48,6 +48,13 @@ bitcoin-s {
chain {
neutrino {
filter-header-batch-size = 2000
filter-header-batch-size.regtest = 10
# You can set a network specific filter-header-batch-size
# by adding a trailing `.networkId` (main, test, regtest)
# It is recommended to keep the main and test batch size high
# to keep the sync time fast, however, for regtest it should be small
# so it does not exceed the chain size.
filter-batch-size = 100
}
}

View file

@ -2,7 +2,7 @@ package org.bitcoins.chain.config
import java.nio.file.Path
import com.typesafe.config.Config
import com.typesafe.config.{Config, ConfigException}
import org.bitcoins.chain.db.ChainDbManagement
import org.bitcoins.chain.models.{BlockHeaderDAO, BlockHeaderDbHelper}
import org.bitcoins.core.util.FutureUtil
@ -77,8 +77,16 @@ case class ChainAppConfig(
}
}
lazy val filterHeaderBatchSize: Int =
config.getInt(s"${moduleName}.neutrino.filter-header-batch-size")
lazy val filterHeaderBatchSize: Int = {
// try by network, if that fails, try general
try {
config.getInt(
s"$moduleName.neutrino.filter-header-batch-size.${chain.network.chainParams.networkId}")
} catch {
case _: ConfigException.Missing | _: ConfigException.WrongType =>
config.getInt(s"$moduleName.neutrino.filter-header-batch-size")
}
}
lazy val filterBatchSize: Int =
config.getInt(s"${moduleName}.neutrino.filter-batch-size")

View file

@ -120,6 +120,13 @@ bitcoin-s {
chain {
neutrino {
filter-header-batch-size = 2000
filter-header-batch-size.regtest = 10
# You can set a network specific filter-header-batch-size
# by adding a trailing `.networkId` (main, test, regtest)
# It is recommended to keep the main and test batch size high
# to keep the sync time fast, however, for regtest it should be small
# so it does not exceed the chain size.
filter-batch-size = 100
}
}

View file

@ -49,6 +49,13 @@ bitcoin-s {
chain {
neutrino {
filter-header-batch-size = 2000
filter-header-batch-size.regtest = 10
# You can set a network specific filter-header-batch-size
# by adding a trailing `.networkId` (main, test, regtest)
# It is recommended to keep the main and test batch size high
# to keep the sync time fast, however, for regtest it should be small
# so it does not exceed the chain size.
filter-batch-size = 100
}
}