diff --git a/precog/utils/bittensor.py b/precog/utils/bittensor.py index 7903a33..ef406b8 100644 --- a/precog/utils/bittensor.py +++ b/precog/utils/bittensor.py @@ -13,9 +13,9 @@ def setup_bittensor_objects(self): # if chain endpoint is set, overwrite network arg self.config.subtensor.network = self.config.subtensor.chain_endpoint # Initialize subtensor. - self.subtensor = bt.subtensor(config=self.config, network=self.config.subtensor.network) + self.subtensor = bt.subtensor(config=self.config) self.metagraph = self.subtensor.metagraph(self.config.netuid) - self.wallet = bt.wallet(name=self.config.wallet.name, hotkey=self.config.wallet.hotkey) + self.wallet = bt.wallet(config=self.config) self.dendrite = bt.dendrite(wallet=self.wallet) self.axon = bt.axon(wallet=self.wallet, config=self.config, port=self.config.axon.port) # Connect the validator to the network. diff --git a/precog/validators/weight_setter.py b/precog/validators/weight_setter.py index 86a0b89..d3f08fb 100755 --- a/precog/validators/weight_setter.py +++ b/precog/validators/weight_setter.py @@ -144,10 +144,13 @@ async def set_weights(self): "Failed to set weights this iteration with message:", msg, ) - self.current_block = self.subtensor.get_current_block() - self.blocks_since_last_update = ( - self.current_block - self.node_query("SubtensorModule", "LastUpdate", [self.config.netuid])[self.my_uid] - ) + try: + self.current_block = self.subtensor.get_current_block() + self.blocks_since_last_update = ( + self.current_block - self.node_query("SubtensorModule", "LastUpdate", [self.config.netuid])[self.my_uid] + ) + except Exception: + bt.logging.error("Failed to get current block, skipping block update") async def scheduled_prediction_request(self): if not hasattr(self, "timestamp"):