Skip to content

Commit

Permalink
Optimization: use usec in expiration and reuse nNow
Browse files Browse the repository at this point in the history
  • Loading branch information
sipa committed Jun 6, 2016
1 parent e9b4780 commit c2a4724
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5975,15 +5975,15 @@ bool SendMessages(CNode* pto)
nRelayedTransactions++;
{
// Expire old relay messages
while (!vRelayExpiration.empty() && vRelayExpiration.front().first < GetTime())
while (!vRelayExpiration.empty() && vRelayExpiration.front().first < nNow)
{
mapRelay.erase(vRelayExpiration.front().second);
vRelayExpiration.pop_front();
}

auto ret = mapRelay.insert(std::make_pair(hash, std::move(txinfo.tx)));
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) {
Expand Down

0 comments on commit c2a4724

Please sign in to comment.