Commit graph

15 commits

Author SHA1 Message Date
Pieter Wuille de11b0a4ef Reduce MAX_PEER_TX_ANNOUNCEMENTS for non-PF_RELAY peers
Maintaining up to 100000 INVs per peer is excessive, as that is far more
than fits in a typical mempool.

Also disable the "overload" penalty for PF_RELAY peers.
2020-10-12 12:14:53 -07:00
Pieter Wuille 242d16477d Change transaction request logic to use txrequest
This removes most transaction request logic from net_processing, and
replaces it with calls to a global TxRequestTracker object.

The major changes are:

* Announcements from outbound (and whitelisted) peers are now always
  preferred over those from inbound peers. This used to be the case for the
  first request (by delaying the first request from inbound peers), and
  a bias afters. The 2s delay for requests from inbound peers still exists,
  but after that, if viable outbound peers remain for any given transaction,
  they will always be tried first.

* No more hard cap of 100 in flight transactions per peer, as there is less
  need for it (memory usage is linear in the number of announcements, but
  independent from the number in flight, and CPU usage isn't affected by it).
  Furthermore, if only one peer announces a transaction, and it has over 100
  in flight and requestable already, we still want to request it from them.
  The cap is replaced with an additional 2s delay (possibly combined with the
  existing 2s delays for inbound connections, and for txid peers when wtxid
  peers are available).

Includes functional tests written by Marco Falke and Antoine Riard.
2020-10-12 12:14:11 -07:00
Pieter Wuille ec3916f40a Use mockable time everywhere in net_processing 2020-10-08 01:04:29 -07:00
Seleme Topuz 1343c86c7c test: Update wait_until usage in tests not to use the one from utils
Replace "wait_until()" usage from utils, with the ones from BitcoinTestFramework and P2PInterface.
closes #19080
2020-08-26 18:01:59 +02:00
John Newbery 85165d4332 scripted-diff: Rename mininode to p2p
-BEGIN VERIFY SCRIPT-
sed -i 's/\.mininode/\.p2p/g' $(git grep -l "mininode")
git mv test/functional/test_framework/mininode.py test/functional/test_framework/p2p.py
-END VERIFY SCRIPT-
2020-08-21 15:52:20 +01:00
John Newbery 9e2897d020 scripted-diff: Rename mininode_lock to p2p_lock
-BEGIN VERIFY SCRIPT-
sed -i 's/mininode_lock/p2p_lock/g' $(git grep -l "mininode_lock")
-END VERIFY SCRIPT-
2020-08-21 15:52:13 +01:00
Sebastian Falbesoner dac7a111bd refactor: test: use _ variable for unused loop counters
substitutes "for x in range(N):" by "for _ in range(N):"
indicates to the reader that a block is just repeated N times, and
that the loop counter is not used in the body
2020-08-06 18:39:33 +02:00
Fabian Jahr cacd85209e test: Use wtxid relay generally in functional tests 2020-07-19 02:10:42 -04:00
Suhas Daftuar 97141ca442 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.
2020-07-19 02:10:42 -04:00
Sebastian Falbesoner eeaaa58d2c test: replace inv type magic numbers by constants 2020-05-07 14:34:55 +02:00
MarcoFalke fa488f131f
scripted-diff: Bump copyright headers
-BEGIN VERIFY SCRIPT-
./contrib/devtools/copyright_header.py update ./
-END VERIFY SCRIPT-
2020-04-16 13:33:09 -04:00
MarcoFalke fa4c29bc1d
test: Add various low-level p2p tests 2020-04-13 21:38:29 -04:00
Jon Atack 6112a20982
test: replace (send_message + sync_with_ping) with send_and_ping 2020-04-01 17:30:02 +02:00
MarcoFalke faaee1e39a
test: Use connect_nodes when connecting nodes in the test_framework 2019-09-17 13:08:17 -04:00
Suhas Daftuar fab3658356
[qa] Test that getdata requests work as expected
We should eventually request a transaction from all peers that announce
it (assuming we never receive it).

We should prefer requesting from outbound peers over inbound peers.

Enforce the max tx requests in flight, and the eventual expiry of those
requests.

Test author:    Suhas Daftuar <sdaftuar@gmail.com>
Adjusted by:    MarcoFalke
2019-06-19 12:50:14 -04:00