mirror of
https://git.wownero.com/wownero/wownero.git
synced 2024-08-15 01:03:23 +00:00
Merge pull request #8326
b9d2c78
fix backoff delay logic when re-relaying txs (j-berman)
This commit is contained in:
commit
d52b7d0e99
1 changed files with 4 additions and 4 deletions
|
@ -97,9 +97,9 @@ namespace cryptonote
|
||||||
constexpr const std::chrono::seconds forward_delay_average{CRYPTONOTE_FORWARD_DELAY_AVERAGE};
|
constexpr const std::chrono::seconds forward_delay_average{CRYPTONOTE_FORWARD_DELAY_AVERAGE};
|
||||||
|
|
||||||
// a kind of increasing backoff within min/max bounds
|
// a kind of increasing backoff within min/max bounds
|
||||||
uint64_t get_relay_delay(time_t now, time_t received)
|
uint64_t get_relay_delay(time_t last_relay, time_t received)
|
||||||
{
|
{
|
||||||
time_t d = (now - received + MIN_RELAY_TIME) / MIN_RELAY_TIME * MIN_RELAY_TIME;
|
time_t d = (last_relay - received + MIN_RELAY_TIME) / MIN_RELAY_TIME * MIN_RELAY_TIME;
|
||||||
if (d > MAX_RELAY_TIME)
|
if (d > MAX_RELAY_TIME)
|
||||||
d = MAX_RELAY_TIME;
|
d = MAX_RELAY_TIME;
|
||||||
return d;
|
return d;
|
||||||
|
@ -779,7 +779,7 @@ namespace cryptonote
|
||||||
case relay_method::local:
|
case relay_method::local:
|
||||||
case relay_method::fluff:
|
case relay_method::fluff:
|
||||||
case relay_method::block:
|
case relay_method::block:
|
||||||
if (now - meta.last_relayed_time <= get_relay_delay(now, meta.receive_time))
|
if (now - meta.last_relayed_time <= get_relay_delay(meta.last_relayed_time, meta.receive_time))
|
||||||
return true; // continue to next tx
|
return true; // continue to next tx
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -812,7 +812,7 @@ namespace cryptonote
|
||||||
function is only called every ~2 minutes, so this resetting should be
|
function is only called every ~2 minutes, so this resetting should be
|
||||||
unnecessary, but is primarily a precaution against potential changes
|
unnecessary, but is primarily a precaution against potential changes
|
||||||
to the callback routines. */
|
to the callback routines. */
|
||||||
elem.second.last_relayed_time = now + get_relay_delay(now, elem.second.receive_time);
|
elem.second.last_relayed_time = now + get_relay_delay(elem.second.last_relayed_time, elem.second.receive_time);
|
||||||
m_blockchain.update_txpool_tx(elem.first, elem.second);
|
m_blockchain.update_txpool_tx(elem.first, elem.second);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue