Optimization: use usec in expiration and reuse nNow
This commit is contained in:
parent
e9b4780b29
commit
c2a4724642
1 changed files with 2 additions and 2 deletions
|
@ -5975,7 +5975,7 @@ bool SendMessages(CNode* pto)
|
||||||
nRelayedTransactions++;
|
nRelayedTransactions++;
|
||||||
{
|
{
|
||||||
// Expire old relay messages
|
// Expire old relay messages
|
||||||
while (!vRelayExpiration.empty() && vRelayExpiration.front().first < GetTime())
|
while (!vRelayExpiration.empty() && vRelayExpiration.front().first < nNow)
|
||||||
{
|
{
|
||||||
mapRelay.erase(vRelayExpiration.front().second);
|
mapRelay.erase(vRelayExpiration.front().second);
|
||||||
vRelayExpiration.pop_front();
|
vRelayExpiration.pop_front();
|
||||||
|
@ -5983,7 +5983,7 @@ bool SendMessages(CNode* pto)
|
||||||
|
|
||||||
auto ret = mapRelay.insert(std::make_pair(hash, std::move(txinfo.tx)));
|
auto ret = mapRelay.insert(std::make_pair(hash, std::move(txinfo.tx)));
|
||||||
if (ret.second) {
|
if (ret.second) {
|
||||||
vRelayExpiration.push_back(std::make_pair(GetTime() + 15 * 60, ret.first));
|
vRelayExpiration.push_back(std::make_pair(nNow + 15 * 60 * 1000000, ret.first));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (vInv.size() == MAX_INV_SZ) {
|
if (vInv.size() == MAX_INV_SZ) {
|
||||||
|
|
Loading…
Reference in a new issue