@@ -40,9 +40,9 @@ static constexpr int64_t ORPHAN_TX_EXPIRE_TIME = 20 * 60;
4040/* * Minimum time between orphan transactions expire time checks in seconds */
4141static constexpr int64_t ORPHAN_TX_EXPIRE_INTERVAL = 5 * 60 ;
4242/* * How long to cache transactions in mapRelay for normal relay */
43- static constexpr std::chrono::seconds RELAY_TX_CACHE_TIME = std::chrono::minutes{ 15 } ;
43+ static constexpr auto RELAY_TX_CACHE_TIME = 15min ;
4444/* * How long a transaction has to be in the mempool before it can unconditionally be relayed (even when not in mapRelay). */
45- static constexpr std::chrono::seconds UNCONDITIONAL_RELAY_DELAY = std::chrono::minutes{ 2 } ;
45+ static constexpr auto UNCONDITIONAL_RELAY_DELAY = 2min ;
4646/* * Headers download timeout.
4747 * Timeout = base + per_header * (expected number of headers) */
4848static constexpr auto HEADERS_DOWNLOAD_TIMEOUT_BASE = 15min;
@@ -467,7 +467,7 @@ class PeerManagerImpl final : public PeerManager
467467 typedef std::map<uint256, CTransactionRef> MapRelay;
468468 MapRelay mapRelay GUARDED_BY (cs_main);
469469 /* * Expiration-time ordered list of (expire time, relay map entry) pairs. */
470- std::deque<std::pair<int64_t , MapRelay::iterator>> vRelayExpiration GUARDED_BY (cs_main);
470+ std::deque<std::pair<std::chrono::microseconds , MapRelay::iterator>> g_relay_expiration GUARDED_BY (cs_main);
471471
472472 /* *
473473 * When a peer sends us a valid block, instruct it to announce blocks to us
@@ -4763,20 +4763,20 @@ bool PeerManagerImpl::SendMessages(CNode* pto)
47634763 nRelayedTransactions++;
47644764 {
47654765 // Expire old relay messages
4766- while (!vRelayExpiration .empty () && vRelayExpiration .front ().first < count_microseconds ( current_time) )
4766+ while (!g_relay_expiration .empty () && g_relay_expiration .front ().first < current_time)
47674767 {
4768- mapRelay.erase (vRelayExpiration .front ().second );
4769- vRelayExpiration .pop_front ();
4768+ mapRelay.erase (g_relay_expiration .front ().second );
4769+ g_relay_expiration .pop_front ();
47704770 }
47714771
47724772 auto ret = mapRelay.emplace (txid, std::move (txinfo.tx ));
47734773 if (ret.second ) {
4774- vRelayExpiration .emplace_back (count_microseconds ( current_time + std::chrono::microseconds{ RELAY_TX_CACHE_TIME}) , ret.first );
4774+ g_relay_expiration .emplace_back (current_time + RELAY_TX_CACHE_TIME, ret.first );
47754775 }
47764776 // Add wtxid-based lookup into mapRelay as well, so that peers can request by wtxid
47774777 auto ret2 = mapRelay.emplace (wtxid, ret.first ->second );
47784778 if (ret2.second ) {
4779- vRelayExpiration .emplace_back (count_microseconds ( current_time + std::chrono::microseconds{ RELAY_TX_CACHE_TIME}) , ret2.first );
4779+ g_relay_expiration .emplace_back (current_time + RELAY_TX_CACHE_TIME, ret2.first );
47804780 }
47814781 }
47824782 if (vInv.size () == MAX_INV_SZ) {
0 commit comments