Skip to content

Commit

Permalink
[ETCM-198] Remove unused fields in SyncState class
Browse files Browse the repository at this point in the history
  • Loading branch information
Michal Mrozek committed Oct 28, 2020
1 parent bfd810d commit 6684885
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 6 deletions.
Expand Up @@ -96,7 +96,7 @@ object FastSyncItSpecUtils {
val currentBest = bl.getBestBlock().header
val safeTarget = currentBest.number + syncConfig.fastSyncBlockValidationX
val nextToValidate = currentBest.number + 1
val syncState = SyncState(currentBest, safeTarget, Seq(), Seq(), 0, 0, currentBest.number, nextToValidate)
val syncState = SyncState(currentBest, safeTarget, Seq(), Seq(), currentBest.number, nextToValidate)
storagesInstance.storages.fastSyncStateStorage.putSyncState(syncState)
}.map(_ => ())
}
Expand Down
Expand Up @@ -519,7 +519,6 @@ class FastSync(
s"${peer.remoteAddress.getAddress.getHostAddress}:${peer.remoteAddress.getPort}"
log.info(s"""|Block: ${appStateStorage.getBestBlockNumber()}/${syncState.pivotBlock.number}.
|Peers waiting_for_response/connected: ${assignedHandlers.size}/${handshakedPeers.size} (${blacklistedPeers.size} blacklisted).
|State: ${syncState.downloadedNodesCount}/${syncState.totalNodesCount} nodes.
|""".stripMargin.replace("\n", " "))
log.debug(
s"""|Connection status: connected(${assignedHandlers.values.map(formatPeer).toSeq.sorted.mkString(", ")})/
Expand Down Expand Up @@ -806,8 +805,6 @@ object FastSync {
safeDownloadTarget: BigInt = 0,
blockBodiesQueue: Seq[ByteString] = Nil,
receiptsQueue: Seq[ByteString] = Nil,
downloadedNodesCount: Int = 0,
totalNodesCount: Int = 0,
bestBlockHeaderNumber: BigInt = 0,
nextBlockToFullyValidate: BigInt = 1,
pivotBlockUpdateFailures: Int = 0,
Expand Down
Expand Up @@ -24,11 +24,11 @@ class FastSyncStateStorageActorSpec extends AsyncFlatSpec with Matchers with Eve

val targetBlockHeader = Fixtures.Blocks.ValidBlock.header
syncStateActor ! new FastSyncStateStorage(dataSource)
(0 to maxN).foreach(n => syncStateActor ! SyncState(targetBlockHeader).copy(downloadedNodesCount = n))
(0 to maxN).foreach(_ => syncStateActor ! SyncState(targetBlockHeader))

eventually {
(syncStateActor ? GetStorage).mapTo[Option[SyncState]].map { syncState =>
val expected = SyncState(targetBlockHeader).copy(downloadedNodesCount = maxN)
val expected = SyncState(targetBlockHeader)
syncState shouldEqual Some(expected)
}
}
Expand Down

0 comments on commit 6684885

Please sign in to comment.