tx pool: only increment m_txpool_weight for newly added pool txs

Otherwise we can end up double counting txs towards the weight,
which can over-state the pool weight. E.g. relay tx to node in
stem phase, add its weight to pool weight, then receive tx
from another node, then bump the pool weight again. That double
counts the tx towards the pool weight.

If the weight exceeds the max, the node will "prune" txs from the
pool. Thus, over-counting is probably a cause of, but perhaps
not the only cause of:
https://github.com/seraphis-migration/monero/issues/148
This commit is contained in:
j-berman
2025-10-27 17:14:16 -07:00
parent 6f2574d9d2
commit 90dad18bfb

View File

@@ -344,7 +344,8 @@ namespace cryptonote
}
tvc.m_verifivation_failed = false;
m_txpool_weight += tx_weight;
if (tvc.m_added_to_pool)
m_txpool_weight += tx_weight;
++m_cookie;