Skip to content

Commit

Permalink
chainparams: Change nChainTx to uint64_t
Browse files Browse the repository at this point in the history
Also update types of assumeutxo chainparams and some related local variables for
consistency.

Co-authored-by: russeree <[email protected]>
  • Loading branch information
fjahr and russeree committed Aug 4, 2024
1 parent 2aff9a3 commit dc2938e
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
3 changes: 1 addition & 2 deletions src/chain.h
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,7 @@ class CBlockIndex
//! 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
//!
Expand Down
4 changes: 2 additions & 2 deletions src/kernel/chainparams.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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
};

Expand Down
2 changes: 1 addition & 1 deletion src/validation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)),
Expand Down

0 comments on commit dc2938e

Please sign in to comment.