Bump version to 5.3.5 - fix out-of-sync display for PoS chains

Remove time-based sync check that showed "out of sync" when blocks
were >6 hours old. For PoS chains with few stakers, blocks can be
hours apart - that's idle, not out of sync. Now uses block count
only. Also adds periodic UI refresh every 30s and switches cached
stake weight from volatile to std::atomic.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-22 17:59:18 -07:00
parent a6ec711cfa
commit 6e9dbb1aa9
6 changed files with 21 additions and 12 deletions
+1 -1
View File
@@ -9,7 +9,7 @@ on:
workflow_dispatch:
env:
VERSION: "5.3.4"
VERSION: "5.3.5"
jobs:
build-windows-qt:
+1 -1
View File
@@ -8,7 +8,7 @@
// These need to be macros, as version.cpp's and triangles-qt.rc's voodoo requires it
#define CLIENT_VERSION_MAJOR 5
#define CLIENT_VERSION_MINOR 3
#define CLIENT_VERSION_REVISION 4
#define CLIENT_VERSION_REVISION 5
#define CLIENT_VERSION_BUILD 0
// Converts the parameter X to a string after macro replacement on X has been performed.
+11 -3
View File
@@ -70,12 +70,20 @@ void ClientModel::updateTimer()
int newNumBlocks = getNumBlocks();
int newNumBlocksOfPeers = getNumBlocksOfPeers();
// Always emit during IBD so the speed/ETA display stays live
if(cachedNumBlocks != newNumBlocks || cachedNumBlocksOfPeers != newNumBlocksOfPeers
|| newNumBlocks < newNumBlocksOfPeers)
// Always emit when values change or during IBD.
// Also emit every ~30 seconds even when idle so setNumBlocks() can
// re-evaluate sync status (e.g. when a new block arrives after a long gap).
static int64_t nLastEmit = 0;
int64_t nNow = GetTime();
bool fChanged = (cachedNumBlocks != newNumBlocks || cachedNumBlocksOfPeers != newNumBlocksOfPeers);
bool fCatchingUp = (newNumBlocks < newNumBlocksOfPeers);
bool fPeriodicRefresh = (nNow - nLastEmit >= 30);
if(fChanged || fCatchingUp || fPeriodicRefresh)
{
cachedNumBlocks = newNumBlocks;
cachedNumBlocksOfPeers = newNumBlocksOfPeers;
nLastEmit = nNow;
emit numBlocksChanged(newNumBlocks, newNumBlocksOfPeers);
}
+4 -3
View File
@@ -904,9 +904,10 @@ void TrianglesGUI::setNumBlocks(int count, int nTotalBlocks)
}
// Set icon state: spinning if catching up, tick otherwise.
// Use a generous threshold (6 hours) for PoS chains where block intervals
// can be long during difficulty adjustment with few stakers.
if(secs < 6*60*60 && count >= nTotalBlocks)
// For PoS chains with few stakers, blocks can be hours or days apart.
// Sync status is based purely on block count - NOT block timestamp.
// A stale chain (no recent blocks) is still "synced" if we have all blocks.
if(count >= nTotalBlocks)
{
tooltip = tr("Up to date") + QString(".<br>") + tooltip;
labelBlocksIcon->setPixmap(QIcon(":/icons/synced").pixmap(STATUSBAR_ICONSIZE, STATUSBAR_ICONSIZE));
+1 -1
View File
@@ -53,7 +53,7 @@ static const int MEMPOOL_GD_VERSION = 60002;
#define DISPLAY_VERSION_MAJOR 5
#define DISPLAY_VERSION_MINOR 3
#define DISPLAY_VERSION_REVISION 4
#define DISPLAY_VERSION_REVISION 5
#define DISPLAY_VERSION_BUILD 0
#endif
+3 -3
View File
@@ -7,6 +7,7 @@
#include <string>
#include <vector>
#include <atomic>
#include <stdlib.h>
@@ -204,9 +205,8 @@ public:
bool CreateCoinStake(const CKeyStore& keystore, unsigned int nBits, int64_t nSearchInterval, int64_t nFees, CTransaction& txNew, CKey& key);
// Cached staking info - updated by the staking thread, read by the UI thread.
// Access is safe without locks: written atomically by the miner, read by UI for display only.
volatile uint64_t nCachedStakeWeight;
volatile int64_t nCachedStakeWeightTime; // GetTime() when last updated
std::atomic<uint64_t> nCachedStakeWeight;
std::atomic<int64_t> nCachedStakeWeightTime; // GetTime() when last updated
std::string SendMoney(CScript scriptPubKey, int64_t nValue, std::string& sNarr, CWalletTx& wtxNew, bool fAskFee=false);
std::string SendMoneyToDestination(const CTxDestination& address, int64_t nValue, std::string& sNarr, CWalletTx& wtxNew, bool fAskFee=false);