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*
388388/* * Used to marshal pointers into hashes for db storage. */
389389class CDiskBlockIndex : public CBlockIndex
390390{
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+
391399public:
392400 uint256 hashPrev;
393401
@@ -404,8 +412,8 @@ class CDiskBlockIndex : public CBlockIndex
404412 SERIALIZE_METHODS (CDiskBlockIndex, obj)
405413 {
406414 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));
409417
410418 READWRITE (VARINT_MODE (obj.nHeight , VarIntMode::NONNEGATIVE_SIGNED));
411419 READWRITE (VARINT (obj.nStatus ));
Original file line number Diff line number Diff line change @@ -118,6 +118,15 @@ class CBlock : public CBlockHeader
118118 */
119119struct CBlockLocator
120120{
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+
121130 std::vector<uint256> vHave;
122131
123132 CBlockLocator () {}
@@ -126,9 +135,8 @@ struct CBlockLocator
126135
127136 SERIALIZE_METHODS (CBlockLocator, obj)
128137 {
129- int nVersion = s.GetVersion ();
130- if (!(s.GetType () & SER_GETHASH))
131- READWRITE (nVersion);
138+ int nVersion = DUMMY_VERSION;
139+ READWRITE (nVersion);
132140 READWRITE (obj.vHave );
133141 }
134142
You can’t perform that action at this time.
0 commit comments