Skip to content

Commit

Permalink
Merge bitcoin/bitcoin#31383: test: Add missing node.setmocktime(self.…
Browse files Browse the repository at this point in the history
…mocktime) to p2p_ibd_stalling.py

faa16ed test: Add missing node.setmocktime(self.mocktime) to p2p_ibd_stalling.py (MarcoFalke)

Pull request description:

  This was forgotten by myself in commit fa5b58e.

  This time, there is a diff to test, which fails on current master and passes with this pull request.

  ```diff
  diff --git a/src/net_processing.cpp b/src/net_processing.cpp
  index e503a68382..16438ebd08 100644
  --- a/src/net_processing.cpp
  +++ b/src/net_processing.cpp
  @@ -112,9 +112,9 @@ static_assert(MAX_BLOCKTXN_DEPTH <= MIN_BLOCKS_TO_KEEP, "MAX_BLOCKTXN_DEPTH too
    *  want to make this a per-peer adaptive value at some point. */
   static const unsigned int BLOCK_DOWNLOAD_WINDOW = 1024;
   /** Block download timeout base, expressed in multiples of the block interval (i.e. 10 min) */
  -static constexpr double BLOCK_DOWNLOAD_TIMEOUT_BASE = 1;
  +static constexpr double BLOCK_DOWNLOAD_TIMEOUT_BASE = .05; // 30 sec
   /** Additional block download timeout per parallel downloading peer (i.e. 5 min) */
  -static constexpr double BLOCK_DOWNLOAD_TIMEOUT_PER_PEER = 0.5;
  +static constexpr double BLOCK_DOWNLOAD_TIMEOUT_PER_PEER = 0.;
   /** Maximum number of headers to announce when relaying blocks with headers message.*/
   static const unsigned int MAX_BLOCKS_TO_ANNOUNCE = 8;
   /** Minimum blocks required to signal NODE_NETWORK_LIMITED */
  diff --git a/test/functional/p2p_ibd_stalling.py b/test/functional/p2p_ibd_stalling.py
  index fa07873929..f8cdd8998c 100755
  --- a/test/functional/p2p_ibd_stalling.py
  +++ b/test/functional/p2p_ibd_stalling.py
  @@ -82,6 +82,7 @@ class P2PIBDStallingTest(BitcoinTestFramework):
           # Need to wait until 1023 blocks are received - the magic total bytes number is a workaround in lack of an rpc
           # returning the number of downloaded (but not connected) blocks.
           bytes_recv = 172761 if not self.options.v2transport else 169692
  +        time.sleep(31);
           self.wait_until(lambda: self.total_bytes_recv_for_blocks() == bytes_recv)

           self.all_sync_send_with_ping(peers)

ACKs for top commit:
  brunoerg:
    ACK faa16ed

Tree-SHA512: 5a670e2dcf828ac83b721a3e20d897744cca50080b0583a8460a0d0c7bf2c2c988cf7e35f688dde6a3349f1c21cc83a16ea5242ed06a59d59a04130416690737
  • Loading branch information
fanquake committed Dec 2, 2024
2 parents 6cd95de + faa16ed commit eb64611
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions test/functional/p2p_ibd_stalling.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ def run_test(self):

self.log.info("Check that a staller does not get disconnected if the 1024 block lookahead buffer is filled")
self.mocktime = int(time.time()) + 1
node.setmocktime(self.mocktime)
for id in range(NUM_PEERS):
peers.append(node.add_outbound_p2p_connection(P2PStaller(stall_block), p2p_idx=id, connection_type="outbound-full-relay"))
peers[-1].block_store = block_dict
Expand Down

0 comments on commit eb64611

Please sign in to comment.