Default to suredbits node if peers field is left empty (#4404)

* Default to suredbits node if peers field is left empty

* Remove log
This commit is contained in:
Chris Stewart 2022-06-18 18:40:53 -05:00 committed by GitHub
parent a0ab0638f8
commit 7f43ef98ad
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 17 additions and 4 deletions

View file

@ -2,7 +2,7 @@ bitcoin-s {
network = mainnet
node {
mode = neutrino # neutrino, spv, bitcoind
peers = ["neutrino.suredbits.com:8333"]
#peers = ["neutrino.suredbits.com:8333"]
relay = true
}
proxy {

View file

@ -3,7 +3,7 @@ bitcoin-s.network = ${?BITCOIN_S_NETWORK}
bitcoin-s.node.mode = neutrino
bitcoin-s.node.mode = ${?BITCOIN_S_NODE_MODE}
bitcoin-s.node.peers = ["neutrino.suredbits.com:8333"]
bitcoin-s.node.peers = [${?BITCOIN_S_NODE_PEERS}]
# need to bind to all interfaces so we can
# have host machine forward requests to the docker container

View file

@ -30,7 +30,7 @@ bitcoin-s {
node = ${bitcoin-s.dbDefault}
node {
peers = ["localhost"] # a list of peer addresses in form "hostname:portnumber"
peers = [] # a list of peer addresses in form "hostname:portnumber"
# (e.g. "neutrino.testnet3.suredbits.com:18333")
# Port number is optional, the default value is 8333 for mainnet,
# 18333 for testnet and 18444 for regtest.

View file

@ -10,6 +10,7 @@ import org.bitcoins.chain.models.{
CompactFilterHeaderDAO
}
import org.bitcoins.core.api.node.NodeType
import org.bitcoins.core.config.{MainNet, RegTest, SigNet, TestNet3}
import org.bitcoins.core.util.Mutable
import org.bitcoins.db.{DbAppConfig, JdbcProfileComponent}
import org.bitcoins.node._
@ -105,7 +106,19 @@ case class NodeAppConfig(baseDatadir: Path, configOverrides: Vector[Config])(
val strs = 0
.until(list.size())
.foldLeft(Vector.empty[String])((acc, i) => acc :+ list.get(i))
strs.map(_.replace("localhost", "127.0.0.1"))
val result = strs.map(_.replace("localhost", "127.0.0.1"))
if (result.isEmpty) {
logger.info(
s"No peers found in configuration, resorting to default peers")
network match {
case MainNet => Vector("neutrino.suredbits.com:8333")
case TestNet3 => Vector("neutrino.testnet3.suredbits.com:18333")
case n @ (RegTest | SigNet) =>
sys.error(s"Cannot configure any peers by default on $n")
}
} else {
result
}
}
lazy val torConf: TorAppConfig =