File tree Expand file tree Collapse file tree 2 files changed +21
-5
lines changed Expand file tree Collapse file tree 2 files changed +21
-5
lines changed Original file line number Diff line number Diff line change @@ -388,6 +388,14 @@ const CBlockIndex* LastCommonAncestor(const CBlockIndex* pa, const CBlockIndex*
388
388
/* * Used to marshal pointers into hashes for db storage. */
389
389
class CDiskBlockIndex : public CBlockIndex
390
390
{
391
+ /* * Historically CBlockLocator's version field has been written to disk
392
+ * streams as the client version, but the value has never been used.
393
+ *
394
+ * Hard-code to the highest client version ever written.
395
+ * SerParams can be used if the field requires any meaning in the future.
396
+ **/
397
+ static constexpr int DUMMY_VERSION = 259900 ;
398
+
391
399
public:
392
400
uint256 hashPrev;
393
401
@@ -404,8 +412,8 @@ class CDiskBlockIndex : public CBlockIndex
404
412
SERIALIZE_METHODS (CDiskBlockIndex, obj)
405
413
{
406
414
LOCK (::cs_main);
407
- int _nVersion = s. GetVersion () ;
408
- if (!(s. GetType () & SER_GETHASH)) READWRITE (VARINT_MODE (_nVersion, VarIntMode::NONNEGATIVE_SIGNED));
415
+ int _nVersion = DUMMY_VERSION ;
416
+ READWRITE (VARINT_MODE (_nVersion, VarIntMode::NONNEGATIVE_SIGNED));
409
417
410
418
READWRITE (VARINT_MODE (obj.nHeight , VarIntMode::NONNEGATIVE_SIGNED));
411
419
READWRITE (VARINT (obj.nStatus ));
Original file line number Diff line number Diff line change @@ -118,6 +118,15 @@ class CBlock : public CBlockHeader
118
118
*/
119
119
struct CBlockLocator
120
120
{
121
+ /* * Historically CBlockLocator's version field has been written to network
122
+ * streams as the negotiated protocol version and to disk streams as the
123
+ * client version, but the value has never been used.
124
+ *
125
+ * Hard-code to the highest protocol version ever written to a network stream.
126
+ * SerParams can be used if the field requires any meaning in the future,
127
+ **/
128
+ static constexpr int DUMMY_VERSION = 70016 ;
129
+
121
130
std::vector<uint256> vHave;
122
131
123
132
CBlockLocator () {}
@@ -126,9 +135,8 @@ struct CBlockLocator
126
135
127
136
SERIALIZE_METHODS (CBlockLocator, obj)
128
137
{
129
- int nVersion = s.GetVersion ();
130
- if (!(s.GetType () & SER_GETHASH))
131
- READWRITE (nVersion);
138
+ int nVersion = DUMMY_VERSION;
139
+ READWRITE (nVersion);
132
140
READWRITE (obj.vHave );
133
141
}
134
142
You can’t perform that action at this time.
0 commit comments