From dc2938e9799d79696d1db2438ef33d90542d984b Mon Sep 17 00:00:00 2001 From: Fabian Jahr Date: Thu, 14 Mar 2024 22:14:44 +0100 Subject: [PATCH] chainparams: Change nChainTx to uint64_t Also update types of assumeutxo chainparams and some related local variables for consistency. Co-authored-by: russeree --- src/chain.h | 3 +-- src/kernel/chainparams.h | 4 ++-- src/validation.cpp | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/chain.h b/src/chain.h index e8a8c066c8e..101162f07ca 100644 --- a/src/chain.h +++ b/src/chain.h @@ -173,8 +173,7 @@ public: //! This value will be non-zero if this block and all previous blocks back //! to the genesis block or an assumeutxo snapshot block have reached the //! VALID_TRANSACTIONS level. - //! Change to 64-bit type before 2024 (assuming worst case of 60 byte transactions). - unsigned int nChainTx{0}; + uint64_t nChainTx{0}; //! Verification status of this block. See enum BlockStatus //! diff --git a/src/kernel/chainparams.h b/src/kernel/chainparams.h index 5d45a1fa9c0..9cf7fa87f3c 100644 --- a/src/kernel/chainparams.h +++ b/src/kernel/chainparams.h @@ -54,7 +54,7 @@ struct AssumeutxoData { //! //! We need to hardcode the value here because this is computed cumulatively using block data, //! which we do not necessarily have at the time of snapshot load. - unsigned int nChainTx; + uint64_t nChainTx; //! The hash of the base block for this snapshot. Used to refer to assumeutxo data //! prior to having a loaded blockindex. @@ -69,7 +69,7 @@ struct AssumeutxoData { */ struct ChainTxData { int64_t nTime; //!< UNIX timestamp of last known number of transactions - int64_t nTxCount; //!< total number of transactions between genesis and that timestamp + uint64_t nTxCount; //!< total number of transactions between genesis and that timestamp double dTxRate; //!< estimated number of transactions per second after that timestamp }; diff --git a/src/validation.cpp b/src/validation.cpp index d6b3924cda0..fb0e22eaace 100644 --- a/src/validation.cpp +++ b/src/validation.cpp @@ -2956,7 +2956,7 @@ static void UpdateTipLog( LogPrintf("%s%s: new best=%s height=%d version=0x%08x log2_work=%f tx=%lu date='%s' progress=%f cache=%.1fMiB(%utxo)%s\n", prefix, func_name, tip->GetBlockHash().ToString(), tip->nHeight, tip->nVersion, - log(tip->nChainWork.getdouble()) / log(2.0), (unsigned long)tip->nChainTx, + log(tip->nChainWork.getdouble()) / log(2.0), tip->nChainTx, FormatISO8601DateTime(tip->GetBlockTime()), GuessVerificationProgress(params.TxData(), tip), coins_tip.DynamicMemoryUsage() * (1.0 / (1 << 20)),