Skip to content

Commit

Permalink
Exceptions for two valid blocks were added
Browse files Browse the repository at this point in the history
Compatibility with version 0.7.x was dropped
  • Loading branch information
alexeykiselev committed Jan 12, 2018
1 parent b9c653d commit a9f3cde
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ object HandshakeHandler extends ScorexLogging {
val NodeNameAttributeKey = AttributeKey.newInstance[String]("name")

def versionIsSupported(remoteVersion: (Int, Int, Int)): Boolean =
remoteVersion._1 == 0 && remoteVersion._2 >= 7
remoteVersion._1 == 0 && remoteVersion._2 >= 8

def removeHandshakeHandlers(ctx: ChannelHandlerContext, thisHandler: ChannelHandler): Unit = {
ctx.pipeline().remove(classOf[HandshakeTimeoutHandler])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ package object appender extends ScorexLogging {

private val MaxTimeDrift: Long = 100 // millis

private val correctBlockId1 = ByteStr.decodeBase58("2GNCYVy7k3kEPXzz12saMtRDeXFKr8cymVsG8Yxx3sZZ75eHj9csfXnGHuuJe7XawbcwjKdifUrV1uMq4ZNCWPf1").get
private val correctBlockId2 = ByteStr.decodeBase58("5uZoDnRKeWZV9Thu2nvJVZ5dBvPB7k2gvpzFD618FMXCbBVBMN2rRyvKBZBhAGnGdgeh2LXEeSr9bJqruJxngsE7").get
private val height1 = 812608
private val height2 = 813207

private[appender] val scheduler = monix.execution.Scheduler.singleThread("appender")

private[appender] def processAndBlacklistOnFailure[A, B](ch: Channel, peerDatabase: PeerDatabase, miner: Miner, allChannels: ChannelGroup,
Expand Down Expand Up @@ -96,7 +101,8 @@ package object appender extends ScorexLogging {
effectiveBalance <- genBalance(height).left.map(GenericError(_))
hit = calcHit(prevBlockData, generator)
target = calcTarget(parent.timestamp, parent.consensusData.baseTarget, blockTime, effectiveBalance)
_ <- Either.cond(hit < target, (), GenericError(s"calculated hit $hit >= calculated target $target"))
_ <- Either.cond(hit < target || (height == height1 && block.uniqueId == correctBlockId1) || (height == height2 && block.uniqueId == correctBlockId2),
(), GenericError(s"calculated hit $hit >= calculated target $target"))
} yield ()

r.left.map {
Expand Down

0 comments on commit a9f3cde

Please sign in to comment.