Skip to content

Commit f13aeba

Browse files
author
Aurélien Richez
committed
[ETCM-1042] rename BestBranchSubset to BestBranch
1 parent 8211467 commit f13aeba

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import io.iohk.ethereum.db.storage.BlockHeadersStorage
88
import io.iohk.ethereum.db.storage.BlockNumberMappingStorage
99
import io.iohk.ethereum.db.storage.ReceiptStorage
1010
import io.iohk.ethereum.db.storage.StateStorage
11-
import io.iohk.ethereum.domain.branch.BestBranchSubset
11+
import io.iohk.ethereum.domain.branch.BestBranch
1212
import io.iohk.ethereum.domain.branch.Branch
1313
import io.iohk.ethereum.domain.branch.EmptyBranch
1414
import io.iohk.ethereum.mpt.MptNode
@@ -75,7 +75,7 @@ class BlockchainReader(
7575
val number = getBestBlockNumber()
7676
blockNumberMappingStorage
7777
.get(number)
78-
.map(hash => BestBranchSubset(hash, number))
78+
.map(hash => BestBranch(hash, number))
7979
.getOrElse(EmptyBranch)
8080
}
8181

@@ -112,7 +112,7 @@ class BlockchainReader(
112112

113113
/** Returns a block inside this branch based on its number */
114114
def getBlockByNumber(branch: Branch, number: BigInt): Option[Block] = branch match {
115-
case BestBranchSubset(_, tipBlockNumber) =>
115+
case BestBranch(_, tipBlockNumber) =>
116116
if (tipBlockNumber >= number && number >= 0) {
117117
for {
118118
hash <- getHashByBlockNumber(number)
@@ -124,7 +124,7 @@ class BlockchainReader(
124124

125125
/** Returns a block hash for the block at the given height if any */
126126
def getHashByBlockNumber(branch: Branch, number: BigInt): Option[ByteString] = branch match {
127-
case BestBranchSubset(_, tipBlockNumber) =>
127+
case BestBranch(_, tipBlockNumber) =>
128128
if (tipBlockNumber >= number && number >= 0) {
129129
blockNumberMappingStorage.get(number)
130130
} else None
@@ -134,7 +134,7 @@ class BlockchainReader(
134134

135135
/** Checks if given block hash is in this chain. (i.e. is an ancestor of the tip block) */
136136
def isInChain(branch: Branch, hash: ByteString): Boolean = branch match {
137-
case BestBranchSubset(_, tipBlockNumber) =>
137+
case BestBranch(_, tipBlockNumber) =>
138138
(for {
139139
header <- getBlockHeaderByHash(hash) if header.number <= tipBlockNumber
140140
hash <- getHashByBlockNumber(branch, header.number)

src/main/scala/io/iohk/ethereum/domain/branch/Branch.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ import akka.util.ByteString
44

55
sealed trait Branch
66

7-
case class BestBranchSubset(tipBlockHash: ByteString, tipBlockNumber: BigInt) extends Branch
7+
case class BestBranch(tipBlockHash: ByteString, tipBlockNumber: BigInt) extends Branch
88

99
case object EmptyBranch extends Branch

0 commit comments

Comments
 (0)