Skip to content

Commit 37fcc03

Browse files
committed
Export blocks from parity
1 parent 438e2a8 commit 37fcc03

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed

tests/integration/generate_fixtures/parity.py

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,43 @@ def get_parity_process(
129129
)
130130

131131

132+
@contextlib.contextmanager
133+
def parity_export_blocks_process(
134+
parity_binary,
135+
datadir,
136+
chain_config_file_path,
137+
parity_port):
138+
139+
run_command = (
140+
parity_binary,
141+
'export',
142+
'blocks', os.path.join(datadir, 'blocks_export.rlp'),
143+
'--base-path', datadir,
144+
'--no-ws',
145+
'--no-ui',
146+
'--no-warp',
147+
'--chain', chain_config_file_path,
148+
'--rpcapi', 'all',
149+
'--rpcport', parity_port,
150+
# '--author', common.COINBASE[2:],
151+
)
152+
print(' '.join(run_command))
153+
try:
154+
proc = common.get_process(run_command)
155+
yield proc
156+
finally:
157+
common.kill_proc_gracefully(proc)
158+
output, errors = proc.communicate()
159+
print(
160+
"Parity Process Exited:\n"
161+
"stdout:{0}\n\n"
162+
"stderr:{1}\n\n".format(
163+
force_text(output),
164+
force_text(errors),
165+
)
166+
)
167+
168+
132169
def generate_parity_fixture(destination_dir):
133170
"""
134171
The parity fixture generation strategy is to start a geth client with
@@ -211,6 +248,13 @@ def generate_parity_fixture(destination_dir):
211248

212249
shutil.copytree(datadir, destination_dir)
213250

251+
parity_proc = stack.enter_context(parity_export_blocks_process( # noqa: F841
252+
parity_binary=parity_binary,
253+
datadir=destination_dir,
254+
chain_config_file_path=os.path.join(destination_dir, 'chain_config.json'),
255+
parity_port=parity_port,
256+
))
257+
214258

215259
def connect_nodes(w3_parity, w3_secondary):
216260
parity_peers = w3_parity.parity.netPeers()

0 commit comments

Comments
 (0)