Skip to content

Commit 56b454a

Browse files
committed
[Chain] remove CBlockIndex::mapZerocoinSupply and bump client version
1 parent 9c95c29 commit 56b454a

File tree

5 files changed

+13
-18
lines changed

5 files changed

+13
-18
lines changed

configure.ac

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ AC_PREREQ([2.60])
33
define(_CLIENT_VERSION_MAJOR, 4)
44
define(_CLIENT_VERSION_MINOR, 0)
55
define(_CLIENT_VERSION_REVISION, 99)
6-
define(_CLIENT_VERSION_BUILD, 1)
6+
define(_CLIENT_VERSION_BUILD, 2)
77
define(_CLIENT_VERSION_RC, 0)
88
define(_CLIENT_VERSION_IS_RELEASE, false)
99
define(_COPYRIGHT_YEAR, 2020)

src/chain.cpp

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -71,21 +71,12 @@ CBlockIndex::CBlockIndex(const CBlock& block):
7171
nBits{block.nBits},
7272
nNonce{block.nNonce}
7373
{
74-
ClearMapZcSupply();
7574
if(block.nVersion > 3 && block.nVersion < 7)
7675
nAccumulatorCheckpoint = block.nAccumulatorCheckpoint;
7776
if (block.IsProofOfStake())
7877
SetProofOfStake();
7978
}
8079

81-
void CBlockIndex::ClearMapZcSupply()
82-
{
83-
mapZerocoinSupply.clear();
84-
// Start supply of each denomination with 0s
85-
for (auto& denom : libzerocoin::zerocoinDenomList)
86-
mapZerocoinSupply.insert(std::make_pair(denom, 0));
87-
}
88-
8980
std::string CBlockIndex::ToString() const
9081
{
9182
return strprintf("CBlockIndex(pprev=%p, nHeight=%d, merkle=%s, hashBlock=%s)",

src/chain.h

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -229,12 +229,8 @@ class CBlockIndex
229229
//! (memory only) Sequential id assigned to distinguish order in which blocks are received.
230230
uint32_t nSequenceId{0};
231231

232-
//! zerocoin specific fields
233-
std::map<libzerocoin::CoinDenomination, int64_t> mapZerocoinSupply;
234-
235-
CBlockIndex() { ClearMapZcSupply(); }
232+
CBlockIndex() {}
236233
CBlockIndex(const CBlock& block);
237-
void ClearMapZcSupply();
238234

239235
std::string ToString() const;
240236

@@ -279,6 +275,7 @@ class CBlockIndex
279275

280276
// New serialization introduced with 4.0.99
281277
static const int DBI_OLD_SER_VERSION = 4009900;
278+
static const int DBI_SER_VERSION_NO_ZC = 4009902; // removes mapZerocoinSupply
282279

283280
class CDiskBlockIndex : public CBlockIndex
284281
{
@@ -325,7 +322,11 @@ class CDiskBlockIndex : public CBlockIndex
325322
READWRITE(nBits);
326323
READWRITE(nNonce);
327324
if(this->nVersion > 3) {
328-
READWRITE(mapZerocoinSupply);
325+
// zc supply removed in 4.0.99.2
326+
if (nSerVersion < DBI_SER_VERSION_NO_ZC) {
327+
std::map<libzerocoin::CoinDenomination, int64_t> mapZerocoinSupply;
328+
READWRITE(mapZerocoinSupply);
329+
}
329330
if(this->nVersion < 7) READWRITE(nAccumulatorCheckpoint);
330331
}
331332

@@ -359,6 +360,7 @@ class CDiskBlockIndex : public CBlockIndex
359360
READWRITE(nBits);
360361
READWRITE(nNonce);
361362
if(this->nVersion > 3) {
363+
std::map<libzerocoin::CoinDenomination, int64_t> mapZerocoinSupply;
362364
std::vector<libzerocoin::CoinDenomination> vMintDenominationsInBlock;
363365
READWRITE(nAccumulatorCheckpoint);
364366
READWRITE(mapZerocoinSupply);

src/rpc/misc.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,10 @@ UniValue getinfo(const UniValue& params, bool fHelp)
147147
obj.push_back(Pair("moneysupply",ValueFromAmount(chainActive.Tip()->nMoneySupply)));
148148
UniValue zpivObj(UniValue::VOBJ);
149149
for (auto denom : libzerocoin::zerocoinDenomList) {
150-
zpivObj.push_back(Pair(std::to_string(denom), ValueFromAmount(mapZerocoinSupply.at(denom) * (denom*COIN))));
150+
if (mapZerocoinSupply.empty())
151+
zpivObj.push_back(Pair(std::to_string(denom), ValueFromAmount(0)));
152+
else
153+
zpivObj.push_back(Pair(std::to_string(denom), ValueFromAmount(mapZerocoinSupply.at(denom) * (denom*COIN))));
151154
}
152155
zpivObj.push_back(Pair("total", ValueFromAmount(GetZerocoinSupply())));
153156
obj.push_back(Pair("zPIVsupply", zpivObj));

src/txdb.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,6 @@ bool CBlockTreeDB::LoadBlockIndexGuts()
246246

247247
//zerocoin
248248
pindexNew->nAccumulatorCheckpoint = diskindex.nAccumulatorCheckpoint;
249-
pindexNew->mapZerocoinSupply = diskindex.mapZerocoinSupply;
250249

251250
//Proof Of Stake
252251
pindexNew->nMoneySupply = diskindex.nMoneySupply;

0 commit comments

Comments
 (0)