node: Update DNS seeds, optimize PeerFinder.start() to start querying… (#5807)

* node: Update DNS seeds, optimize PeerFinder.start() to start querying dns seeds as early as possible

* Add new seeds, disable bad seeds

* scalafmt
This commit is contained in:
Chris Stewart 2024-12-13 11:41:54 -06:00 committed by GitHub
parent d29dad4472
commit 812f735110
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 14 additions and 10 deletions

View File

@ -72,13 +72,14 @@ sealed abstract class MainNet extends BitcoinNetwork {
Vector(
// "seed.bitcoin.sipa.be", very slow, commenting out for now
"dnsseed.bluematt.me",
"dnsseed.bitcoin.dashjr.org",
"dnsseed.bitcoin.dashjr-list-of-p2p-nodes.us",
"seed.bitcoinstats.com",
// "seed.btc.petertodd.net", very slow, commenting out for now
"seed.bitcoin.jonasschnelli.ch",
// "seed.bitcoin.jonasschnelli.ch", seems to be down?
"seed.bitcoin.sprovoost.nl",
"dnsseed.emzy.de",
"seed.bitcoin.wiz.biz"
"seed.bitcoin.wiz.biz",
"seed.mainnet.achownodes.xyz"
)
}
@ -104,10 +105,13 @@ sealed abstract class TestNet3 extends BitcoinNetwork {
/** @inheritdoc
*/
override def dnsSeeds: Seq[String] =
Seq("testnet-seed.bitcoin.jonasschnelli.ch",
Seq(
"testnet-seed.bitcoin.jonasschnelli.ch",
"seed.tbtc.petertodd.org",
"seed.testnet.bitcoin.sprovoost.nl",
"testnet-seed.bluematt.me")
"testnet-seed.bluematt.me",
"seed.testnet.achownodes.xyz"
)
/*
* @inheritdoc
*/

View File

@ -45,7 +45,7 @@ case class PeerFinder(
/** Returns peers by querying each dns seed once. These will be IPv4
* addresses.
*/
private def getPeersFromDnsSeeds: Future[Vector[Peer]] = {
private lazy val getPeersFromDnsSeeds: Future[Vector[Peer]] = {
val dnsSeeds = nodeAppConfig.network.dnsSeeds
val addressesF: Future[Vector[String]] = Future
.traverse(dnsSeeds) { seed =>
@ -163,12 +163,12 @@ case class PeerFinder(
_peersToTry.pushAll(pds, priority = 2)
val peerDiscoveryF = if (nodeAppConfig.enablePeerDiscovery) {
val dnsF = getPeersFromDnsSeeds
val startedF = for {
(dbNonCfPeerDb, dbCfPeerDb) <- getPeersFromDb
dbNonCf = dbNonCfPeerDb.map(_.peer(nodeAppConfig.socks5ProxyParams))
dbCf = dbCfPeerDb.map(_.peer(nodeAppConfig.socks5ProxyParams))
peersDbs <- getPeersFromDnsSeeds.map(dns =>
dns ++ getPeersFromResources ++ dbNonCf)
peersDbs <- dnsF.map(dns => dns ++ getPeersFromResources ++ dbNonCf)
} yield {
val pds = peersDbs.map(p => buildPeerData(p, isPersistent = false))
_peersToTry.pushAll(pds)