Mining or block creation process in a blockchain consensus protocol can be regarded generally as an optimization problem. We have N different transactions in a transaction pool from which we have to find an M number of transactions that are consistent with each other and with older transactions as well in a way that double spending is avoided. Hence each transaction has a two parameters: a size and a transaction fee. The purpose of the optimization is to put a number of consistent set of transactions into the block that remains under the block size limit but provides the maximum possible transaction fee: I am curious if the problem can be generalized and solved in linear time probably the miners simply use heuristics.