@@ -220,6 +220,18 @@ def init(self, ctx: flexitest.EnvContext) -> flexitest.LiveEnv:
220220 seq_fac = ctx .get_factory ("sequencer" )
221221 reth_fac = ctx .get_factory ("reth" )
222222
223+ # reth needs some time to startup, start it first
224+ secret_dir = ctx .make_service_dir ("secret" )
225+ reth_secret_path = os .path .join (secret_dir , "jwt.hex" )
226+
227+ with open (reth_secret_path , "w" ) as file :
228+ file .write (generate_jwt_secret ())
229+
230+ reth = reth_fac .create_exec_client (reth_secret_path )
231+
232+ reth_port = reth .get_prop ("rpc_port" )
233+ reth_socket = f"localhost:{ reth_port } "
234+
223235 bitcoind = btc_fac .create_regtest_bitcoin ()
224236 time .sleep (BLOCK_GENERATION_INTERVAL_SECS )
225237
@@ -234,17 +246,6 @@ def init(self, ctx: flexitest.EnvContext) -> flexitest.LiveEnv:
234246 print (f"Pre generating { self .pre_generate_blocks } blocks to address { seqaddr } " )
235247 brpc .proxy .generatetoaddress (self .pre_generate_blocks , seqaddr )
236248
237- secret_dir = ctx .make_service_dir ("secret" )
238- reth_secret_path = os .path .join (secret_dir , "jwt.hex" )
239-
240- with open (reth_secret_path , "w" ) as file :
241- file .write (generate_jwt_secret ())
242-
243- reth = reth_fac .create_exec_client (reth_secret_path )
244-
245- reth_port = reth .get_prop ("rpc_port" )
246- reth_socket = f"localhost:{ reth_port } "
247-
248249 # generate blocks every 500 millis
249250 generate_blocks (brpc , BLOCK_GENERATION_INTERVAL_SECS , seqaddr )
250251 rpc_port = bitcoind .get_prop ("rpc_port" )
0 commit comments