Commit 283375c9 authored by kafeikui's avatar kafeikui

fix #8010

parent c4d9b85e
...@@ -288,21 +288,23 @@ def debug_dumpBlock(url): ...@@ -288,21 +288,23 @@ def debug_dumpBlock(url):
def wait_for_rpc_server(url): def wait_for_rpc_server(url):
log.info(f'Waiting for RPC server at {url}') log.info(f'Waiting for RPC server at {url}')
conn = http.client.HTTPConnection(url)
headers = {'Content-type': 'application/json'} headers = {'Content-type': 'application/json'}
body = '{"id":1, "jsonrpc":"2.0", "method": "eth_chainId", "params":[]}' body = '{"id":1, "jsonrpc":"2.0", "method": "eth_chainId", "params":[]}'
while True: while True:
try: try:
conn = http.client.HTTPConnection(url)
conn.request('POST', '/', body, headers) conn.request('POST', '/', body, headers)
response = conn.getresponse() response = conn.getresponse()
conn.close()
if response.status < 300: if response.status < 300:
log.info(f'RPC server at {url} ready') log.info(f'RPC server at {url} ready')
return return
except Exception as e: except Exception as e:
log.info(f'Waiting for RPC server at {url}') log.info(f'Waiting for RPC server at {url}')
time.sleep(1) time.sleep(1)
finally:
if conn:
conn.close()
CommandPreset = namedtuple('Command', ['name', 'args', 'cwd', 'timeout']) CommandPreset = namedtuple('Command', ['name', 'args', 'cwd', 'timeout'])
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment