mirror of
https://github.com/bitcoin-s/bitcoin-s.git
synced 2025-03-03 10:46:42 +01:00
Fix bug where we were only setting bitcoin-s.node.inactivity-timeout
on regtest (#5389)
* Fix bug where we were only setting bitcoin-s.node.inactivity-timeout on regtest * Remove log, scalafmt
This commit is contained in:
parent
5544a2efc4
commit
cac546bb57
3 changed files with 5 additions and 9 deletions
|
@ -79,6 +79,7 @@ class ReConnectionTest extends NodeTestWithCachedBitcoindNewest {
|
|||
|
||||
//wait until there is a timeout for inactivity
|
||||
_ <- NodeTestUtil.awaitConnectionCount(started, 1)
|
||||
_ <- started.peerManager.isConnected(bitcoindPeer)
|
||||
_ <- started.stop()
|
||||
_ <- started.nodeConfig.stop()
|
||||
} yield {
|
||||
|
|
|
@ -20,7 +20,6 @@ import org.bitcoins.chain.config.ChainAppConfig
|
|||
import org.bitcoins.core.api.chain.ChainQueryApi.FilterResponse
|
||||
import NodeState.DoneSyncing
|
||||
import org.bitcoins.core.api.node.{NodeType, Peer}
|
||||
import org.bitcoins.core.config.{MainNet, RegTest, SigNet, TestNet3}
|
||||
import org.bitcoins.core.protocol.BlockStamp
|
||||
import org.bitcoins.node.config.NodeAppConfig
|
||||
|
||||
|
@ -201,7 +200,7 @@ case class NeutrinoNode(
|
|||
|
||||
private def inactivityChecksRunnable(): Runnable = { () =>
|
||||
val peers = peerManager.peers
|
||||
logger.debug(s"Running inactivity checks for peers=${peers}")
|
||||
logger.info(s"Running inactivity checks for peers=${peers}")
|
||||
val resultF = if (peers.nonEmpty) {
|
||||
Future.unit //do nothing?
|
||||
} else if (isStarted.get) {
|
||||
|
@ -220,11 +219,7 @@ case class NeutrinoNode(
|
|||
}
|
||||
|
||||
private def startInactivityChecksJob(): Cancellable = {
|
||||
//the interval is set shorter for some unit test cases
|
||||
val interval = nodeAppConfig.network match {
|
||||
case MainNet | TestNet3 | SigNet => 5.minute
|
||||
case RegTest => nodeAppConfig.inactivityTimeout
|
||||
}
|
||||
val interval = nodeAppConfig.inactivityTimeout
|
||||
system.scheduler.scheduleAtFixedRate(
|
||||
initialDelay = interval,
|
||||
interval = interval)(inactivityChecksRunnable())
|
||||
|
|
|
@ -378,9 +378,9 @@ case class PeerManager(
|
|||
if (forceReconnect && !isShuttingDown) {
|
||||
finder.reconnect(peer).map(_ => state)
|
||||
} else {
|
||||
val exn = new RuntimeException(
|
||||
logger.warn(
|
||||
s"No new peers to sync from, cannot start new sync. Terminated sync with peer=$peer current syncPeer=$syncPeerOpt state=${state} peers=$peers")
|
||||
Future.failed(exn)
|
||||
Future.successful(state)
|
||||
}
|
||||
} else {
|
||||
if (forceReconnect && !isShuttingDown) {
|
||||
|
|
Loading…
Add table
Reference in a new issue