Put size increment and decrement on their own lines
This commit is contained in:
parent
30be750644
commit
2365ba7b97
|
@ -86,7 +86,8 @@ void WeightedTxTree::add(const WeightedTxInfo& weightedTxInfo)
|
||||||
txIdAndWeights.push_back(weightedTxInfo);
|
txIdAndWeights.push_back(weightedTxInfo);
|
||||||
childWeights.push_back(ZERO_WEIGHT);
|
childWeights.push_back(ZERO_WEIGHT);
|
||||||
txIdToIndexMap[weightedTxInfo.txId] = size;
|
txIdToIndexMap[weightedTxInfo.txId] = size;
|
||||||
backPropagate(size++, weightedTxInfo.txWeight);
|
backPropagate(size, weightedTxInfo.txWeight);
|
||||||
|
size += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void WeightedTxTree::remove(const uint256& txId)
|
void WeightedTxTree::remove(const uint256& txId)
|
||||||
|
@ -97,7 +98,11 @@ void WeightedTxTree::remove(const uint256& txId)
|
||||||
|
|
||||||
size_t removeIndex = txIdToIndexMap[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());
|
backPropagate(size, lastChildWeight.negate());
|
||||||
|
|
||||||
if (removeIndex < size) {
|
if (removeIndex < size) {
|
||||||
|
|
Loading…
Reference in New Issue