Skip to content

Commit

Permalink
func test: prevent disconnects when using mocktime
Browse files Browse the repository at this point in the history
Thanks to pythcoiner for providing this fix.
  • Loading branch information
jp1ac4 committed Sep 5, 2024
1 parent b630d46 commit 341f940
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions tests/test_framework/bitcoind.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,12 @@ def __init__(self, bitcoin_dir, rpcport=None):
"rpcport": rpcport,
"fallbackfee": Decimal(1000) / COIN,
"rpcthreads": 32,
# bitcoind uses mocktime in some tests, which can lead to peers (e.g. electrs)
# being disconnected. To prevent this, we set `peertimeout` greater than
# the max value being mocked.
# See https://github.com/bitcoin/bitcoin/blob/fa05ee0517d58b600f0ccad4c02c0734a23707d6/src/net.cpp#L1961.
# h/t pythcoiner :)
"peertimeout": 2 * 24 * 60 * 60, # 2 days
}
self.conf_file = os.path.join(bitcoin_dir, "bitcoin.conf")
with open(self.conf_file, "w") as f:
Expand Down

0 comments on commit 341f940

Please sign in to comment.