Page MenuHomePhabricator

p2p: Don't use timestamps from inbound peers
ClosedPublic

Authored by PiRK on Mar 16 2023, 16:46.

Details

Reviewers
Fabien
Group Reviewers
Restricted Project
Commits
rABC0eda354e8679: p2p: Don't use timestamps from inbound peers
Summary

This makes it harder for others to tamper with our adjusted time.

Rationale from the PR description:

With the extra feeler connections (every 2 minutes on average) and extra block-relay-only connections (every 5 minutes on average) there are also now plenty of opportunities to gather a meaningful number of timedata samples from outbound peers.

There are some measures in place to prevent abuse: the -maxtimeadjustment parameter with a default of 70 minutes, warnings in cases of large deviations, only using the first 200 samples (explanation), but I think that only using samples from outbound connections in the first place would be an additional safety measure that would make sense.

See also issue core#4521 for further context and links: There have been several discussions in the past about replacing or abolishing the existing timedata system.

The difference with the source material is caused by D6024. This changes previous behavior slightly: now the computed time offset is assigned to the node even if we are not going to use it to compute our adjusted time. This pfrom.nTimeOffset is only used for display purposes (RPC results, GUI).

This is a backport of core#23631

Depends on D13357

Test Plan

ninja all check-all

Event Timeline

PiRK requested review of this revision.Mar 16 2023, 16:46
PiRK planned changes to this revision.Mar 16 2023, 16:49

The exisiting test from D6024 will fail, as it uses in inbound connection.

Failed tests logs:

====== Bitcoin ABC functional tests: abc-version-message.py ======

------- Stdout: -------
2023-03-16T16:51:03.762000Z TestFramework (INFO): Initializing test directory /work/abc-ci-builds/build-without-wallet/test/tmp/test_runner_₿₵_  _20230316_164829/abc-version-message_152
2023-03-16T16:51:06.534000Z TestFramework (ERROR): Assertion failed
Traceback (most recent call last):
  File "/work/test/functional/test_framework/test_framework.py", line 137, in main
    self.run_test()
  File "/work/test/functional/abc-version-message.py", line 56, in run_test
    self.nodes[0].add_p2p_connection(
  File "/usr/lib/python3.9/contextlib.py", line 124, in __exit__
    next(self.gen)
  File "/work/test/functional/test_framework/test_node.py", line 559, in assert_debug_log
    self._raise_assertion_error(
  File "/work/test/functional/test_framework/test_node.py", line 218, in _raise_assertion_error
    raise AssertionError(self._node_msg(msg))
AssertionError: [node 0] Expected messages "['added time data']" does not partially match log:

 - 2023-03-16T16:51:04.489577Z [../../src/net.cpp:3467] [CNode] Added connection peer=2
 - 2023-03-16T16:51:04.489626Z [../../src/net.cpp:1386] [CreateNodeFromAcceptedSocket] connection from 127.0.0.1:48992 accepted
 - 2023-03-16T16:51:04.489693Z [../../src/net_processing.cpp:3522] [ProcessMessage] received: version (119 bytes) peer=2
 - 2023-03-16T16:51:04.489720Z [../../src/net.cpp:3487] [PushMessage] sending version (134 bytes) peer=2
 - 2023-03-16T16:51:04.489757Z [../../src/net_processing.cpp:1571] [PushNodeVersion] send version message: version 70016, blocks=200, us=[::]:0, txrelay=1, peer=2
 - 2023-03-16T16:51:04.489767Z [../../src/net.cpp:3487] [PushMessage] sending verack (0 bytes) peer=2
 - 2023-03-16T16:51:04.489785Z [../../src/net.cpp:3487] [PushMessage] sending sendaddrv2 (0 bytes) peer=2
 - 2023-03-16T16:51:04.489808Z [../../src/net_processing.cpp:3748] [ProcessMessage] receive version message: [127.0.0.1:48992] /python-p2p-tester:0.0.3/: version 70014, blocks=-1, us=127.0.0.1:24794, txrelay=0, peer=2
 - 2023-03-16T16:51:04.490244Z [../../src/net_processing.cpp:3522] [ProcessMessage] received: verack (0 bytes) peer=2
 - 2023-03-16T16:51:04.490261Z [../../src/net.cpp:3487] [PushMessage] sending sendheaders (0 bytes) peer=2
 - 2023-03-16T16:51:04.490285Z [../../src/net.cpp:3487] [PushMessage] sending sendcmpct (9 bytes) peer=2
 - 2023-03-16T16:51:04.490381Z [../../src/net.cpp:3487] [PushMessage] sending avahello (98 bytes) peer=2
 - 2023-03-16T16:51:04.490406Z [../../src/net.cpp:3487] [PushMessage] sending ping (8 bytes) peer=2
 - 2023-03-16T16:51:04.490427Z [../../src/net_processing.cpp:6610] [SendMessages] initial getheaders (199) to peer=2 (startheight:-1)
 - 2023-03-16T16:51:04.490439Z [../../src/net.cpp:3487] [PushMessage] sending getheaders (645 bytes) peer=2
 - 2023-03-16T16:51:04.490466Z [../../src/net.cpp:3487] [PushMessage] sending feefilter (8 bytes) peer=2
 - 2023-03-16T16:51:04.490500Z [../../src/net_processing.cpp:3522] [ProcessMessage] received: getaddr (0 bytes) peer=2
 - 2023-03-16T16:51:04.491047Z [../../src/net_processing.cpp:3522] [ProcessMessage] received: pong (8 bytes) peer=2
 - 2023-03-16T16:51:04.540178Z [../../src/net_processing.cpp:3522] [ProcessMessage] received: ping (8 bytes) peer=2
 - 2023-03-16T16:51:04.540247Z [../../src/net.cpp:3487] [PushMessage] sending pong (8 bytes) peer=2
 - 2023-03-16T16:51:04.590673Z [../../src/httpserver.cpp:249] [http_request_cb] Received a POST request for / from 127.0.0.1:55226
 - 2023-03-16T16:51:04.617963Z [../../src/rpc/request.cpp:182] [parse] ThreadRPCServer method=getpeerinfo user=__cookie__


2023-03-16T16:51:06.585000Z TestFramework (INFO): Stopping nodes
2023-03-16T16:51:07.088000Z TestFramework (WARNING): Not cleaning up dir /work/abc-ci-builds/build-without-wallet/test/tmp/test_runner_₿₵_  _20230316_164829/abc-version-message_152
2023-03-16T16:51:07.088000Z TestFramework (ERROR): Test failed. Test logging available at /work/abc-ci-builds/build-without-wallet/test/tmp/test_runner_₿₵_  _20230316_164829/abc-version-message_152/test_framework.log
2023-03-16T16:51:07.089000Z TestFramework (ERROR): 
2023-03-16T16:51:07.089000Z TestFramework (ERROR): Hint: Call /work/test/functional/combine_logs.py '/work/abc-ci-builds/build-without-wallet/test/tmp/test_runner_₿₵_  _20230316_164829/abc-version-message_152' to consolidate all logs
2023-03-16T16:51:07.089000Z TestFramework (ERROR): 
2023-03-16T16:51:07.090000Z TestFramework (ERROR): If this failure happened unexpectedly or intermittently, please file a bug and provide a link or upload of the combined log.
2023-03-16T16:51:07.090000Z TestFramework (ERROR): https://github.com/Bitcoin-ABC/bitcoin-abc/issues
2023-03-16T16:51:07.090000Z TestFramework (ERROR):

Each failure log is accessible here:
Bitcoin ABC functional tests: abc-version-message.py

Failed tests logs:

====== Bitcoin ABC functional tests: abc-version-message.py ======

------- Stdout: -------
2023-03-16T16:58:07.374000Z TestFramework (INFO): Initializing test directory /work/abc-ci-builds/build-debug/test/tmp/test_runner_₿₵_  _20230316_165115/abc-version-message_152
2023-03-16T16:58:10.165000Z TestFramework (ERROR): Assertion failed
Traceback (most recent call last):
  File "/work/test/functional/test_framework/test_framework.py", line 137, in main
    self.run_test()
  File "/work/test/functional/abc-version-message.py", line 56, in run_test
    self.nodes[0].add_p2p_connection(
  File "/usr/lib/python3.9/contextlib.py", line 124, in __exit__
    next(self.gen)
  File "/work/test/functional/test_framework/test_node.py", line 559, in assert_debug_log
    self._raise_assertion_error(
  File "/work/test/functional/test_framework/test_node.py", line 218, in _raise_assertion_error
    raise AssertionError(self._node_msg(msg))
AssertionError: [node 0] Expected messages "['added time data']" does not partially match log:

 - 2023-03-16T16:58:08.155848Z [../../src/net.cpp:3467] [CNode] Added connection peer=2
 - 2023-03-16T16:58:08.155966Z [../../src/net.cpp:1386] [CreateNodeFromAcceptedSocket] connection from 127.0.0.1:57300 accepted
 - 2023-03-16T16:58:08.156293Z [../../src/net_processing.cpp:3522] [ProcessMessage] received: version (119 bytes) peer=2
 - 2023-03-16T16:58:08.156364Z [../../src/net.cpp:3487] [PushMessage] sending version (134 bytes) peer=2
 - 2023-03-16T16:58:08.156425Z [../../src/net_processing.cpp:1571] [PushNodeVersion] send version message: version 70016, blocks=200, us=[::]:0, txrelay=1, peer=2
 - 2023-03-16T16:58:08.156439Z [../../src/net.cpp:3487] [PushMessage] sending verack (0 bytes) peer=2
 - 2023-03-16T16:58:08.156477Z [../../src/net.cpp:3487] [PushMessage] sending sendaddrv2 (0 bytes) peer=2
 - 2023-03-16T16:58:08.156530Z [../../src/net_processing.cpp:3748] [ProcessMessage] receive version message: [127.0.0.1:57300] /python-p2p-tester:0.0.3/: version 70014, blocks=-1, us=127.0.0.1:24794, txrelay=0, peer=2
 - 2023-03-16T16:58:08.156959Z [../../src/net_processing.cpp:3522] [ProcessMessage] received: verack (0 bytes) peer=2
 - 2023-03-16T16:58:08.156977Z [../../src/net.cpp:3487] [PushMessage] sending sendheaders (0 bytes) peer=2
 - 2023-03-16T16:58:08.157017Z [../../src/net.cpp:3487] [PushMessage] sending sendcmpct (9 bytes) peer=2
 - 2023-03-16T16:58:08.157158Z [../../src/net.cpp:3487] [PushMessage] sending avahello (98 bytes) peer=2
 - 2023-03-16T16:58:08.157228Z [../../src/net.cpp:3487] [PushMessage] sending ping (8 bytes) peer=2
 - 2023-03-16T16:58:08.157285Z [../../src/net_processing.cpp:6610] [SendMessages] initial getheaders (199) to peer=2 (startheight:-1)
 - 2023-03-16T16:58:08.157319Z [../../src/net.cpp:3487] [PushMessage] sending getheaders (645 bytes) peer=2
 - 2023-03-16T16:58:08.157421Z [../../src/net.cpp:3487] [PushMessage] sending feefilter (8 bytes) peer=2
 - 2023-03-16T16:58:08.157779Z [../../src/net_processing.cpp:3522] [ProcessMessage] received: getaddr (0 bytes) peer=2
 - 2023-03-16T16:58:08.158062Z [../../src/net_processing.cpp:3522] [ProcessMessage] received: pong (8 bytes) peer=2
 - 2023-03-16T16:58:08.205506Z [../../src/net_processing.cpp:3522] [ProcessMessage] received: ping (8 bytes) peer=2
 - 2023-03-16T16:58:08.205537Z [../../src/net.cpp:3487] [PushMessage] sending pong (8 bytes) peer=2
 - 2023-03-16T16:58:08.255601Z [../../src/httpserver.cpp:249] [http_request_cb] Received a POST request for / from 127.0.0.1:56996
 - 2023-03-16T16:58:08.255698Z [../../src/rpc/request.cpp:182] [parse] ThreadRPCServer method=getpeerinfo user=__cookie__


2023-03-16T16:58:10.217000Z TestFramework (INFO): Stopping nodes
2023-03-16T16:58:10.368000Z TestFramework (WARNING): Not cleaning up dir /work/abc-ci-builds/build-debug/test/tmp/test_runner_₿₵_  _20230316_165115/abc-version-message_152
2023-03-16T16:58:10.368000Z TestFramework (ERROR): Test failed. Test logging available at /work/abc-ci-builds/build-debug/test/tmp/test_runner_₿₵_  _20230316_165115/abc-version-message_152/test_framework.log
2023-03-16T16:58:10.368000Z TestFramework (ERROR): 
2023-03-16T16:58:10.368000Z TestFramework (ERROR): Hint: Call /work/test/functional/combine_logs.py '/work/abc-ci-builds/build-debug/test/tmp/test_runner_₿₵_  _20230316_165115/abc-version-message_152' to consolidate all logs
2023-03-16T16:58:10.368000Z TestFramework (ERROR): 
2023-03-16T16:58:10.368000Z TestFramework (ERROR): If this failure happened unexpectedly or intermittently, please file a bug and provide a link or upload of the combined log.
2023-03-16T16:58:10.368000Z TestFramework (ERROR): https://github.com/Bitcoin-ABC/bitcoin-abc/issues
2023-03-16T16:58:10.368000Z TestFramework (ERROR):

Each failure log is accessible here:
Bitcoin ABC functional tests: abc-version-message.py

Failed tests logs:

====== Bitcoin ABC functional tests: abc-version-message.py ======

------- Stdout: -------
2023-03-16T16:55:40.277000Z TestFramework (INFO): Initializing test directory /work/abc-ci-builds/build-diff/test/tmp/test_runner_₿₵_  _20230316_165109/abc-version-message_152
2023-03-16T16:55:42.900000Z TestFramework (ERROR): Assertion failed
Traceback (most recent call last):
  File "/work/test/functional/test_framework/test_framework.py", line 137, in main
    self.run_test()
  File "/work/test/functional/abc-version-message.py", line 56, in run_test
    self.nodes[0].add_p2p_connection(
  File "/usr/lib/python3.9/contextlib.py", line 124, in __exit__
    next(self.gen)
  File "/work/test/functional/test_framework/test_node.py", line 559, in assert_debug_log
    self._raise_assertion_error(
  File "/work/test/functional/test_framework/test_node.py", line 218, in _raise_assertion_error
    raise AssertionError(self._node_msg(msg))
AssertionError: [node 0] Expected messages "['added time data']" does not partially match log:

 - 2023-03-16T16:55:40.877574Z [../../src/net.cpp:3467] [CNode] Added connection peer=2
 - 2023-03-16T16:55:40.877601Z [../../src/net.cpp:1386] [CreateNodeFromAcceptedSocket] connection from 127.0.0.1:34764 accepted
 - 2023-03-16T16:55:40.877767Z [../../src/net_processing.cpp:3522] [ProcessMessage] received: version (119 bytes) peer=2
 - 2023-03-16T16:55:40.877788Z [../../src/net.cpp:3487] [PushMessage] sending version (134 bytes) peer=2
 - 2023-03-16T16:55:40.877816Z [../../src/net_processing.cpp:1571] [PushNodeVersion] send version message: version 70016, blocks=200, us=[::]:0, txrelay=1, peer=2
 - 2023-03-16T16:55:40.877823Z [../../src/net.cpp:3487] [PushMessage] sending verack (0 bytes) peer=2
 - 2023-03-16T16:55:40.877835Z [../../src/net.cpp:3487] [PushMessage] sending sendaddrv2 (0 bytes) peer=2
 - 2023-03-16T16:55:40.877852Z [../../src/net_processing.cpp:3748] [ProcessMessage] receive version message: [127.0.0.1:34764] /python-p2p-tester:0.0.3/: version 70014, blocks=-1, us=127.0.0.1:24794, txrelay=0, peer=2
 - 2023-03-16T16:55:40.878211Z [../../src/net_processing.cpp:3522] [ProcessMessage] received: verack (0 bytes) peer=2
 - 2023-03-16T16:55:40.878236Z [../../src/net.cpp:3487] [PushMessage] sending sendheaders (0 bytes) peer=2
 - 2023-03-16T16:55:40.878254Z [../../src/net.cpp:3487] [PushMessage] sending sendcmpct (9 bytes) peer=2
 - 2023-03-16T16:55:40.878326Z [../../src/net.cpp:3487] [PushMessage] sending avahello (98 bytes) peer=2
 - 2023-03-16T16:55:40.878344Z [../../src/net.cpp:3487] [PushMessage] sending ping (8 bytes) peer=2
 - 2023-03-16T16:55:40.878360Z [../../src/net_processing.cpp:6610] [SendMessages] initial getheaders (199) to peer=2 (startheight:-1)
 - 2023-03-16T16:55:40.878369Z [../../src/net.cpp:3487] [PushMessage] sending getheaders (645 bytes) peer=2
 - 2023-03-16T16:55:40.878388Z [../../src/net.cpp:3487] [PushMessage] sending feefilter (8 bytes) peer=2
 - 2023-03-16T16:55:40.878415Z [../../src/net_processing.cpp:3522] [ProcessMessage] received: getaddr (0 bytes) peer=2
 - 2023-03-16T16:55:40.878855Z [../../src/net_processing.cpp:3522] [ProcessMessage] received: pong (8 bytes) peer=2
 - 2023-03-16T16:55:40.927696Z [../../src/net_processing.cpp:3522] [ProcessMessage] received: ping (8 bytes) peer=2
 - 2023-03-16T16:55:40.927718Z [../../src/net.cpp:3487] [PushMessage] sending pong (8 bytes) peer=2
 - 2023-03-16T16:55:40.977891Z [../../src/httpserver.cpp:249] [http_request_cb] Received a POST request for / from 127.0.0.1:59850
 - 2023-03-16T16:55:40.977969Z [../../src/rpc/request.cpp:182] [parse] ThreadRPCServer method=getpeerinfo user=__cookie__
 - 2023-03-16T16:55:42.446214Z [../../src/wallet/bdb.cpp:664] [PeriodicFlush] Flushing wallet.dat
 - 2023-03-16T16:55:42.644321Z [../../src/wallet/bdb.cpp:672] [PeriodicFlush] Flushed wallet.dat 198ms


2023-03-16T16:55:42.952000Z TestFramework (INFO): Stopping nodes
2023-03-16T16:55:43.303000Z TestFramework (WARNING): Not cleaning up dir /work/abc-ci-builds/build-diff/test/tmp/test_runner_₿₵_  _20230316_165109/abc-version-message_152
2023-03-16T16:55:43.303000Z TestFramework (ERROR): Test failed. Test logging available at /work/abc-ci-builds/build-diff/test/tmp/test_runner_₿₵_  _20230316_165109/abc-version-message_152/test_framework.log
2023-03-16T16:55:43.304000Z TestFramework (ERROR): 
2023-03-16T16:55:43.304000Z TestFramework (ERROR): Hint: Call /work/test/functional/combine_logs.py '/work/abc-ci-builds/build-diff/test/tmp/test_runner_₿₵_  _20230316_165109/abc-version-message_152' to consolidate all logs
2023-03-16T16:55:43.304000Z TestFramework (ERROR): 
2023-03-16T16:55:43.304000Z TestFramework (ERROR): If this failure happened unexpectedly or intermittently, please file a bug and provide a link or upload of the combined log.
2023-03-16T16:55:43.304000Z TestFramework (ERROR): https://github.com/Bitcoin-ABC/bitcoin-abc/issues
2023-03-16T16:55:43.304000Z TestFramework (ERROR):
====== Bitcoin ABC functional tests with the next upgrade activated: abc-version-message.py ======

------- Stdout: -------
2023-03-16T17:00:03.994000Z TestFramework (INFO): Initializing test directory /work/abc-ci-builds/build-diff/test/tmp/test_runner_₿₵_  _20230316_165600/abc-version-message_152
2023-03-16T17:00:06.513000Z TestFramework (ERROR): Assertion failed
Traceback (most recent call last):
  File "/work/test/functional/test_framework/test_framework.py", line 137, in main
    self.run_test()
  File "/work/test/functional/abc-version-message.py", line 56, in run_test
    self.nodes[0].add_p2p_connection(
  File "/usr/lib/python3.9/contextlib.py", line 124, in __exit__
    next(self.gen)
  File "/work/test/functional/test_framework/test_node.py", line 559, in assert_debug_log
    self._raise_assertion_error(
  File "/work/test/functional/test_framework/test_node.py", line 218, in _raise_assertion_error
    raise AssertionError(self._node_msg(msg))
AssertionError: [node 0] Expected messages "['added time data']" does not partially match log:

 - 2023-03-16T17:00:04.503073Z [../../src/net.cpp:3467] [CNode] Added connection peer=2
 - 2023-03-16T17:00:04.503267Z [../../src/net.cpp:1386] [CreateNodeFromAcceptedSocket] connection from 127.0.0.1:42428 accepted
 - 2023-03-16T17:00:04.503918Z [../../src/net_processing.cpp:3522] [ProcessMessage] received: version (119 bytes) peer=2
 - 2023-03-16T17:00:04.504025Z [../../src/net.cpp:3487] [PushMessage] sending version (134 bytes) peer=2
 - 2023-03-16T17:00:04.504187Z [../../src/net_processing.cpp:1571] [PushNodeVersion] send version message: version 70016, blocks=200, us=[::]:0, txrelay=1, peer=2
 - 2023-03-16T17:00:04.504247Z [../../src/net.cpp:3487] [PushMessage] sending verack (0 bytes) peer=2
 - 2023-03-16T17:00:04.504357Z [../../src/net.cpp:3487] [PushMessage] sending sendaddrv2 (0 bytes) peer=2
 - 2023-03-16T17:00:04.504498Z [../../src/net_processing.cpp:3748] [ProcessMessage] receive version message: [127.0.0.1:42428] /python-p2p-tester:0.0.3/: version 70014, blocks=-1, us=127.0.0.1:24794, txrelay=0, peer=2
 - 2023-03-16T17:00:04.505656Z [../../src/net_processing.cpp:3522] [ProcessMessage] received: verack (0 bytes) peer=2
 - 2023-03-16T17:00:04.505727Z [../../src/net.cpp:3487] [PushMessage] sending sendheaders (0 bytes) peer=2
 - 2023-03-16T17:00:04.505836Z [../../src/net.cpp:3487] [PushMessage] sending sendcmpct (9 bytes) peer=2
 - 2023-03-16T17:00:04.506421Z [../../src/net.cpp:3487] [PushMessage] sending avahello (98 bytes) peer=2
 - 2023-03-16T17:00:04.506612Z [../../src/net.cpp:3487] [PushMessage] sending ping (8 bytes) peer=2
 - 2023-03-16T17:00:04.506731Z [../../src/net_processing.cpp:6610] [SendMessages] initial getheaders (199) to peer=2 (startheight:-1)
 - 2023-03-16T17:00:04.506781Z [../../src/net.cpp:3487] [PushMessage] sending getheaders (645 bytes) peer=2
 - 2023-03-16T17:00:04.506899Z [../../src/net.cpp:3487] [PushMessage] sending feefilter (8 bytes) peer=2
 - 2023-03-16T17:00:04.507038Z [../../src/net_processing.cpp:3522] [ProcessMessage] received: getaddr (0 bytes) peer=2
 - 2023-03-16T17:00:04.508615Z [../../src/net_processing.cpp:3522] [ProcessMessage] received: pong (8 bytes) peer=2
 - 2023-03-16T17:00:04.551960Z [../../src/net_processing.cpp:3522] [ProcessMessage] received: ping (8 bytes) peer=2
 - 2023-03-16T17:00:04.551986Z [../../src/net.cpp:3487] [PushMessage] sending pong (8 bytes) peer=2
 - 2023-03-16T17:00:04.602101Z [../../src/httpserver.cpp:249] [http_request_cb] Received a POST request for / from 127.0.0.1:39296
 - 2023-03-16T17:00:04.602165Z [../../src/rpc/request.cpp:182] [parse] ThreadRPCServer method=getpeerinfo user=__cookie__
 - 2023-03-16T17:00:06.152877Z [../../src/wallet/bdb.cpp:664] [PeriodicFlush] Flushing wallet.dat
 - 2023-03-16T17:00:06.155560Z [../../src/wallet/bdb.cpp:672] [PeriodicFlush] Flushed wallet.dat 3ms


2023-03-16T17:00:06.564000Z TestFramework (INFO): Stopping nodes
2023-03-16T17:00:06.715000Z TestFramework (WARNING): Not cleaning up dir /work/abc-ci-builds/build-diff/test/tmp/test_runner_₿₵_  _20230316_165600/abc-version-message_152
2023-03-16T17:00:06.715000Z TestFramework (ERROR): Test failed. Test logging available at /work/abc-ci-builds/build-diff/test/tmp/test_runner_₿₵_  _20230316_165600/abc-version-message_152/test_framework.log
2023-03-16T17:00:06.715000Z TestFramework (ERROR): 
2023-03-16T17:00:06.715000Z TestFramework (ERROR): Hint: Call /work/test/functional/combine_logs.py '/work/abc-ci-builds/build-diff/test/tmp/test_runner_₿₵_  _20230316_165600/abc-version-message_152' to consolidate all logs
2023-03-16T17:00:06.716000Z TestFramework (ERROR): 
2023-03-16T17:00:06.716000Z TestFramework (ERROR): If this failure happened unexpectedly or intermittently, please file a bug and provide a link or upload of the combined log.
2023-03-16T17:00:06.716000Z TestFramework (ERROR): https://github.com/Bitcoin-ABC/bitcoin-abc/issues
2023-03-16T17:00:06.716000Z TestFramework (ERROR):

Each failure log is accessible here:
Bitcoin ABC functional tests: abc-version-message.py
Bitcoin ABC functional tests with the next upgrade activated: abc-version-message.py

rebase onto D13369, fix abc-version-message.py test

PiRK edited the summary of this revision. (Show Details)

Use a P2PInterface for testing the inbound connection, no need for a third node (small speedup of the test)

Fabien requested changes to this revision.Mar 17 2023, 09:28
Fabien added a subscriber: Fabien.
Fabien added inline comments.
src/net_processing.cpp
3760

move in the relevant branch

test/functional/abc-version-message.py
72

Why does this need to be here and not below, just before you connect node 1 ?

This revision now requires changes to proceed.Mar 17 2023, 09:28

move comments to relevant branch, set mocktime for node[1] next to connect_nodes, add a check that the timeoffset between node0 and node1 is exactly as expected (to ensure the mocktime was indeed used in the VERSION message)

Fabien added inline comments.
test/functional/abc_p2p_version_timestamp.py
82 ↗(On Diff #38662)

Oh I see, the mocktime is now set within the assertion context. My bad, previous version was correct, please revert

97 ↗(On Diff #38662)

You can also check that the node 0 timeoffset didn't change, but no blocker

This revision is now accepted and ready to land.Mar 17 2023, 10:06
test/functional/abc_p2p_version_timestamp.py
97 ↗(On Diff #38662)

I will not do it in this diff, as this requires changing the test some more. I think the current test does not actually affect node0's adjusted time, maybe because the delta is larger than DEFAULT_MAX_TIME_ADJUSTMENT, or maybe because some parts of the code don't use the mocktime as expected... To be investigated.

put mocktime back where it was

test/functional/abc_p2p_version_timestamp.py
97 ↗(On Diff #38662)

Actually it is because the time is not actually adjusted before there are 5 valid offsets added to the list.