Replaces assert() calls with if() statements returning functional
failure that can be handled for situations that can be triggered
from outside of compiled code - i.e. peers.
Cherry-picked from: 149be06d
Github Pull Request: #3661
- Implements getmocktime instead of time.sleep to prevent races
- Enforce success of all mocktime operations
- Do not increment mocktime with 0 seconds
- Use fresh incoming peers for each test
- Explicitly do test teardown
- Remove TXID_RELAY_DELAY as this no longer exists in the dogecoind
implementation
- Add the inflight throttling test to replace the removed inflight
limit test
- Add an expiry fallback test
Cherry-picked from: a5a4e4b6
Github Pull Request: #3577
Maintaining up to 100000 INVs per peer is excessive. A Dogecoin
Core node will never send more than 7 invs per second.
Original Author: Pieter Wuille <pieter@wuille.net>
Cherry-picked from: 8eb52142
Github Pull Request: #3577
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 after. 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).
Original Author: Pieter Wuille <pieter@wuille.net>
Cherry-picked from: 3a700cde
Github Pull Request: #3577
This adds a new module that defines TxRequestTracker, a data
structure that maintains all information about transaction
requests, and coordinates requests.
Original Author: Pieter Wuille <pieter@wuille.net>
Cherry-picked from: 4bc80997
Github Pull Request: #3577
Conflicts:
- Use the 1.14-specific OpenSSL based random context instead of
FRC in tests.
- Replace InsecureRand*() calls with their GetRand() equivalent
for > 31 bits and with insecure_rand() for < 31 bits in tests.
Currently difficulty adjustment violations are not reported for
chains that branch off before the last checkpoint. Change this
by moving the checkpoint check after the difficulty check.
Original Author: Pieter Wuille <pieter.wuille@gmail.com>
Cherry-picked from: 215fc33d
Github Pull Request: #3576
This makes orphan processing work like handling getdata messages:
After every actual transaction validation attempt, interrupt
processing to deal with messages arriving from other peers.
Cherry-picked from: 9f2ab9ed
Github Pull Request: #3575
Reduces complexity in processing of orphans when receiving tx
messages over p2p. and isolate the functionality in its own
function ProcessOrphanTx
Original Author: Pieter Wuille <pieter.wuille@gmail.com>
Cherry-picked from: 0e4df473
Github Pull Request: #3575
Headers-first is the primary method of announcement on the network.
If a node fell back sending blocks by inv, it's probably for a
re-org. The final block hash provided should be the highest, so
send a getheaders and then fetch the blocks we need to catch up.
Original Author: John Newbery <john@johnnewbery.com>
Cherry-picked from: 3e64e6f2
Github Pull Request: #3568
2.5.0 version of expat has a vulnerability in it and it is
recommended to use 2.6.2 as seen in the file names on the
download page.
Cherry-picked from: 7f089c62
Github Pull Request: #3481
This will allow compiling with the c++17 standard, which on some
distributions (macOS, FreeBSD) is required when using system
dependencies.
The ./configure script will now allow specifying --enable-c++17 to
enable c++17. The default remains c++11, and c++14 also remains
available.
Cherry-picked from: 4196748d
Github Pull Request: #3561
random_shuffle is deprecated since c++11 and removed in c++17. Use
the shuffle function instead, now that we have a standardized
interface available on FastRandomContext.
This enables c++17 compilation
Cherry-picked from: caa79bd1
Github Pull Request: #3560
Conflicts resolved:
- use the 1.14-specific OpenSSL context instead of FRC in:
src/net_processing.cpp
src/wallet/wallet.cpp
Expose the well-tested but slower OpenSSL based legacy random
functions using the c++ standard RNG interface, to avoid
introducing unfinished and potentially unstable randomizer code
from 1.15.0-dev, while enabling the use of std::shuffle.
Replaces Github Pull Request: #3521
This will allow testing the codebase against newer standards and
increase compatibility with newer dependencies.
Cherry-picked from: b99be149
Github Pull Request: #3458
Removes boost dependencies in sync.cpp in favor of standard c++
for-loops, improving readability.
Cherry-picked from: a9129315
Github Pull Request: #3313
Removes undefined behavior by refactoring the way we destruct
objects that track mutexes when debugging.
1. Prevent UB from LockData custom destructor by making it implicit
2. Replace the thread_specific_ptr holding the lock stack with a
static map that stores it per thread.
Also cleans up the aliasing to make the code better readable.
Co-authored-by: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com>
Co-authored-by: Wladimir J. van der Laan <laanwj@protonmail.com>
Cherry-picked from: 06e40407
Github Pull Request: #3313
In boost 1.74.0, boost::filesystem adapted path::copy_option enum
to be the same as the enum in the fs::path from c++17, which is
now called copy_options, and its member "overwrite_if_exists"
is now called "overwrite_existing". In boost 1.85, the deprecated
copy_option enum is fully removed.
Because Dogecoin Core currently supports boost 1.60 and up,
conditionally implement the new enum based on the boost version
that is built against.
Cherry-picked from: 95554c3e
Github Pull Request: #3558
Conflicts resolved:
- boost fs prefix added in src/wallet/wallet.cpp