Changeset View
Changeset View
Standalone View
Standalone View
src/miner.cpp
Show First 20 Lines • Show All 91 Lines • ▼ Show 20 Lines | |||||
BlockAssembler::BlockAssembler(const Config &_config) : config(&_config) { | BlockAssembler::BlockAssembler(const Config &_config) : config(&_config) { | ||||
if (gArgs.IsArgSet("-blockmintxfee")) { | if (gArgs.IsArgSet("-blockmintxfee")) { | ||||
Amount n = Amount::zero(); | Amount n = Amount::zero(); | ||||
ParseMoney(gArgs.GetArg("-blockmintxfee", ""), n); | ParseMoney(gArgs.GetArg("-blockmintxfee", ""), n); | ||||
blockMinFeeRate = CFeeRate(n); | blockMinFeeRate = CFeeRate(n); | ||||
} else { | } else { | ||||
blockMinFeeRate = CFeeRate(DEFAULT_BLOCK_MIN_TX_FEE); | blockMinFeeRate = CFeeRate(DEFAULT_BLOCK_MIN_TX_FEE_PER_KB); | ||||
} | } | ||||
LOCK(cs_main); | LOCK(cs_main); | ||||
nMaxGeneratedBlockSize = | nMaxGeneratedBlockSize = | ||||
ComputeMaxGeneratedBlockSize(*config, chainActive.Tip()); | ComputeMaxGeneratedBlockSize(*config, chainActive.Tip()); | ||||
} | } | ||||
void BlockAssembler::resetBlock() { | void BlockAssembler::resetBlock() { | ||||
▲ Show 20 Lines • Show All 276 Lines • ▼ Show 20 Lines | for (const CTxMemPool::txiter it : alreadyAdded) { | ||||
continue; | continue; | ||||
} | } | ||||
++nDescendantsUpdated; | ++nDescendantsUpdated; | ||||
modtxiter mit = mapModifiedTx.find(desc); | modtxiter mit = mapModifiedTx.find(desc); | ||||
if (mit == mapModifiedTx.end()) { | if (mit == mapModifiedTx.end()) { | ||||
CTxMemPoolModifiedEntry modEntry(desc); | CTxMemPoolModifiedEntry modEntry(desc); | ||||
modEntry.nSizeWithAncestors -= it->GetTxSize(); | modEntry.nSizeWithAncestors -= it->GetTxSize(); | ||||
modEntry.nBillableSizeWithAncestors -= it->GetTxBillableSize(); | |||||
modEntry.nModFeesWithAncestors -= it->GetModifiedFee(); | modEntry.nModFeesWithAncestors -= it->GetModifiedFee(); | ||||
modEntry.nSigOpCountWithAncestors -= it->GetSigOpCount(); | modEntry.nSigOpCountWithAncestors -= it->GetSigOpCount(); | ||||
mapModifiedTx.insert(modEntry); | mapModifiedTx.insert(modEntry); | ||||
} else { | } else { | ||||
mapModifiedTx.modify(mit, update_for_parent_inclusion(it)); | mapModifiedTx.modify(mit, update_for_parent_inclusion(it)); | ||||
} | } | ||||
} | } | ||||
} | } | ||||
▲ Show 20 Lines • Show All 104 Lines • ▼ Show 20 Lines | while (mi != mempool.mapTx.get<ancestor_score>().end() || | ||||
} | } | ||||
} | } | ||||
// We skip mapTx entries that are inBlock, and mapModifiedTx shouldn't | // We skip mapTx entries that are inBlock, and mapModifiedTx shouldn't | ||||
// contain anything that is inBlock. | // contain anything that is inBlock. | ||||
assert(!inBlock.count(iter)); | assert(!inBlock.count(iter)); | ||||
uint64_t packageSize = iter->GetSizeWithAncestors(); | uint64_t packageSize = iter->GetSizeWithAncestors(); | ||||
uint64_t packageBillableSize = iter->GetBillableSizeWithAncestors(); | |||||
Amount packageFees = iter->GetModFeesWithAncestors(); | Amount packageFees = iter->GetModFeesWithAncestors(); | ||||
int64_t packageSigOps = iter->GetSigOpCountWithAncestors(); | int64_t packageSigOps = iter->GetSigOpCountWithAncestors(); | ||||
if (fUsingModified) { | if (fUsingModified) { | ||||
packageSize = modit->nSizeWithAncestors; | packageSize = modit->nSizeWithAncestors; | ||||
packageBillableSize = modit->nBillableSizeWithAncestors; | |||||
packageFees = modit->nModFeesWithAncestors; | packageFees = modit->nModFeesWithAncestors; | ||||
packageSigOps = modit->nSigOpCountWithAncestors; | packageSigOps = modit->nSigOpCountWithAncestors; | ||||
} | } | ||||
if (packageFees < blockMinFeeRate.GetFee(packageSize)) { | if (packageFees < blockMinFeeRate.GetFee(packageBillableSize)) { | ||||
// Everything else we might consider has a lower fee rate | // Everything else we might consider has a lower fee rate | ||||
return; | return; | ||||
} | } | ||||
if (!TestPackage(packageSize, packageSigOps)) { | if (!TestPackage(packageSize, packageSigOps)) { | ||||
if (fUsingModified) { | if (fUsingModified) { | ||||
// Since we always look at the best entry in mapModifiedTx, we | // Since we always look at the best entry in mapModifiedTx, we | ||||
// must erase failed entries so that we can consider the next | // must erase failed entries so that we can consider the next | ||||
▲ Show 20 Lines • Show All 172 Lines • Show Last 20 Lines |