Skip to content

Commit fa243e9

Browse files
author
MarcoFalke
committed
Remove no-op TIME_INIT on deser
Assigning TIME_INIT to nTime was needed to fully re-initialize a dirty object where the deserialization might skip nTime. See https://github.com/bitcoin/bitcoin/pull/19020/files#r427620111 Now that the without-nTime logic is removed in commit dbcb574 and commit e08770b, the logic here can be removed as well. Also, remove confusing and redundant preprocessor code. Also, remove no longer needed version.h include, which was needed for INIT_PROTO_VERSION.
1 parent 8779adb commit fa243e9

File tree

2 files changed

+2
-7
lines changed

2 files changed

+2
-7
lines changed

src/bitcoin-util.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#include <streams.h>
1616
#include <util/system.h>
1717
#include <util/translation.h>
18+
#include <version.h>
1819

1920
#include <atomic>
2021
#include <cstdio>

src/protocol.h

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,6 @@
33
// Distributed under the MIT software license, see the accompanying
44
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
55

6-
#ifndef __cplusplus
7-
#error This header can only be compiled as C++.
8-
#endif
9-
106
#ifndef BITCOIN_PROTOCOL_H
117
#define BITCOIN_PROTOCOL_H
128

@@ -15,10 +11,9 @@
1511
#include <serialize.h>
1612
#include <streams.h>
1713
#include <uint256.h>
18-
#include <version.h>
1914

15+
#include <cstdint>
2016
#include <limits>
21-
#include <stdint.h>
2217
#include <string>
2318

2419
/** Message header.
@@ -420,7 +415,6 @@ class CAddress : public CService
420415
use_v2 = s.GetVersion() & ADDRV2_FORMAT;
421416
}
422417

423-
SER_READ(obj, obj.nTime = TIME_INIT);
424418
READWRITE(obj.nTime);
425419
// nServices is serialized as CompactSize in V2; as uint64_t in V1.
426420
if (use_v2) {

0 commit comments

Comments
 (0)