Skip to content

Commit f021897

Browse files
random-zebrafurszy
authored andcommitted
Fix CDiskBlockIndex serialization of dummy fields for old DB versions
1 parent 1ee0cb2 commit f021897

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

src/chain.h

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ class CDiskBlockIndex : public CBlockIndex
310310
// Serialization with CLIENT_VERSION = 4009901
311311
std::map<libzerocoin::CoinDenomination, int64_t> mapZerocoinSupply;
312312
int64_t nMoneySupply = 0;
313-
SER_READ(obj, nMoneySupply);
313+
READWRITE(nMoneySupply);
314314
READWRITE(obj.nFlags);
315315
READWRITE(obj.nVersion);
316316
READWRITE(obj.vStakeModifier);
@@ -320,35 +320,35 @@ class CDiskBlockIndex : public CBlockIndex
320320
READWRITE(obj.nBits);
321321
READWRITE(obj.nNonce);
322322
if (obj.nVersion > 3) {
323-
SER_READ(obj, mapZerocoinSupply);
323+
READWRITE(mapZerocoinSupply);
324324
if (obj.nVersion < 7) READWRITE(obj.nAccumulatorCheckpoint);
325325
}
326326
} else if (ser_action.ForRead()) {
327327
// Serialization with CLIENT_VERSION = 4009900-
328328
int64_t nMint = 0;
329329
uint256 hashNext{};
330330
int64_t nMoneySupply = 0;
331-
SER_READ(obj, nMint);
332-
SER_READ(obj, nMoneySupply);
331+
READWRITE(nMint);
332+
READWRITE(nMoneySupply);
333333
READWRITE(obj.nFlags);
334334
if (!Params().GetConsensus().NetworkUpgradeActive(obj.nHeight, Consensus::UPGRADE_V3_4)) {
335335
uint64_t nStakeModifier = 0;
336336
READWRITE(nStakeModifier);
337337
SER_READ(obj, obj.SetStakeModifier(nStakeModifier, obj.GeneratedStakeModifier()));
338338
} else {
339339
uint256 nStakeModifierV2;
340-
SER_READ(obj, nStakeModifierV2);
340+
READWRITE(nStakeModifierV2);
341341
SER_READ(obj, obj.SetStakeModifier(nStakeModifierV2));
342342
}
343343
if (obj.IsProofOfStake()) {
344344
COutPoint prevoutStake;
345345
unsigned int nStakeTime = 0;
346-
SER_READ(obj, prevoutStake);
347-
SER_READ(obj, nStakeTime);
346+
READWRITE(prevoutStake);
347+
READWRITE(nStakeTime);
348348
}
349349
READWRITE(obj.nVersion);
350350
READWRITE(obj.hashPrev);
351-
SER_READ(obj, hashNext);
351+
READWRITE(hashNext);
352352
READWRITE(obj.hashMerkleRoot);
353353
READWRITE(obj.nTime);
354354
READWRITE(obj.nBits);
@@ -357,8 +357,8 @@ class CDiskBlockIndex : public CBlockIndex
357357
std::map<libzerocoin::CoinDenomination, int64_t> mapZerocoinSupply;
358358
std::vector<libzerocoin::CoinDenomination> vMintDenominationsInBlock;
359359
READWRITE(obj.nAccumulatorCheckpoint);
360-
SER_READ(obj, mapZerocoinSupply);
361-
SER_READ(obj, vMintDenominationsInBlock);
360+
READWRITE(mapZerocoinSupply);
361+
READWRITE(vMintDenominationsInBlock);
362362
}
363363
}
364364
}

0 commit comments

Comments
 (0)