aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorSuhas Daftuar <sdaftuar@gmail.com>2020-01-31 11:23:27 -0500
committerSuhas Daftuar <sdaftuar@gmail.com>2020-07-19 02:10:42 -0400
commit97141ca442daea8fc9c307cf81a02b38dcc28fd8 (patch)
tree7c481ea6bb603fca398a083b16a04c89da007f3f /test
parent46d78d47dea345329ba094310eec56ab00a02ddc (diff)
downloadbitcoin-97141ca442daea8fc9c307cf81a02b38dcc28fd8.tar.xz
Delay getdata requests from peers using txid-based relay
Using both txid and wtxid-based relay with peers means that we could sometimes download the same transaction twice, if announced via two different hashes from different peers. Use a heuristic of delaying txid-peer-getdata requests by 2 seconds, if we have at least one wtxid-based peer.
Diffstat (limited to 'test')
-rwxr-xr-xtest/functional/p2p_tx_download.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/test/functional/p2p_tx_download.py b/test/functional/p2p_tx_download.py
index 10f5eea0e5..cd64d57d49 100755
--- a/test/functional/p2p_tx_download.py
+++ b/test/functional/p2p_tx_download.py
@@ -44,12 +44,13 @@ class TestP2PConn(P2PInterface):
GETDATA_TX_INTERVAL = 60 # seconds
MAX_GETDATA_RANDOM_DELAY = 2 # seconds
INBOUND_PEER_TX_DELAY = 2 # seconds
+TXID_RELAY_DELAY = 2 # seconds
MAX_GETDATA_IN_FLIGHT = 100
TX_EXPIRY_INTERVAL = GETDATA_TX_INTERVAL * 10
# Python test constants
NUM_INBOUND = 10
-MAX_GETDATA_INBOUND_WAIT = GETDATA_TX_INTERVAL + MAX_GETDATA_RANDOM_DELAY + INBOUND_PEER_TX_DELAY
+MAX_GETDATA_INBOUND_WAIT = GETDATA_TX_INTERVAL + MAX_GETDATA_RANDOM_DELAY + INBOUND_PEER_TX_DELAY + TXID_RELAY_DELAY
class TxDownloadTest(BitcoinTestFramework):