Compare commits

...

4 Commits

Author SHA1 Message Date
tobtoht
516e5355a1 Merge pull request #10206
4e4e343 Daemon: relay empty fluffy block on found block (j-berman)
2025-11-12 09:22:38 +00:00
tobtoht
14f3d408ad Merge pull request #10204
90dad18 tx pool: only increment m_txpool_weight for newly added pool txs (j-berman)
2025-11-12 09:20:34 +00:00
j-berman
4e4e3439c9 Daemon: relay empty fluffy block on found block 2025-11-11 16:45:06 -08:00
j-berman
90dad18bfb 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
2025-11-11 16:31:37 -08:00
2 changed files with 12 additions and 8 deletions

View File

@@ -1302,20 +1302,23 @@ namespace cryptonote
NOTIFY_NEW_FLUFFY_BLOCK::request arg{};
arg.current_blockchain_height = m_blockchain_storage.get_current_blockchain_height();
std::vector<crypto::hash> missed_txs;
std::vector<cryptonote::blobdata> txs;
m_blockchain_storage.get_transactions_blobs(b.tx_hashes, txs, missed_txs);
for (const auto &tx_hash : b.tx_hashes)
{
if (m_blockchain_storage.have_tx(tx_hash))
continue;
missed_txs.push_back(tx_hash);
}
if(missed_txs.size() && m_blockchain_storage.get_block_id_by_height(get_block_height(b)) != get_block_hash(b))
{
LOG_PRINT_L1("Block found but, seems that reorganize just happened after that, do not relay this block");
return true;
}
CHECK_AND_ASSERT_MES(txs.size() == b.tx_hashes.size() && !missed_txs.size(), false, "can't find some transactions in found block:" << get_block_hash(b) << " txs.size()=" << txs.size()
<< ", b.tx_hashes.size()=" << b.tx_hashes.size() << ", missed_txs.size()" << missed_txs.size());
CHECK_AND_ASSERT_MES(!missed_txs.size(), false, "can't find some transactions in found block:" << get_block_hash(b)
<< " b.tx_hashes.size()=" << b.tx_hashes.size() << ", missed_txs.size()" << missed_txs.size());
block_to_blob(b, arg.b.block);
//pack transactions
for(auto& tx: txs)
arg.b.txs.push_back({tx, crypto::null_hash});
// Relay an empty fluffy block
arg.b.txs.clear();
m_pprotocol->relay_block(arg, exclude_context);
}

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;