Put size increment and decrement on their own lines

This commit is contained in:
Eirik Ogilvie-Wigley 2019-10-09 12:06:03 -06:00
parent 30be750644
commit 2365ba7b97
1 changed files with 7 additions and 2 deletions

View File

@ -86,7 +86,8 @@ void WeightedTxTree::add(const WeightedTxInfo& weightedTxInfo)
txIdAndWeights.push_back(weightedTxInfo);
childWeights.push_back(ZERO_WEIGHT);
txIdToIndexMap[weightedTxInfo.txId] = size;
backPropagate(size++, weightedTxInfo.txWeight);
backPropagate(size, weightedTxInfo.txWeight);
size += 1;
}
void WeightedTxTree::remove(const uint256& txId)
@ -97,7 +98,11 @@ void WeightedTxTree::remove(const uint256& txId)
size_t removeIndex = txIdToIndexMap[txId];
TxWeight lastChildWeight = txIdAndWeights[--size].txWeight;
// We reduce the size at the start of this method to avoid saying size - 1
// when refering to the last element of the array below
size -= 1;
TxWeight lastChildWeight = txIdAndWeights[size].txWeight;
backPropagate(size, lastChildWeight.negate());
if (removeIndex < size) {