aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorSuhas Daftuar <sdaftuar@gmail.com>2020-01-31 11:23:27 -0500
committerJohn Newbery <john@johnnewbery.com>2020-09-24 13:24:10 +0100
commitc1d6a1003d601ec4ff7d9507563254b29868182f (patch)
tree38758f82f463db6d10b51831267752b363973688 /test
parent181ffadd162a84551b3518de77b5dcc08c712425 (diff)
downloadbitcoin-c1d6a1003d601ec4ff7d9507563254b29868182f.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 b56dc994e7..c0edeebcee 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):