Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ETCM-211] Tracking of headers/bodies requests that will be ignored d…
…ue to invalidation (#749)
- Loading branch information
Nicolás Tallar
committed
Oct 27, 2020
1 parent
1667f33
commit ae398e1
Showing
4 changed files
with
291 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package io.iohk.ethereum | ||
|
||
import akka.util.ByteString | ||
import io.iohk.ethereum.domain.Block | ||
|
||
object BlockHelpers { | ||
|
||
def generateChain(amount: Int, parent: Block): Seq[Block] = { | ||
(1 to amount).foldLeft[Seq[Block]](Nil){ case (acc, _) => | ||
val baseBlock = Fixtures.Blocks.ValidBlock.block | ||
|
||
val parentHeader = acc.lastOption.getOrElse(parent) | ||
val blockHeader = baseBlock.header.copy( | ||
number = parentHeader.number + 1, | ||
parentHash = parentHeader.hash, | ||
// Random nonce used for having our blocks be different | ||
nonce = ByteString(Math.random().toString) | ||
) | ||
val block = baseBlock.copy(header = blockHeader) | ||
|
||
acc :+ block | ||
} | ||
} | ||
|
||
} |
Oops, something went wrong.