Skip to content

Commit 2d1d1f3

Browse files
author
Aurélien Richez
committed
Rename BestBlockInfo to BlockInfo
1 parent beb908b commit 2d1d1f3

File tree

4 files changed

+12
-12
lines changed

4 files changed

+12
-12
lines changed

src/main/scala/io/iohk/ethereum/db/storage/AppStateStorage.scala

+4-4
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import scala.collection.immutable.ArraySeq
99
import io.iohk.ethereum.db.dataSource.DataSource
1010
import io.iohk.ethereum.db.dataSource.DataSourceBatchUpdate
1111
import io.iohk.ethereum.db.storage.AppStateStorage._
12-
import io.iohk.ethereum.domain.appstate.BestBlockInfo
12+
import io.iohk.ethereum.domain.appstate.BlockInfo
1313
import io.iohk.ethereum.utils.Hex
1414

1515
/** This class is used to store app state variables
@@ -31,13 +31,13 @@ class AppStateStorage(val dataSource: DataSource) extends TransactionalKeyValueS
3131
def getBestBlockNumber(): BigInt =
3232
getBigInt(Keys.BestBlockNumber)
3333

34-
def getBestBlockInfo(): BestBlockInfo =
35-
BestBlockInfo( // TODO ETCM-1090 provide the genesis hash as default
34+
def getBestBlockInfo(): BlockInfo =
35+
BlockInfo( // TODO ETCM-1090 provide the genesis hash as default
3636
get(Keys.BestBlockHash).map(v => ByteString(Hex.decode(v))).getOrElse(ByteString.empty),
3737
getBigInt(Keys.BestBlockNumber)
3838
)
3939

40-
def putBestBlockInfo(b: BestBlockInfo): DataSourceBatchUpdate =
40+
def putBestBlockInfo(b: BlockInfo): DataSourceBatchUpdate =
4141
put(Keys.BestBlockNumber, b.number.toString)
4242
.and(put(Keys.BestBlockHash, Hex.toHexString(b.hash.toArray)))
4343

src/main/scala/io/iohk/ethereum/domain/Blockchain.scala

+4-4
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import scala.annotation.tailrec
77
import io.iohk.ethereum.db.dataSource.DataSourceBatchUpdate
88
import io.iohk.ethereum.db.storage._
99
import io.iohk.ethereum.domain
10-
import io.iohk.ethereum.domain.appstate.BestBlockInfo
10+
import io.iohk.ethereum.domain.appstate.BlockInfo
1111
import io.iohk.ethereum.jsonrpc.ProofService.StorageProof
1212
import io.iohk.ethereum.ledger.InMemoryWorldStateProxy
1313
import io.iohk.ethereum.ledger.InMemoryWorldStateProxyStorage
@@ -144,15 +144,15 @@ class BlockchainImpl(
144144
}
145145

146146
private def saveBestKnownBlock(bestBlockHash: ByteString, bestBlockNumber: BigInt): Unit =
147-
appStateStorage.putBestBlockInfo(BestBlockInfo(bestBlockHash, bestBlockNumber)).commit()
147+
appStateStorage.putBestBlockInfo(BlockInfo(bestBlockHash, bestBlockNumber)).commit()
148148

149149
private def saveBestKnownBlockAndLatestCheckpointNumber(
150150
bestBlockHash: ByteString,
151151
number: BigInt,
152152
latestCheckpointNumber: BigInt
153153
): Unit =
154154
appStateStorage
155-
.putBestBlockInfo(BestBlockInfo(bestBlockHash, number))
155+
.putBestBlockInfo(BlockInfo(bestBlockHash, number))
156156
.and(appStateStorage.putLatestCheckpointBlockNumber(latestCheckpointNumber))
157157
.commit()
158158

@@ -201,7 +201,7 @@ class BlockchainImpl(
201201
*/
202202
val bestBlockNumberUpdates =
203203
if (appStateStorage.getBestBlockNumber() > potentialNewBestBlockNumber)
204-
appStateStorage.putBestBlockInfo(BestBlockInfo(potentialNewBestBlockHash, potentialNewBestBlockNumber))
204+
appStateStorage.putBestBlockInfo(BlockInfo(potentialNewBestBlockHash, potentialNewBestBlockNumber))
205205
else appStateStorage.emptyBatchUpdate
206206
val latestCheckpointNumberUpdates =
207207
if (appStateStorage.getLatestCheckpointBlockNumber() > newLatestCheckpointNumber)

src/main/scala/io/iohk/ethereum/domain/BlockchainWriter.scala

+3-3
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import io.iohk.ethereum.db.storage.ChainWeightStorage
1111
import io.iohk.ethereum.db.storage.ReceiptStorage
1212
import io.iohk.ethereum.db.storage.TransactionMappingStorage
1313
import io.iohk.ethereum.db.storage.TransactionMappingStorage.TransactionLocation
14-
import io.iohk.ethereum.domain.appstate.BestBlockInfo
14+
import io.iohk.ethereum.domain.appstate.BlockInfo
1515
import io.iohk.ethereum.utils.Logger
1616

1717
class BlockchainWriter(
@@ -32,14 +32,14 @@ class BlockchainWriter(
3232
block.header.number
3333
)
3434
appStateStorage
35-
.putBestBlockInfo(BestBlockInfo(block.header.hash, block.header.number))
35+
.putBestBlockInfo(BlockInfo(block.header.hash, block.header.number))
3636
.and(appStateStorage.putLatestCheckpointBlockNumber(block.header.number))
3737
} else if (saveAsBestBlock) {
3838
log.debug(
3939
"New best known block number - {}",
4040
block.header.number
4141
)
42-
appStateStorage.putBestBlockInfo(BestBlockInfo(block.header.hash, block.header.number))
42+
appStateStorage.putBestBlockInfo(BlockInfo(block.header.hash, block.header.number))
4343
} else {
4444
appStateStorage.emptyBatchUpdate
4545
}

src/main/scala/io/iohk/ethereum/domain/appstate/BestBlockInfo.scala renamed to src/main/scala/io/iohk/ethereum/domain/appstate/BlockInfo.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ package io.iohk.ethereum.domain.appstate
22

33
import akka.util.ByteString
44

5-
case class BestBlockInfo(hash: ByteString, number: BigInt)
5+
case class BlockInfo(hash: ByteString, number: BigInt)

0 commit comments

Comments
 (0)