feat: load web3 provider in the master node
This commit is contained in:
parent
87646d9661
commit
12caa7358f
@ -29,7 +29,8 @@ class NodeManager():
|
|||||||
self.docker_client = docker.from_env()
|
self.docker_client = docker.from_env()
|
||||||
|
|
||||||
# web3 provider
|
# web3 provider
|
||||||
self.w3 = Web3(Web3.HTTPProvider(WEB3_PROVIDER_URL + WEB3_PROVIDER_KEY))
|
# if this is master, it should init a Web object.
|
||||||
|
self.w3 = None
|
||||||
|
|
||||||
time.sleep(2)
|
time.sleep(2)
|
||||||
|
|
||||||
@ -74,9 +75,20 @@ class NodeManager():
|
|||||||
print("No other nodes in your subnet.")
|
print("No other nodes in your subnet.")
|
||||||
|
|
||||||
def start_listen_task(self):
|
def start_listen_task(self):
|
||||||
print("Waiting for the new task from Sepolia testnet...")
|
self.w3 = Web3(Web3.HTTPProvider(WEB3_PROVIDER_URL + WEB3_PROVIDER_KEY))
|
||||||
self.cluster_communication_module.start_listen_task()
|
print(f"We have use {WEB3_PROVIDER_URL+WEB3_PROVIDER_KEY} as the web3 provider.")
|
||||||
|
print(f"And we have load your wallet private key {WALLET_KEY}")
|
||||||
|
print()
|
||||||
|
if self.w3.is_connected():
|
||||||
|
print("Connected Successfully.")
|
||||||
|
print()
|
||||||
|
print("Waiting for the new task from Sepolia testnet...")
|
||||||
|
self.cluster_communication_module.start_listen_task()
|
||||||
|
|
||||||
|
else:
|
||||||
|
print("Connected Failed.")
|
||||||
|
print("Please check for your provider key & wallet key")
|
||||||
|
|
||||||
|
|
||||||
def cluster_info(self):
|
def cluster_info(self):
|
||||||
info = self.cluster_communication_module.cluster_info()
|
info = self.cluster_communication_module.cluster_info()
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user