File tree Expand file tree Collapse file tree 2 files changed +36
-0
lines changed
Expand file tree Collapse file tree 2 files changed +36
-0
lines changed Original file line number Diff line number Diff line change @@ -211,6 +211,7 @@ BITCOIN_CORE_H = \
211211 merkleblock.h \
212212 messagesigner.h \
213213 miner.h \
214+ moneysupply.h \
214215 net.h \
215216 net_processing.h \
216217 netaddress.h \
Original file line number Diff line number Diff line change 1+ // Copyright (c) 2020 The PIVX developers
2+ // Distributed under the MIT/X11 software license, see the accompanying
3+ // file COPYING or https://www.opensource.org/licenses/mit-license.php.
4+
5+ #ifndef PIVX_MONEYSUPPLY_H
6+ #define PIVX_MONEYSUPPLY_H
7+
8+ #include " amount.h"
9+ #include " sync.h"
10+
11+ /*
12+ * Class used to cache the sum of utxo's values
13+ */
14+ class CMoneySupply {
15+ private:
16+ mutable RecursiveMutex cs;
17+ CAmount nSupply;
18+ // height of the chain when the supply was last updated
19+ int64_t nHeight;
20+
21+ public:
22+ CMoneySupply (): nSupply(0 ), nHeight(0 ) {}
23+
24+ void Update (const CAmount& _nSupply, int _nHeight)
25+ {
26+ LOCK (cs);
27+ nSupply = _nSupply;
28+ nHeight = _nHeight;
29+ }
30+
31+ CAmount Get () const { LOCK (cs); return nSupply; }
32+ int64_t GetCacheHeight () const { LOCK (cs); return nHeight; }
33+ };
34+
35+ #endif // PIVX_MONEYSUPPLY_H
You can’t perform that action at this time.
0 commit comments