mirror of
https://github.com/bitcoin-s/bitcoin-s.git
synced 2025-01-19 05:43:51 +01:00
Adjust period of time we query for peers on the p2p network from 12 seconds -> 1 hour (#4847)
This commit is contained in:
parent
a4e38c30b4
commit
f483e356cb
@ -48,6 +48,8 @@ bitcoin-s {
|
||||
# password = ""
|
||||
# }
|
||||
|
||||
# time interval for trying next set of peers in peer discovery
|
||||
try-peers-interval = 1 hour
|
||||
}
|
||||
|
||||
# You can configure SOCKS5 proxy to use Tor for outgoing connections
|
||||
|
@ -169,7 +169,7 @@ bitcoin-s {
|
||||
# initialization timeout once connected, reconnections resets this
|
||||
initialization-timeout = 10s
|
||||
# time interval for trying next set of peers in peer discovery
|
||||
try-peers-interval = 12s
|
||||
try-peers-interval = 1 hour
|
||||
|
||||
# wait time for queries like getheaders etc before switching to another
|
||||
query-wait-time = 120s
|
||||
|
@ -113,10 +113,7 @@ case class PeerFinder(
|
||||
|
||||
val maxPeerSearchCount: Int = 1000
|
||||
|
||||
def initialDelay: FiniteDuration = {
|
||||
if (getPeersFromConfig.isEmpty && getPeersFromParam.isEmpty) 0.seconds
|
||||
else nodeAppConfig.tryNextPeersInterval
|
||||
}
|
||||
private val initialDelay: FiniteDuration = 1.minute
|
||||
|
||||
private val isConnectionSchedulerRunning = AtomicBoolean(false)
|
||||
|
||||
@ -129,6 +126,7 @@ case class PeerFinder(
|
||||
isConnectionSchedulerRunning.compareAndSet(expect = false,
|
||||
update = true)
|
||||
) {
|
||||
logger.info(s"Querying p2p network for peers...")
|
||||
logger.debug(s"Cache size: ${_peerData.size}. ${_peerData.keys}")
|
||||
if (_peersToTry.size < 32)
|
||||
_peersToTry.pushAll(getPeersFromDnsSeeds)
|
||||
@ -137,7 +135,7 @@ case class PeerFinder(
|
||||
.filterNot(p => skipPeers().contains(p) || _peerData.contains(p))
|
||||
|
||||
logger.debug(s"Trying next set of peers $peers")
|
||||
val peersF = Future.sequence(peers.map(tryPeer))
|
||||
val peersF = Future.traverse(peers)(tryPeer)
|
||||
peersF.onComplete {
|
||||
case Success(_) =>
|
||||
isConnectionSchedulerRunning.set(false)
|
||||
|
@ -186,7 +186,7 @@ case class NodeAppConfig(baseDatadir: Path, configOverrides: Vector[Config])(
|
||||
if (config.hasPath("bitcoin-s.node.try-peers-interval")) {
|
||||
val duration = config.getDuration("bitcoin-s.node.try-peers-interval")
|
||||
TimeUtil.durationToFiniteDuration(duration)
|
||||
} else 12.seconds
|
||||
} else 1.hour
|
||||
}
|
||||
|
||||
/** timeout to wait for response the messages extend [[org.bitcoins.core.p2p.ExpectsResponse]] */
|
||||
|
Loading…
Reference in New Issue
Block a user