-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
42 lines (20 loc) · 837 Bytes
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
from Helper import *
from Transacttions import *
from Block import *
all_files = list_all_tx()
# modify the tx files which contains some additional fields which are important
new_files= Tx.modified_tx_files(all_files)
# sort the tx_files on fee-rate basis
new_files= sorted(new_files, key=lambda x: x['fee_rate'],reverse=True)
valid_tx_list=[]
invalid_tx_list = []
for file in new_files:
if Tx.verify(file):
valid_tx_list.append(file)
else:
invalid_tx_list.append(file)
# now segregate the transactions which can be included in our block i.e do not have any locktime constraints
valid_tx_unlocked= Tx.get_unlocked_tx(valid_tx_list)
(tx_count,tx_included,fee_collected,weight_stored) =Block.get_mined_tx_data(valid_tx_unlocked)
# now create a block
Block.create_block(tx_included)