|
2 | 2 | import os
|
3 | 3 | import subprocess
|
4 | 4 | from functools import lru_cache
|
5 |
| -from typing import List, Optional, Set |
| 5 | +from typing import List, Optional |
6 | 6 |
|
7 | 7 | from datatypes import (Address, BTC, Block, BlockHeight, Feerate, TX, TXID, Timestamp, btc_to_sat)
|
8 | 8 | from utils import leveldb_cache
|
@@ -102,35 +102,12 @@ def get_mempool_txids() -> List[TXID]:
|
102 | 102 | return json.loads(decode_stdout(result))
|
103 | 103 |
|
104 | 104 |
|
105 |
| -def show_num_tx_in_last_t_blocks(t: int): |
106 |
| - """ |
107 |
| - print the number of transactions in each of the last t blocks. |
108 |
| - """ |
109 |
| - block_height = blockchain_height() |
110 |
| - for i in range(block_height - t + 1, block_height + 1): |
111 |
| - num_tx_in_block_i = num_tx_in_block(block=get_block_by_height(i)) |
112 |
| - print(f"number of tx in block {i}: {num_tx_in_block_i}") |
113 |
| - |
114 |
| - |
115 | 105 | def show_tx_in_block(block_height):
|
116 | 106 | block: Block = get_block_by_height(block_height)
|
117 | 107 | for txid in block['tx']:
|
118 | 108 | print(txid)
|
119 | 109 |
|
120 | 110 |
|
121 |
| -def find_interesting_txids_in_last_t_blocks(t: int) -> Set[TXID]: |
122 |
| - """ |
123 |
| - return a set of TXIDs from the last t blocks that are not coinbase transactions |
124 |
| - """ |
125 |
| - block_height = blockchain_height() |
126 |
| - return { |
127 |
| - txid |
128 |
| - for height in range(block_height - t + 1, block_height + 1) |
129 |
| - for txid in get_block_by_height(height)["tx"] |
130 |
| - if "coinbase" not in get_transaction(txid)["vin"][0] |
131 |
| - } |
132 |
| - |
133 |
| - |
134 | 111 | @leveldb_cache
|
135 | 112 | def get_block_time(h: BlockHeight) -> Timestamp:
|
136 | 113 | return get_block_by_height(h)["time"]
|
|
0 commit comments