Skip to content

Commit 66c1920

Browse files
[ETCM-355] Refactor capabilities (#1060)
* [ETCM-355] Refactor capabilities * [ETCM-355] Add RemoteStatus.capability field * fixup! [ETCM-355] Refactor capabilities * [ETCM-355] Move ProtocolFamily next to Capability * [ETCM-355] Rename BlockToBroadcast.as64 to asEtc64 * [ETCM-355] Style fixes * fixup! [ETCM-355] Refactor capabilities
1 parent 6286011 commit 66c1920

34 files changed

+217
-287
lines changed

src/main/scala/io/iohk/ethereum/blockchain/sync/regular/BlockBroadcast.scala

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ import io.iohk.ethereum.network.Peer
1414
import io.iohk.ethereum.network.PeerId
1515
import io.iohk.ethereum.network.p2p.MessageSerializable
1616
import io.iohk.ethereum.network.p2p.messages.BaseETH6XMessages
17+
import io.iohk.ethereum.network.p2p.messages.Capability
1718
import io.iohk.ethereum.network.p2p.messages.ETC64
1819
import io.iohk.ethereum.network.p2p.messages.ETH62
1920
import io.iohk.ethereum.network.p2p.messages.ETH62.BlockHash
20-
import io.iohk.ethereum.network.p2p.messages.ProtocolFamily._
2121

2222
class BlockBroadcast(val etcPeerManager: ActorRef) {
2323

@@ -47,9 +47,10 @@ class BlockBroadcast(val etcPeerManager: ActorRef) {
4747
obtainRandomPeerSubset(peers.values.map(_.peer).toSet).foreach { peer =>
4848
val remoteStatus = peers(peer.id).peerInfo.remoteStatus
4949

50-
val message: MessageSerializable = remoteStatus.protocolFamily match {
51-
case ETH => blockToBroadcast.as63
52-
case ETC => blockToBroadcast.as64
50+
val message: MessageSerializable = remoteStatus.capability match {
51+
case Capability.ETH63 => blockToBroadcast.as63
52+
case Capability.ETH64 => blockToBroadcast.as63
53+
case Capability.ETC64 => blockToBroadcast.asEtc64
5354
}
5455
etcPeerManager ! EtcPeerManagerActor.SendMessage(message, peer.id)
5556
}
@@ -80,6 +81,6 @@ object BlockBroadcast {
8081
*/
8182
case class BlockToBroadcast(block: Block, chainWeight: ChainWeight) {
8283
def as63: BaseETH6XMessages.NewBlock = BaseETH6XMessages.NewBlock(block, chainWeight.totalDifficulty)
83-
def as64: ETC64.NewBlock = ETC64.NewBlock(block, chainWeight)
84+
def asEtc64: ETC64.NewBlock = ETC64.NewBlock(block, chainWeight)
8485
}
8586
}

src/main/scala/io/iohk/ethereum/network/EtcPeerManagerActor.scala

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,14 @@ import io.iohk.ethereum.network.handshaker.Handshaker.HandshakeResult
2020
import io.iohk.ethereum.network.p2p.Message
2121
import io.iohk.ethereum.network.p2p.MessageSerializable
2222
import io.iohk.ethereum.network.p2p.messages.BaseETH6XMessages
23+
import io.iohk.ethereum.network.p2p.messages.Capability
2324
import io.iohk.ethereum.network.p2p.messages.Codes
2425
import io.iohk.ethereum.network.p2p.messages.ETC64
2526
import io.iohk.ethereum.network.p2p.messages.ETC64.NewBlock
2627
import io.iohk.ethereum.network.p2p.messages.ETH62.BlockHeaders
2728
import io.iohk.ethereum.network.p2p.messages.ETH62.GetBlockHeaders
2829
import io.iohk.ethereum.network.p2p.messages.ETH62.NewBlockHashes
2930
import io.iohk.ethereum.network.p2p.messages.ETH64
30-
import io.iohk.ethereum.network.p2p.messages.ProtocolFamily
31-
import io.iohk.ethereum.network.p2p.messages.ProtocolFamily.ETC
32-
import io.iohk.ethereum.network.p2p.messages.ProtocolFamily.ETH
3331
import io.iohk.ethereum.network.p2p.messages.WireProtocol.Disconnect
3432
import io.iohk.ethereum.utils.ByteStringUtils
3533

@@ -243,17 +241,15 @@ object EtcPeerManagerActor {
243241
* (they are different versions of Status msg)
244242
*/
245243
case class RemoteStatus(
246-
protocolFamily: ProtocolFamily,
247-
protocolVersion: Int,
244+
capability: Capability,
248245
networkId: Int,
249246
chainWeight: ChainWeight,
250247
bestHash: ByteString,
251248
genesisHash: ByteString
252249
) {
253250
override def toString: String =
254251
s"RemoteStatus { " +
255-
s"protocolFamily: $protocolFamily, " +
256-
s"protocolVersion: $protocolVersion, " +
252+
s"capability: $capability, " +
257253
s"networkId: $networkId, " +
258254
s"chainWeight: $chainWeight, " +
259255
s"bestHash: ${ByteStringUtils.hash2string(bestHash)}, " +
@@ -264,8 +260,7 @@ object EtcPeerManagerActor {
264260
object RemoteStatus {
265261
def apply(status: ETH64.Status): RemoteStatus =
266262
RemoteStatus(
267-
ETH,
268-
status.protocolVersion,
263+
Capability.ETH64,
269264
status.networkId,
270265
ChainWeight.totalDifficultyOnly(status.totalDifficulty),
271266
status.bestHash,
@@ -274,8 +269,7 @@ object EtcPeerManagerActor {
274269

275270
def apply(status: ETC64.Status): RemoteStatus =
276271
RemoteStatus(
277-
ETC,
278-
status.protocolVersion,
272+
Capability.ETC64,
279273
status.networkId,
280274
status.chainWeight,
281275
status.bestHash,
@@ -284,8 +278,7 @@ object EtcPeerManagerActor {
284278

285279
def apply(status: BaseETH6XMessages.Status): RemoteStatus =
286280
RemoteStatus(
287-
ETH,
288-
status.protocolVersion,
281+
Capability.ETH63,
289282
status.networkId,
290283
ChainWeight.totalDifficultyOnly(status.totalDifficulty),
291284
status.bestHash,

src/main/scala/io/iohk/ethereum/network/handshaker/EtcHelloExchangeState.scala

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import io.iohk.ethereum.network.EtcPeerManagerActor.PeerInfo
66
import io.iohk.ethereum.network.handshaker.Handshaker.NextMessage
77
import io.iohk.ethereum.network.p2p.Message
88
import io.iohk.ethereum.network.p2p.messages.Capability
9-
import io.iohk.ethereum.network.p2p.messages.ProtocolVersions
109
import io.iohk.ethereum.network.p2p.messages.WireProtocol.Disconnect
1110
import io.iohk.ethereum.network.p2p.messages.WireProtocol.Hello
1211
import io.iohk.ethereum.utils.Config
@@ -31,21 +30,21 @@ case class EtcHelloExchangeState(handshakerConfiguration: EtcHandshakerConfigura
3130
log.debug("Protocol handshake finished with peer ({})", hello)
3231
// FIXME in principle this should be already negotiated
3332
Capability.negotiate(hello.capabilities.toList, handshakerConfiguration.blockchainConfig.capabilities) match {
34-
case Some(ProtocolVersions.ETC64) =>
33+
case Some(Capability.ETC64) =>
3534
log.debug("Negotiated protocol version with client {} is etc/64", hello.clientId)
3635
EtcNodeStatus64ExchangeState(handshakerConfiguration)
37-
case Some(ProtocolVersions.ETH63) =>
36+
case Some(Capability.ETH63) =>
3837
log.debug("Negotiated protocol version with client {} is eth/63", hello.clientId)
3938
EthNodeStatus63ExchangeState(handshakerConfiguration)
40-
case Some(ProtocolVersions.ETH64) =>
39+
case Some(Capability.ETH64) =>
4140
log.debug("Negotiated protocol version with client {} is eth/64", hello.clientId)
4241
EthNodeStatus64ExchangeState(handshakerConfiguration)
4342
case _ =>
4443
log.debug(
4544
s"Connected peer does not support {} / {} / {} protocol. Disconnecting.",
46-
ProtocolVersions.ETH63,
47-
ProtocolVersions.ETH64,
48-
ProtocolVersions.ETC64
45+
Capability.ETH63,
46+
Capability.ETH64,
47+
Capability.ETC64
4948
)
5049
DisconnectedState(Disconnect.Reasons.IncompatibleP2pProtocolVersion)
5150
}

src/main/scala/io/iohk/ethereum/network/handshaker/EtcNodeStatus64ExchangeState.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import io.iohk.ethereum.network.EtcPeerManagerActor.PeerInfo
44
import io.iohk.ethereum.network.EtcPeerManagerActor.RemoteStatus
55
import io.iohk.ethereum.network.p2p.Message
66
import io.iohk.ethereum.network.p2p.MessageSerializable
7+
import io.iohk.ethereum.network.p2p.messages.Capability
78
import io.iohk.ethereum.network.p2p.messages.ETC64
8-
import io.iohk.ethereum.network.p2p.messages.ProtocolVersions
99

1010
case class EtcNodeStatus64ExchangeState(
1111
handshakerConfiguration: EtcHandshakerConfiguration
@@ -22,7 +22,7 @@ case class EtcNodeStatus64ExchangeState(
2222
val chainWeight = blockchain.getChainWeightByHash(bestBlockHeader.hash).get
2323

2424
val status = ETC64.Status(
25-
protocolVersion = ProtocolVersions.ETC64.version,
25+
protocolVersion = Capability.ETC64.version,
2626
networkId = peerConfiguration.networkId,
2727
chainWeight = chainWeight,
2828
bestHash = bestBlockHeader.hash,

src/main/scala/io/iohk/ethereum/network/handshaker/EthNodeStatus63ExchangeState.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import io.iohk.ethereum.network.EtcPeerManagerActor.RemoteStatus
55
import io.iohk.ethereum.network.p2p.Message
66
import io.iohk.ethereum.network.p2p.MessageSerializable
77
import io.iohk.ethereum.network.p2p.messages.BaseETH6XMessages
8-
import io.iohk.ethereum.network.p2p.messages.ProtocolVersions
8+
import io.iohk.ethereum.network.p2p.messages.Capability
99

1010
case class EthNodeStatus63ExchangeState(
1111
handshakerConfiguration: EtcHandshakerConfiguration
@@ -23,7 +23,7 @@ case class EthNodeStatus63ExchangeState(
2323
val chainWeight = blockchain.getChainWeightByHash(bestBlockHeader.hash).get
2424

2525
val status = BaseETH6XMessages.Status(
26-
protocolVersion = ProtocolVersions.ETH63.version,
26+
protocolVersion = Capability.ETH63.version,
2727
networkId = peerConfiguration.networkId,
2828
totalDifficulty = chainWeight.totalDifficulty,
2929
bestHash = bestBlockHeader.hash,

src/main/scala/io/iohk/ethereum/network/handshaker/EthNodeStatus64ExchangeState.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ import io.iohk.ethereum.network.EtcPeerManagerActor.PeerInfo
55
import io.iohk.ethereum.network.EtcPeerManagerActor.RemoteStatus
66
import io.iohk.ethereum.network.p2p.Message
77
import io.iohk.ethereum.network.p2p.MessageSerializable
8+
import io.iohk.ethereum.network.p2p.messages.Capability
89
import io.iohk.ethereum.network.p2p.messages.ETH64
9-
import io.iohk.ethereum.network.p2p.messages.ProtocolVersions
1010

1111
case class EthNodeStatus64ExchangeState(
1212
handshakerConfiguration: EtcHandshakerConfiguration
@@ -25,7 +25,7 @@ case class EthNodeStatus64ExchangeState(
2525
val genesisHash = blockchainReader.genesisHeader.hash
2626

2727
val status = ETH64.Status(
28-
protocolVersion = ProtocolVersions.ETH64.version,
28+
protocolVersion = Capability.ETH64.version,
2929
networkId = peerConfiguration.networkId,
3030
totalDifficulty = chainWeight.totalDifficulty,
3131
bestHash = bestBlockHeader.hash,

src/main/scala/io/iohk/ethereum/network/p2p/MessageDecoders.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,9 @@ object ETH63MessageDecoder extends MessageDecoder {
109109
object EthereumMessageDecoder {
110110
def ethMessageDecoder(protocolVersion: Capability): MessageDecoder =
111111
protocolVersion match {
112-
case Capability.Capabilities.Etc64Capability => ETC64MessageDecoder.orElse(NetworkMessageDecoder)
113-
case Capability.Capabilities.Eth63Capability => ETH63MessageDecoder.orElse(NetworkMessageDecoder)
114-
case Capability.Capabilities.Eth64Capability => ETH64MessageDecoder.orElse(NetworkMessageDecoder)
115-
case _ => throw new RuntimeException(s"Unsupported Protocol Version $protocolVersion")
112+
case Capability.ETC64 => ETC64MessageDecoder.orElse(NetworkMessageDecoder)
113+
case Capability.ETH63 => ETH63MessageDecoder.orElse(NetworkMessageDecoder)
114+
case Capability.ETH64 => ETH64MessageDecoder.orElse(NetworkMessageDecoder)
115+
case _ => throw new RuntimeException(s"Unsupported Protocol Version $protocolVersion")
116116
}
117117
}

src/main/scala/io/iohk/ethereum/network/p2p/messages/Capability.scala

Lines changed: 32 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -6,54 +6,61 @@ import io.iohk.ethereum.rlp.RLPImplicitConversions._
66
import io.iohk.ethereum.rlp.RLPImplicits._
77
import io.iohk.ethereum.rlp.RLPList
88
import io.iohk.ethereum.rlp.RLPSerializable
9+
import io.iohk.ethereum.rlp.RLPValue
910
import io.iohk.ethereum.rlp.rawDecode
1011

11-
case class Capability(name: String, version: Byte)
12+
sealed trait ProtocolFamily
13+
object ProtocolFamily {
14+
final case object ETH extends ProtocolFamily
15+
final case object ETC extends ProtocolFamily
16+
implicit class ProtocolFamilyEnc(val msg: ProtocolFamily) extends RLPSerializable {
17+
override def toRLPEncodable: RLPEncodeable = msg match {
18+
case ETH => RLPValue("eth".getBytes())
19+
case ETC => RLPValue("etc".getBytes())
20+
}
21+
}
22+
}
23+
24+
sealed abstract class Capability(val name: ProtocolFamily, val version: Byte)
1225

1326
object Capability {
27+
case object ETH63 extends Capability(ProtocolFamily.ETH, 63) //scalastyle:ignore magic.number
28+
case object ETH64 extends Capability(ProtocolFamily.ETH, 64) //scalastyle:ignore magic.number
29+
case object ETC64 extends Capability(ProtocolFamily.ETC, 64) //scalastyle:ignore magic.number
30+
31+
def parse(s: String): Option[Capability] = s match {
32+
case "eth/63" => Some(ETH63)
33+
case "eth/64" => Some(ETH64)
34+
case "etc/64" => Some(ETC64)
35+
case _ => None // TODO: log unknown capability?
36+
}
37+
38+
def parseUnsafe(s: String): Capability =
39+
parse(s).getOrElse(throw new RuntimeException(s"Capability $s not supported by Mantis"))
40+
1441
def negotiate(c1: List[Capability], c2: List[Capability]): Option[Capability] =
1542
c1.intersect(c2) match {
1643
case Nil => None
1744
case l => Some(best(l))
1845
}
1946

20-
private val pattern = "(.*)/(\\d*)".r
21-
22-
def parseUnsafe(protocolVersion: String): Capability =
23-
protocolVersion match {
24-
case pattern(name, version) =>
25-
val c = Capability(name, version.toByte)
26-
if (Capabilities.All.contains(c))
27-
c
28-
else
29-
throw new RuntimeException(s"Capability $protocolVersion not supported by Mantis")
30-
case _ => throw new RuntimeException(s"Unable to parse capability $protocolVersion")
31-
}
32-
3347
//TODO consider how this scoring should be handled with 'snap' and other extended protocols
3448
def best(capabilities: List[Capability]): Capability =
3549
capabilities.maxBy(_.version)
3650

3751
implicit class CapabilityEnc(val msg: Capability) extends RLPSerializable {
38-
override def toRLPEncodable: RLPEncodeable = RLPList(msg.name, msg.version)
52+
override def toRLPEncodable: RLPEncodeable = RLPList(msg.name.toRLPEncodable, msg.version)
3953
}
4054

4155
implicit class CapabilityDec(val bytes: Array[Byte]) extends AnyVal {
42-
def toCapability: Capability = CapabilityRLPEncodableDec(rawDecode(bytes)).toCapability
56+
def toCapability: Option[Capability] = CapabilityRLPEncodableDec(rawDecode(bytes)).toCapability
4357
}
4458

4559
implicit class CapabilityRLPEncodableDec(val rLPEncodeable: RLPEncodeable) extends AnyVal {
46-
def toCapability: Capability = rLPEncodeable match {
47-
case RLPList(name, version) => Capability(name, version)
60+
def toCapability: Option[Capability] = rLPEncodeable match {
61+
case RLPList(name, version) => parse(s"${stringEncDec.decode(name)}/${byteEncDec.decode(version)}")
4862
case _ => throw new RLPException("Cannot decode Capability")
4963
}
5064
}
5165

52-
object Capabilities {
53-
val Eth63Capability: Capability = ProtocolVersions.ETH63
54-
val Eth64Capability: Capability = ProtocolVersions.ETH64
55-
val Etc64Capability: Capability = ProtocolVersions.ETC64
56-
57-
val All: Seq[Capability] = Seq(ProtocolVersions.ETC64, ProtocolVersions.ETH63, ProtocolVersions.ETH64)
58-
}
5966
}

src/main/scala/io/iohk/ethereum/network/p2p/messages/WireProtocol.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ object WireProtocol {
3434

3535
def toHello: Hello = rawDecode(bytes) match {
3636
case RLPList(p2pVersion, clientId, (capabilities: RLPList), listenPort, nodeId, _*) =>
37-
Hello(p2pVersion, clientId, capabilities.items.map(_.toCapability), listenPort, nodeId)
37+
Hello(p2pVersion, clientId, capabilities.items.map(_.toCapability).flatten, listenPort, nodeId)
3838
case _ => throw new RuntimeException("Cannot decode Hello")
3939
}
4040
}
Lines changed: 14 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,23 @@
11
package io.iohk.ethereum.network.p2p
22

3-
package messages {
4-
sealed trait ProtocolFamily
5-
object ProtocolFamily {
6-
final case object ETH extends ProtocolFamily
7-
final case object ETC extends ProtocolFamily
8-
}
9-
}
10-
113
package object messages {
12-
object ProtocolVersions {
13-
val ETH61: Capability = Capability("eth", 61.toByte)
14-
val ETH62: Capability = Capability("eth", 62.toByte)
15-
val ETH63: Capability = Capability("eth", 63.toByte)
16-
val ETH64: Capability = Capability("eth", 64.toByte)
17-
val ETH65: Capability = Capability("eth", 65.toByte)
18-
val ETH66: Capability = Capability("eth", 66.toByte)
194

20-
val ETC64: Capability = Capability("etc", 64.toByte)
21-
22-
val SNAP1: Capability = Capability("snap", 1.toByte)
23-
24-
val SubProtocolOffset = 0x10
25-
}
5+
val SubProtocolOffset = 0x10
266

277
object Codes {
28-
val StatusCode: Int = ProtocolVersions.SubProtocolOffset + 0x00
29-
val NewBlockHashesCode: Int = ProtocolVersions.SubProtocolOffset + 0x01
30-
val SignedTransactionsCode: Int = ProtocolVersions.SubProtocolOffset + 0x02
31-
val GetBlockHeadersCode: Int = ProtocolVersions.SubProtocolOffset + 0x03
32-
val BlockHeadersCode: Int = ProtocolVersions.SubProtocolOffset + 0x04
33-
val GetBlockBodiesCode: Int = ProtocolVersions.SubProtocolOffset + 0x05
34-
val BlockBodiesCode: Int = ProtocolVersions.SubProtocolOffset + 0x06
35-
val NewBlockCode: Int = ProtocolVersions.SubProtocolOffset + 0x07
8+
val StatusCode: Int = SubProtocolOffset + 0x00
9+
val NewBlockHashesCode: Int = SubProtocolOffset + 0x01
10+
val SignedTransactionsCode: Int = SubProtocolOffset + 0x02
11+
val GetBlockHeadersCode: Int = SubProtocolOffset + 0x03
12+
val BlockHeadersCode: Int = SubProtocolOffset + 0x04
13+
val GetBlockBodiesCode: Int = SubProtocolOffset + 0x05
14+
val BlockBodiesCode: Int = SubProtocolOffset + 0x06
15+
val NewBlockCode: Int = SubProtocolOffset + 0x07
3616
// This message is removed in ETH62 and this code is reused in ETH65 with different msg type
37-
val BlockHashesFromNumberCode: Int = ProtocolVersions.SubProtocolOffset + 0x08
38-
val GetNodeDataCode: Int = ProtocolVersions.SubProtocolOffset + 0x0d
39-
val NodeDataCode: Int = ProtocolVersions.SubProtocolOffset + 0x0e
40-
val GetReceiptsCode: Int = ProtocolVersions.SubProtocolOffset + 0x0f
41-
val ReceiptsCode: Int = ProtocolVersions.SubProtocolOffset + 0x10
17+
val BlockHashesFromNumberCode: Int = SubProtocolOffset + 0x08
18+
val GetNodeDataCode: Int = SubProtocolOffset + 0x0d
19+
val NodeDataCode: Int = SubProtocolOffset + 0x0e
20+
val GetReceiptsCode: Int = SubProtocolOffset + 0x0f
21+
val ReceiptsCode: Int = SubProtocolOffset + 0x10
4222
}
4323
}

src/test/scala/io/iohk/ethereum/blockchain/sync/BlockBroadcastSpec.scala

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,10 @@ import io.iohk.ethereum.network.EtcPeerManagerActor.RemoteStatus
2424
import io.iohk.ethereum.network.Peer
2525
import io.iohk.ethereum.network.PeerId
2626
import io.iohk.ethereum.network.p2p.messages.BaseETH6XMessages
27+
import io.iohk.ethereum.network.p2p.messages.Capability
2728
import io.iohk.ethereum.network.p2p.messages.ETC64.NewBlock
2829
import io.iohk.ethereum.network.p2p.messages.ETH62
2930
import io.iohk.ethereum.network.p2p.messages.ETH62.NewBlockHashes
30-
import io.iohk.ethereum.network.p2p.messages.ProtocolFamily
31-
import io.iohk.ethereum.network.p2p.messages.ProtocolVersions
3231

3332
class BlockBroadcastSpec
3433
extends TestKit(ActorSystem("BlockBroadcastSpec_System"))
@@ -62,9 +61,7 @@ class BlockBroadcastSpec
6261
val blockHeader: BlockHeader = baseBlockHeader.copy(number = initialPeerInfo.maxBlockNumber - 3)
6362
val newBlockNewHashes = NewBlockHashes(Seq(ETH62.BlockHash(blockHeader.hash, blockHeader.number)))
6463
val peerInfo = initialPeerInfo
65-
.copy(remoteStatus =
66-
peerStatus.copy(protocolFamily = ProtocolFamily.ETH, protocolVersion = ProtocolVersions.ETH63.version)
67-
)
64+
.copy(remoteStatus = peerStatus.copy(capability = Capability.ETH63))
6865
.withChainWeight(ChainWeight.totalDifficultyOnly(initialPeerInfo.chainWeight.totalDifficulty))
6966
val newBlock =
7067
BaseETH6XMessages.NewBlock(Block(blockHeader, BlockBody(Nil, Nil)), peerInfo.chainWeight.totalDifficulty + 2)
@@ -179,8 +176,7 @@ class BlockBroadcastSpec
179176
val baseBlockHeader = Fixtures.Blocks.Block3125369.header
180177

181178
val peerStatus: RemoteStatus = RemoteStatus(
182-
protocolFamily = ProtocolFamily.ETC,
183-
protocolVersion = ProtocolVersions.ETC64.version,
179+
capability = Capability.ETC64,
184180
networkId = 1,
185181
chainWeight = ChainWeight(10, 10000),
186182
bestHash = Fixtures.Blocks.Block3125369.header.hash,

0 commit comments

Comments
 (0)