Problem Statement is available in sb_README.pdf
Input is available in mempool.csv
Code is available in main.py
- We read the input mempool.csv file.
- We create a dictionary of transactions with keys as txid and values as its data including fee, weight, parents and childs.
- We have also create a list of tuple with transaction id, fee and weight which is sorted by fee and weight.
- Now the sorted transactions are selected one by one if it's parent transactions are also selected.
- If parent transactions are not selected, then the transaction id is added to deselected_transaction.
- After selecting a transaction, all childs of this transaction are selected if it is deselected before.
- Before adding a transaction weight of all selected transaction is checked to be less than block weight.
- Now, transactions are written on block.txt file.
Output is available in block.txt