quick and dirty modification of sync test that uses gzipped blocks to use era1 files instead.
This commit is contained in:
parent
47a86f0df6
commit
34c795ded4
|
@ -10,9 +10,11 @@
|
|||
|
||||
import
|
||||
std/[os, sequtils, strformat, strutils],
|
||||
results,
|
||||
eth/[common, rlp],
|
||||
nimcrypto/utils,
|
||||
../../nimbus/db/core_db,
|
||||
../../fluffy/eth_data/era1,
|
||||
./gunzip
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
|
@ -172,11 +174,25 @@ iterator undumpBlocks*(gzFile: string): (seq[BlockHeader],seq[BlockBody]) =
|
|||
echo &"*** Ignoring line({lno}): {line}."
|
||||
waitFor = "transaction"
|
||||
|
||||
iterator undumpBlocks*(gzs: seq[string]): (seq[BlockHeader],seq[BlockBody])=
|
||||
|
||||
iterator undumpBlocks*(era1files: seq[string]): (seq[BlockHeader],seq[BlockBody])=
|
||||
## Variant of `undumpBlocks()`
|
||||
for f in gzs:
|
||||
for w in f.undumpBlocks:
|
||||
yield w
|
||||
for fileName in era1files:
|
||||
var headers: seq[BlockHeader]
|
||||
var bodies: seq[BlockBody]
|
||||
let era1File = Era1File.open(fileName).value
|
||||
for blockTuple in era1File.era1BlockTuples:
|
||||
headers.add blockTuple.header
|
||||
bodies.add blockTuple.body
|
||||
if headers.len == 100:
|
||||
yield (headers, bodies)
|
||||
headers.setLen 0
|
||||
bodies.setLen 0
|
||||
if headers.len > 0:
|
||||
yield (headers, bodies)
|
||||
headers.setLen 0
|
||||
bodies.setLen 0
|
||||
|
||||
|
||||
iterator undumpBlocks*(
|
||||
gzFile: string; # Data dump file
|
||||
|
|
|
@ -33,12 +33,12 @@ const
|
|||
# Reference file for finding some database directory base
|
||||
sampleDirRefFile = "coredb_test_xx.nim"
|
||||
|
||||
dbTypeDefault = LegacyDbMemory
|
||||
ldgTypeDefault = LegacyAccountsCache
|
||||
dbTypeDefault = AristoDbRocks
|
||||
ldgTypeDefault = LedgerCache
|
||||
|
||||
let
|
||||
# Standard test sample
|
||||
bChainCapture = bulkTest0
|
||||
bChainCapture = mainEra1
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Helpers
|
||||
|
@ -275,10 +275,7 @@ when isMainModule:
|
|||
|
||||
sampleList = cmdLineConfig().samples
|
||||
if sampleList.len == 0:
|
||||
sampleList = @[bulkTest0]
|
||||
when true:
|
||||
sampleList = @[bulkTest2, bulkTest3]
|
||||
sampleList = @[ariTest1] # debugging
|
||||
sampleList = @[mainEra1]
|
||||
|
||||
var state: (Duration, int)
|
||||
for n,capture in sampleList:
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
# distributed except according to those terms.
|
||||
|
||||
import
|
||||
std/[os, sequtils],
|
||||
eth/common,
|
||||
../../nimbus/db/core_db,
|
||||
../../nimbus/common/chain_config
|
||||
|
@ -84,6 +85,14 @@ let
|
|||
"mainnet550849-719232.txt.gz",
|
||||
"mainnet719233-843841.txt.gz"])
|
||||
|
||||
mainEra1* = CaptureSpecs(
|
||||
builtIn: true,
|
||||
name: "main",
|
||||
network: MainNet,
|
||||
files: toSeq(walkPattern("*.era1")),
|
||||
numBlocks: high(int),
|
||||
dbType: AristoDbRocks)
|
||||
|
||||
# ------------------
|
||||
|
||||
bulkTest0* = goerliSample
|
||||
|
|
Loading…
Reference in New Issue