mirror of
https://github.com/wownero/wownero.git
synced 2026-10-17 23:51:37 +02:00
txpool: re-relay txs that haven't been relayed and need to be
Fixes the following circumstance: 1. Wallet submits tx to node. 2. Node adds tx to pool and queues for relay. 3. Node shuts off before the relay executes in the strand. 4. Node restarts. 5. Now, the fix ensures the node will re-relay the tx in the get_relayable_transactions loop. Also makes sure that stem txs don't have last_relayed_time set to max, which would prevent them from ever being re-relayed on a restart as well. Context: https://github.com/seraphis-migration/monero/issues/365#issuecomment-4811722029
This commit is contained in:
@@ -302,9 +302,10 @@ namespace cryptonote
|
||||
{
|
||||
using clock = std::chrono::system_clock;
|
||||
auto last_relayed_time = std::numeric_limits<decltype(meta.last_relayed_time)>::max();
|
||||
if (tx_relay == relay_method::forward)
|
||||
if (tx_relay == relay_method::forward || tx_relay == relay_method::stem)
|
||||
{
|
||||
last_relayed_time = clock::to_time_t(clock::now() + crypto::random_poisson_seconds{forward_delay_average}());
|
||||
const auto delay = tx_relay == relay_method::forward ? forward_delay_average : dandelionpp_embargo_average;
|
||||
last_relayed_time = clock::to_time_t(clock::now() + crypto::random_poisson_seconds{delay}());
|
||||
set_if_less(m_next_check, time_t(last_relayed_time));
|
||||
}
|
||||
// else the `set_relayed` function will adjust the time accordingly later
|
||||
@@ -840,6 +841,8 @@ namespace cryptonote
|
||||
case relay_method::local:
|
||||
case relay_method::fluff:
|
||||
case relay_method::block:
|
||||
if (!meta.relayed)
|
||||
break; // if it hasn't been relayed yet, relay it
|
||||
if (now - meta.last_relayed_time <= get_relay_delay(meta.last_relayed_time, meta.receive_time))
|
||||
return true; // continue to next tx
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user