@@ -32,10 +32,10 @@ using node::GetTransaction;
3232
3333namespace llmq {
3434namespace {
35- static constexpr int64_t CLEANUP_INTERVAL{1000 * 30 };
36- static constexpr int64_t CLEANUP_SEEN_TIMEOUT{24 * 60 * 60 * 1000 };
35+ static constexpr auto CLEANUP_INTERVAL{30s };
36+ static constexpr auto CLEANUP_SEEN_TIMEOUT{24h };
3737// ! How long to wait for islocks until we consider a block with non-islocked TXs to be safe to sign
38- static constexpr int64_t WAIT_FOR_ISLOCK_TIMEOUT{10 * 60 };
38+ static constexpr auto WAIT_FOR_ISLOCK_TIMEOUT{10min };
3939} // anonymous namespace
4040
4141bool AreChainLocksEnabled (const CSporkManager& sporkman)
@@ -133,7 +133,7 @@ MessageProcessingResult CChainLocksHandler::ProcessNewChainLock(const NodeId fro
133133
134134 {
135135 LOCK (cs);
136- if (!seenChainLocks.emplace (hash, TicksSinceEpoch <std::chrono::milliseconds>( SystemClock::now () )).second ) {
136+ if (!seenChainLocks.emplace (hash, GetTime <std::chrono::seconds>( )).second ) {
137137 return {};
138138 }
139139
@@ -305,16 +305,16 @@ int32_t CChainLocksHandler::GetBestChainLockHeight() const
305305
306306bool CChainLocksHandler::IsTxSafeForMining (const uint256& txid) const
307307{
308- int64_t txAge = 0 ;
308+ auto tx_age{0s} ;
309309 {
310310 LOCK (cs);
311311 auto it = txFirstSeenTime.find (txid);
312312 if (it != txFirstSeenTime.end ()) {
313- txAge = GetTime<std::chrono::seconds>(). count () - it->second ;
313+ tx_age = GetTime<std::chrono::seconds>() - it->second ;
314314 }
315315 }
316316
317- return txAge >= WAIT_FOR_ISLOCK_TIMEOUT;
317+ return tx_age >= WAIT_FOR_ISLOCK_TIMEOUT;
318318}
319319
320320// WARNING: cs_main and cs should not be held!
@@ -444,15 +444,15 @@ void CChainLocksHandler::Cleanup()
444444 return ;
445445 }
446446
447- if (TicksSinceEpoch <std::chrono::milliseconds>( SystemClock::now ()) - lastCleanupTime < CLEANUP_INTERVAL) {
447+ if (GetTime <std::chrono::seconds>() - lastCleanupTime. load () < CLEANUP_INTERVAL) {
448448 return ;
449449 }
450- lastCleanupTime = TicksSinceEpoch <std::chrono::milliseconds>( SystemClock::now () );
450+ lastCleanupTime = GetTime <std::chrono::seconds>( );
451451
452452 {
453453 LOCK (cs);
454454 for (auto it = seenChainLocks.begin (); it != seenChainLocks.end ();) {
455- if (TicksSinceEpoch <std::chrono::milliseconds>( SystemClock::now () ) - it->second >= CLEANUP_SEEN_TIMEOUT) {
455+ if (GetTime <std::chrono::seconds>( ) - it->second >= CLEANUP_SEEN_TIMEOUT) {
456456 it = seenChainLocks.erase (it);
457457 } else {
458458 ++it;
0 commit comments