Skip to content

Commit 5f52258

Browse files
committed
Optimise btcli s list for disk caching
1 parent 9de4ccf commit 5f52258

File tree

1 file changed

+11
-1
lines changed
  • bittensor_cli/src/commands/subnets

1 file changed

+11
-1
lines changed

bittensor_cli/src/commands/subnets/price.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,17 @@ async def price(
5252

5353
step = 300
5454
start_block = max(0, current_block - total_blocks)
55-
block_numbers = list(range(start_block, current_block + 1, step))
55+
56+
# snap start block down to nearest multiple of 10
57+
start_block -= start_block % 10
58+
59+
block_numbers = []
60+
for b in range(start_block, current_block + 1, step):
61+
if b == current_block:
62+
block_numbers.append(b) # exact current block
63+
else:
64+
block_numbers.append(b - (b % 5)) # snap down to multiple of 10
65+
block_numbers = sorted(set(block_numbers))
5666

5767
# Block hashes
5868
block_hash_cors = [

0 commit comments

Comments
 (0)