bittensor
bittensor copied to clipboard
pass block into the metagraph class
Is your feature request related to a problem? Please describe.
I am running a script to compare the weights at different times, and to do this I need to get the metagraph from a previous block. There is currently no way to pass in the block to bt.metagraph()
, you first need to load the metagraph for a subnet and then run metagraph.sync( block=desired_block )
Describe the solution you'd like
Add a block parameter to the metagraph class to sync to a desired block without having to load the metagraph first for the current block.
Describe alternatives you've considered
No response
Additional context
block = subtensor.get_current_block()
print("Current block:", block)
meta = bt.metagraph(netuid=23, lite=False)
meta.sync(block=block) # Sync the metagraph with the current block
# 1200 blocks earlier, or 4 hours
previous_block = block - 1200
meta2 = bt.metagraph(netuid=23, lite=False)
meta2.sync(block=previous_block) # Sync the metagraph with the previous block
weights = meta.W.tolist()
weights2 = meta2.W.tolist()```