Use tx cost rather than evictionWeight when checking mempool capacity
This commit is contained in:
parent
2d9becbeb8
commit
9b2a04bd95
|
@ -124,12 +124,12 @@ void WeightedTxTree::remove(const uint256& txId)
|
||||||
|
|
||||||
boost::optional<uint256> WeightedTxTree::maybeDropRandom()
|
boost::optional<uint256> WeightedTxTree::maybeDropRandom()
|
||||||
{
|
{
|
||||||
int64_t totalPenaltyWeight = getTotalWeight().evictionWeight;
|
TxWeight totalTxWeight = getTotalWeight();
|
||||||
if (totalPenaltyWeight <= capacity) {
|
if (totalTxWeight.cost <= capacity) {
|
||||||
return boost::none;
|
return boost::none;
|
||||||
}
|
}
|
||||||
LogPrint("mempool", "Mempool cost limit exceeded (cost=%d, limit=%d)\n", totalPenaltyWeight, capacity);
|
LogPrint("mempool", "Mempool cost limit exceeded (cost=%d, limit=%d)\n", totalTxWeight.cost, capacity);
|
||||||
int randomWeight = GetRand(totalPenaltyWeight);
|
int randomWeight = GetRand(totalTxWeight.evictionWeight);
|
||||||
WeightedTxInfo drop = txIdAndWeights[findByEvictionWeight(0, randomWeight)];
|
WeightedTxInfo drop = txIdAndWeights[findByEvictionWeight(0, randomWeight)];
|
||||||
LogPrint("mempool", "Evicting transaction (txid=%s, cost=%d, evictionWeight=%d)\n",
|
LogPrint("mempool", "Evicting transaction (txid=%s, cost=%d, evictionWeight=%d)\n",
|
||||||
drop.txId.ToString(), drop.txWeight.cost, drop.txWeight.evictionWeight);
|
drop.txId.ToString(), drop.txWeight.cost, drop.txWeight.evictionWeight);
|
||||||
|
|
Loading…
Reference in New Issue