Skip to content

Commit 3fcc279

Browse files
committed
removed functions from bitcoin_cli: find_interesting_txids_in_last_t_blocks + show_num_tx_in_last_t_blocks
1 parent 182751c commit 3fcc279

File tree

2 files changed

+2
-28
lines changed

2 files changed

+2
-28
lines changed

py/bitcoin_cli.py

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import os
33
import subprocess
44
from functools import lru_cache
5-
from typing import List, Optional, Set
5+
from typing import List, Optional
66

77
from datatypes import (Address, BTC, Block, BlockHeight, Feerate, TX, TXID, Timestamp, btc_to_sat)
88
from utils import leveldb_cache
@@ -102,35 +102,12 @@ def get_mempool_txids() -> List[TXID]:
102102
return json.loads(decode_stdout(result))
103103

104104

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-
115105
def show_tx_in_block(block_height):
116106
block: Block = get_block_by_height(block_height)
117107
for txid in block['tx']:
118108
print(txid)
119109

120110

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-
134111
@leveldb_cache
135112
def get_block_time(h: BlockHeight) -> Timestamp:
136113
return get_block_by_height(h)["time"]

py/python_rpc_demo.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
from lightning import LightningRpc, Millisatoshi # pip3 install pylightning
55

6-
from bitcoin_cli import find_interesting_txids_in_last_t_blocks, mine, show_num_tx_in_last_t_blocks
6+
from bitcoin_cli import mine
77
from lightning_cli import make_many_payments, wait_to_route
88

99
ln = os.path.expandvars("$LN")
@@ -43,6 +43,3 @@
4343
for _ in range(20):
4444
mine(1)
4545
time.sleep(5)
46-
47-
show_num_tx_in_last_t_blocks(t=30)
48-
txs = find_interesting_txids_in_last_t_blocks(t=30)

0 commit comments

Comments
 (0)