fix
This commit is contained in:
@@ -1,8 +1,15 @@
|
|||||||
|
import argparse
|
||||||
import requests
|
import requests
|
||||||
|
|
||||||
# Define the RPC endpoints
|
# Parse command-line arguments
|
||||||
rpc_url_1 = "$1"
|
parser = argparse.ArgumentParser(description='Compare block hashes from two Ethereum RPC endpoints.')
|
||||||
rpc_url_2 = "$2"
|
parser.add_argument('rpc_url_1', type=str, help='The first RPC URL')
|
||||||
|
parser.add_argument('rpc_url_2', type=str, help='The second RPC URL')
|
||||||
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
# Define the RPC endpoints from the command-line arguments
|
||||||
|
rpc_url_1 = args.rpc_url_1
|
||||||
|
rpc_url_2 = args.rpc_url_2
|
||||||
|
|
||||||
# Define the JSON-RPC payload
|
# Define the JSON-RPC payload
|
||||||
def get_block_by_number_payload(block_number):
|
def get_block_by_number_payload(block_number):
|
||||||
@@ -43,6 +50,7 @@ for block_number in range(latest_block_number, -1, -1):
|
|||||||
print(f"Block hash: {hash_1}")
|
print(f"Block hash: {hash_1}")
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
print(f"The first matching block is {block_number} - {hash_1} - {hash_2}")
|
print(f"Failed to match block {block_number} - {hash_1} - {hash_2}")
|
||||||
else:
|
else:
|
||||||
print("No matching block hash found.")
|
print("No matching block hash found.")
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user