Sort transactions by priority and fee to decide priority orders to process transactions.
| 89 | |
| 90 | // Sort transactions by priority and fee to decide priority orders to process transactions. |
| 91 | void GetPriorityTx(CCacheWrapper &cw, int32_t height, set<TxPriority> &txPriorities, const int32_t nFuelRate) { |
| 92 | static TokenSymbol feeSymbol; |
| 93 | static uint64_t fee = 0; |
| 94 | static uint32_t txSize = 0; |
| 95 | static double feePerKb = 0; |
| 96 | static double priority = 0; |
| 97 | |
| 98 | for (map<uint256, CTxMemPoolEntry>::iterator mi = mempool.memPoolTxs.begin(); mi != mempool.memPoolTxs.end(); ++mi) { |
| 99 | CBaseTx *pBaseTx = mi->second.GetTransaction().get(); |
| 100 | if (!pBaseTx->IsBlockRewardTx() && !pCdMan->pTxCache->HasTx(pBaseTx->GetHash())) { |
| 101 | feeSymbol = std::get<0>(mi->second.GetFees()); |
| 102 | fee = std::get<1>(mi->second.GetFees()); |
| 103 | txSize = mi->second.GetTxSize(); |
| 104 | feePerKb = double(fee - pBaseTx->GetFuelFee(cw, height, nFuelRate)) / txSize * 1000.0; |
| 105 | priority = mi->second.GetPriority(); |
| 106 | |
| 107 | txPriorities.emplace(TxPriority(priority, feePerKb, mi->second.GetTransaction())); |
| 108 | } |
| 109 | } |
| 110 | } |
| 111 | |
| 112 | |
| 113 | bool GetCurrentDelegate(const int64_t currentTime, const int32_t currHeight, const VoteDelegateVector &delegates, |
no test coverage detected