Skip to content

Commit c098d47

Browse files
UdjinM6codablock
authored andcommitted
Check SERIALIZATION_VERSION_STRING before deserializing anything else
1 parent 89cb19d commit c098d47

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

src/governance/governance.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -340,6 +340,9 @@ class CGovernanceManager
340340
std::string strVersion;
341341
if (ser_action.ForRead()) {
342342
READWRITE(strVersion);
343+
if (strVersion != SERIALIZATION_VERSION_STRING) {
344+
return;
345+
}
343346
} else {
344347
strVersion = SERIALIZATION_VERSION_STRING;
345348
READWRITE(strVersion);
@@ -351,10 +354,6 @@ class CGovernanceManager
351354
READWRITE(mapObjects);
352355
READWRITE(mapLastMasternodeObject);
353356
READWRITE(lastMNListForVotingKeys);
354-
if (ser_action.ForRead() && (strVersion != SERIALIZATION_VERSION_STRING)) {
355-
Clear();
356-
return;
357-
}
358357
}
359358

360359
void UpdatedBlockTip(const CBlockIndex* pindex, CConnman& connman);

src/masternode/masternode-meta.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,9 @@ class CMasternodeMetaMan
101101
std::string strVersion;
102102
if(ser_action.ForRead()) {
103103
READWRITE(strVersion);
104+
if (strVersion != SERIALIZATION_VERSION_STRING) {
105+
return;
106+
}
104107
}
105108
else {
106109
strVersion = SERIALIZATION_VERSION_STRING;
@@ -122,10 +125,6 @@ class CMasternodeMetaMan
122125
}
123126

124127
READWRITE(nDsqCount);
125-
126-
if(ser_action.ForRead() && (strVersion != SERIALIZATION_VERSION_STRING)) {
127-
Clear();
128-
}
129128
}
130129

131130
public:

0 commit comments

Comments
 (0)