|
|
@ -3,6 +3,8 @@ |
|
|
|
// Distributed under the MIT/X11 software license, see the accompanying
|
|
|
|
// Distributed under the MIT/X11 software license, see the accompanying
|
|
|
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
|
|
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include <inttypes.h> |
|
|
|
|
|
|
|
|
|
|
|
#include "miner.h" |
|
|
|
#include "miner.h" |
|
|
|
|
|
|
|
|
|
|
|
#include "core.h" |
|
|
|
#include "core.h" |
|
|
@ -186,6 +188,9 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn) |
|
|
|
unsigned int nTxSize = ::GetSerializeSize(tx, SER_NETWORK, PROTOCOL_VERSION); |
|
|
|
unsigned int nTxSize = ::GetSerializeSize(tx, SER_NETWORK, PROTOCOL_VERSION); |
|
|
|
dPriority = tx.ComputePriority(dPriority, nTxSize); |
|
|
|
dPriority = tx.ComputePriority(dPriority, nTxSize); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
uint256 hash = tx.GetHash(); |
|
|
|
|
|
|
|
mempool.ApplyDeltas(hash, dPriority, nTotalIn); |
|
|
|
|
|
|
|
|
|
|
|
CFeeRate feeRate(nTotalIn-tx.GetValueOut(), nTxSize); |
|
|
|
CFeeRate feeRate(nTotalIn-tx.GetValueOut(), nTxSize); |
|
|
|
|
|
|
|
|
|
|
|
if (porphan) |
|
|
|
if (porphan) |
|
|
@ -227,10 +232,14 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn) |
|
|
|
continue; |
|
|
|
continue; |
|
|
|
|
|
|
|
|
|
|
|
// Skip free transactions if we're past the minimum block size:
|
|
|
|
// Skip free transactions if we're past the minimum block size:
|
|
|
|
if (fSortedByFee && (feeRate < CTransaction::minRelayTxFee) && (nBlockSize + nTxSize >= nBlockMinSize)) |
|
|
|
const uint256& hash = tx.GetHash(); |
|
|
|
|
|
|
|
double dPriorityDelta = 0; |
|
|
|
|
|
|
|
int64_t nFeeDelta = 0; |
|
|
|
|
|
|
|
mempool.ApplyDeltas(hash, dPriorityDelta, nFeeDelta); |
|
|
|
|
|
|
|
if (fSortedByFee && (dPriorityDelta <= 0) && (nFeeDelta <= 0) && (feeRate < CTransaction::minRelayTxFee) && (nBlockSize + nTxSize >= nBlockMinSize)) |
|
|
|
continue; |
|
|
|
continue; |
|
|
|
|
|
|
|
|
|
|
|
// Prioritize by fee once past the priority size or we run out of high-priority
|
|
|
|
// Prioritise by fee once past the priority size or we run out of high-priority
|
|
|
|
// transactions:
|
|
|
|
// transactions:
|
|
|
|
if (!fSortedByFee && |
|
|
|
if (!fSortedByFee && |
|
|
|
((nBlockSize + nTxSize >= nBlockPrioritySize) || !AllowFree(dPriority))) |
|
|
|
((nBlockSize + nTxSize >= nBlockPrioritySize) || !AllowFree(dPriority))) |
|
|
@ -257,7 +266,6 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn) |
|
|
|
continue; |
|
|
|
continue; |
|
|
|
|
|
|
|
|
|
|
|
CTxUndo txundo; |
|
|
|
CTxUndo txundo; |
|
|
|
const uint256& hash = tx.GetHash(); |
|
|
|
|
|
|
|
UpdateCoins(tx, state, view, txundo, pindexPrev->nHeight+1); |
|
|
|
UpdateCoins(tx, state, view, txundo, pindexPrev->nHeight+1); |
|
|
|
|
|
|
|
|
|
|
|
// Added
|
|
|
|
// Added
|
|
|
|