mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-03-04 13:55:23 -05:00
p2p: Don't use timestamps from inbound peers
This makes it harder for others to tamper with our adjusted time.
This commit is contained in:
parent
a574f4ad39
commit
0c85dc30e6
1 changed files with 5 additions and 1 deletions
|
@ -2683,7 +2683,11 @@ void PeerManagerImpl::ProcessMessage(CNode& pfrom, const std::string& msg_type,
|
||||||
|
|
||||||
int64_t nTimeOffset = nTime - GetTime();
|
int64_t nTimeOffset = nTime - GetTime();
|
||||||
pfrom.nTimeOffset = nTimeOffset;
|
pfrom.nTimeOffset = nTimeOffset;
|
||||||
|
if (!pfrom.IsInboundConn()) {
|
||||||
|
// Don't use timedata samples from inbound peers to make it
|
||||||
|
// harder for others to tamper with our adjusted time.
|
||||||
AddTimeData(pfrom.addr, nTimeOffset);
|
AddTimeData(pfrom.addr, nTimeOffset);
|
||||||
|
}
|
||||||
|
|
||||||
// If the peer is old enough to have the old alert system, send it the final alert.
|
// If the peer is old enough to have the old alert system, send it the final alert.
|
||||||
if (greatest_common_version <= 70012) {
|
if (greatest_common_version <= 70012) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue