@@ -129,6 +129,43 @@ def get_parity_process(
129
129
)
130
130
131
131
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
+
132
169
def generate_parity_fixture (destination_dir ):
133
170
"""
134
171
The parity fixture generation strategy is to start a geth client with
@@ -211,6 +248,13 @@ def generate_parity_fixture(destination_dir):
211
248
212
249
shutil .copytree (datadir , destination_dir )
213
250
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
+
214
258
215
259
def connect_nodes (w3_parity , w3_secondary ):
216
260
parity_peers = w3_parity .parity .netPeers ()
0 commit comments