0
0
mirror of https://github.com/monero-project/monero synced 2025-10-06 00:32:44 +02:00

Send ZMQ miner notifications after txpool additions

Bug was introduced in c069c04ede, before this txpool additions were not notified on block addition

When receiving blocks with previously unknown conditions, miner data was sent first, but txpool add events for already-added transactions in previous block were sent afterward. Miners would then include already-mined transactions in their new templates due to receiving the mistimed txpool add event.

The fix is to send miner notifications AFTER txpool events are sent, and before normal block notifications are sent (for mining switch speed purposes)

Fixes c069c04ede / #9135
Fixes dfee15eee1 / #7891
This commit is contained in:
WeebDataHoarder
2025-09-24 09:07:20 +02:00
parent 8d4c625713
commit bc8b210aff

View File

@@ -4452,11 +4452,14 @@ leave:
} }
const crypto::hash seedhash = get_block_id_by_height(crypto::rx_seedheight(new_height)); const crypto::hash seedhash = get_block_id_by_height(crypto::rx_seedheight(new_height));
send_miner_notifications(new_height, seedhash, id, already_generated_coins);
// Make sure that txpool notifications happen BEFORE block notifications // Make sure that txpool notifications happen BEFORE block and miner data notifications
notify_txpool_event(std::move(txpool_events)); notify_txpool_event(std::move(txpool_events));
// send miner notifications to switch as soon as possible
send_miner_notifications(new_height, seedhash, id, already_generated_coins);
// then send block notifications
for (const auto& notifier: m_block_notifiers) for (const auto& notifier: m_block_notifiers)
notifier(new_height - 1, {std::addressof(bl), 1}); notifier(new_height - 1, {std::addressof(bl), 1});