mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-03-05 14:06:27 -05:00
coinstats: add coins_count
Also changes existing CCoinsStats attributes to be C++11 initialized.
This commit is contained in:
parent
707fde7b9b
commit
92fafb3a7d
2 changed files with 12 additions and 9 deletions
|
@ -38,6 +38,7 @@ static void ApplyStats(CCoinsStats &stats, CHashWriter& ss, const uint256& hash,
|
|||
//! Calculate statistics about the unspent transaction output set
|
||||
bool GetUTXOStats(CCoinsView *view, CCoinsStats &stats)
|
||||
{
|
||||
stats = CCoinsStats();
|
||||
std::unique_ptr<CCoinsViewCursor> pcursor(view->Cursor());
|
||||
assert(pcursor);
|
||||
|
||||
|
@ -61,6 +62,7 @@ bool GetUTXOStats(CCoinsView *view, CCoinsStats &stats)
|
|||
}
|
||||
prevkey = key.hash;
|
||||
outputs[key.n] = std::move(coin);
|
||||
stats.coins_count++;
|
||||
} else {
|
||||
return error("%s: unable to read value", __func__);
|
||||
}
|
||||
|
|
|
@ -15,16 +15,17 @@ class CCoinsView;
|
|||
|
||||
struct CCoinsStats
|
||||
{
|
||||
int nHeight;
|
||||
uint256 hashBlock;
|
||||
uint64_t nTransactions;
|
||||
uint64_t nTransactionOutputs;
|
||||
uint64_t nBogoSize;
|
||||
uint256 hashSerialized;
|
||||
uint64_t nDiskSize;
|
||||
CAmount nTotalAmount;
|
||||
int nHeight{0};
|
||||
uint256 hashBlock{};
|
||||
uint64_t nTransactions{0};
|
||||
uint64_t nTransactionOutputs{0};
|
||||
uint64_t nBogoSize{0};
|
||||
uint256 hashSerialized{};
|
||||
uint64_t nDiskSize{0};
|
||||
CAmount nTotalAmount{0};
|
||||
|
||||
CCoinsStats() : nHeight(0), nTransactions(0), nTransactionOutputs(0), nBogoSize(0), nDiskSize(0), nTotalAmount(0) {}
|
||||
//! The number of coins contained.
|
||||
uint64_t coins_count{0};
|
||||
};
|
||||
|
||||
//! Calculate statistics about the unspent transaction output set
|
||||
|
|
Loading…
Add table
Reference in a new issue