Commit graph

28136 commits

Author SHA1 Message Date
Jon Atack
41f84d5ecc
Move peer eviction tests to a separate test file
out of net_tests, because the eviction tests:

- are a different domain of test coverage, with different dependencies

- run more slowly than the net tests

- will be growing in size, in this PR branch and in the future, as eviction
  test coverage is improved
2021-03-19 20:11:39 +01:00
Jon Atack
f126cbd6de
Extract ProtectEvictionCandidatesByRatio from SelectNodeToEvict
to allow deterministic unit testing of the ratio-based peer eviction protection
logic, which protects peers having longer connection times and those connected
via higher-latency networks.

Add documentation.
2021-03-19 20:11:29 +01:00
Wladimir J. van der Laan
a9d1b40d53
Merge #21415: refactor: remove Optional & nullopt
ebc4ab721b refactor: post Optional<> removal cleanups (fanquake)
57e980d13c scripted-diff: remove Optional & nullopt (fanquake)

Pull request description:

  Same rationale & motivation as #21404, which turned out to be quite low in the number of potential conflicts. Lets see what the bot has to say here.

ACKs for top commit:
  practicalswift:
    cr ACK ebc4ab721b: patch looks correct
  jnewbery:
    utACK ebc4ab721b
  laanwj:
    Code review ACK ebc4ab721b

Tree-SHA512: 550fbeef09b9d35ddefaa805d1755c18c8fd499c4b0f77ebfece8c20296a7abd1cf6c699e2261f92fe3552deeb7555ec2a2287ffe3ab9e98bb9f8612a4d43be3
2021-03-17 12:17:33 +01:00
fanquake
ebc4ab721b
refactor: post Optional<> removal cleanups 2021-03-17 14:56:20 +08:00
fanquake
993ecafa5e
Merge #21417: Misc external signer improvement and HWI 2 support
57ff5a42ab doc: specify minimum HWI version (Sjors Provoost)
03308b2bfa rpc: don't require wallet for enumeratesigners (Sjors Provoost)

Pull request description:

  HWI just released 2.0. See https://github.com/bitcoin-core/HWI/releases/tag/2.0.0

  As of #16546 we already rely on features that are in 2.0 and not in the previous 1.* releases:
  * `--chain` param

  This shouldn't be a problem, because HWI 2.0 has been released before we release v22.

  Misc improvements:
  * document that HWI 2.0 is required
  * drop wallet requirement for `enumeratesigners`

ACKs for top commit:
  achow101:
    Code Review ACK 57ff5a42ab

Tree-SHA512: 3fb6ba20894e52a116f89525a5f5a1f61d363ccd904e1cffd0e6d095640fc6d2edf0388cd6ae20f83bbc31e5f458255ec090b6e823798d426eba3e45b4336bf9
2021-03-17 09:54:27 +08:00
Samuel Dobson
d25e28c20b
Merge #21083: wallet: Avoid requesting fee rates multiple times during coin selection
f9cd2bfbcc Rename CoinSelectionParams::effective_fee to m_effective_feerate (Andrew Chow)
bdd0c2934b wallet: Move discard feerate fetching to CreateTransaction (Andrew Chow)
448d04b931 wallet: Move long term feerate setting to CreateTransaction (Andrew Chow)
e2f429e6bb wallet: Replace nFeeRateNeeded with effective_fee (Andrew Chow)
1a6a0b0dfb wallet: Use existing feerate instead of getting a new one (Andrew Chow)

Pull request description:

  During coin selection, there are various places where we need to have a feerate. We need the feerate for the transaction itself, the discard fee rate, and long term feerate. Fetching these each time we need them can lead to a race condition where two feerates that should be the same are actually different. One particular instance where this can happen is during the loop in `CreateTransactionInternal`. After inputs are chosen, the expected transaction fee is calculated using a newly fetched feerate. If `pick_new_inputs == false`, the loop will go again with the assumption that the fee for the transaction remains the same. However because the feerate is fetched again, it is possible that it actually isn't and this causes coin selection to fail.

  Instead of fetching the feerate each time it is needed, we fetch them all at once at the top of `CreateTransactionInternal`, store them in `CoinSelectionParams`, and use them where needed.

  While some of these fee rates probably don't need this caching, I've done it for consistency and the guarantee that they remain the same.

  Fixes #19229

ACKs for top commit:
  glozow:
    reACK f9cd2bfbcc
  fjahr:
    Code review re-ACK f9cd2bfbcc
  Xekyo:
    tACK f9cd2bfbcc
  meshcollider:
    Code review + test run ACK f9cd2bfbcc

Tree-SHA512: be83ff64ba473c3cdd3469c812e214659b6e2a9584c22ed2b1595618fce0d4b35d0901e61068cd1069fc1a8fb911db01dd7312d05c3b8cbafbe2504ab7a3e863
2021-03-17 13:14:48 +13:00
Andrew Chow
f9cd2bfbcc Rename CoinSelectionParams::effective_fee to m_effective_feerate
It's a feerate, not a fee. Also follow the style guide for member names.
2021-03-16 17:16:57 -04:00
Andrew Chow
bdd0c2934b wallet: Move discard feerate fetching to CreateTransaction
Instead of fetching the discard feerate for each SelectCoinsMinConf
iteration, fetch and cache it once during CreateTransaction so that it
is shared for each SelectCoinsMinConf through
coin_selection_params.m_discard_feerate.

Does not change behavior.
2021-03-16 16:33:27 -04:00
Andrew Chow
448d04b931 wallet: Move long term feerate setting to CreateTransaction
Instead of setting the long term feerate for each SelectCoinsMinConf
iteration, set it once during CreateTransaction and let it be shared
with each SelectCoinsMinConf through
coin_selection_params.m_long_term_feerate.

Does not change behavior.
2021-03-16 16:32:38 -04:00
MarcoFalke
5ef16038a1
Merge #21410: test: increase rpc_timeout for fundrawtx test_transaction_too_large
d09120b7d1 test: give fundraw more time for test_transaction_too_large (Jon Atack)

Pull request description:

  to hopefully fix timeouts from a new test added in 48a0319bab of #20536 merged March 8, 2021

  seen locally when running via the test runner

  ```
  File "/home/jon/projects/bitcoin/bitcoin/test/functional/rpc_fundrawtransaction.py", line 927, in test_transaction_too_large
  raise JSONRPCException({
      test_framework.authproxy.JSONRPCException: 'generatetoaddress' RPC took longer than 30.000000 seconds. Consider using larger timeout for calls that take longer to return. (-344)
  ```
  and in the CI like https://bitcoinbuilds.org/index.php?ansilog=28537952-2c92-46f2-9871-8918e5ba2738.log#l2398
  ```
  File "/home/ubuntu/src/test/functional/rpc_fundrawtransaction.py", line 927, in test_transaction_too_large
  test_framework.authproxy.JSONRPCException: 'generatetoaddress' RPC took longer than 240.000000 seconds. Consider using larger timeout for calls that take longer to return. (-344)
  ```

Top commit has no ACKs.

Tree-SHA512: f11c923439014fe12420f986c640fd301a26282eb41516957d73b9c751087cbae3d0e316f9ccb49bcb424f488540266f70d3f97948633e77c62bd7935df90452
2021-03-16 19:25:31 +01:00
Andrew Chow
e2f429e6bb wallet: Replace nFeeRateNeeded with effective_fee
Make sure that all fee calculations use the same feerate.
coin_selection_params.effective_fee is the variable we use for all fee
calculations, so get rid of remaining nFeeRateNeeded usages and just
directly set coin_selection_params.effective_fee.

Does not change behavior.
2021-03-16 12:32:56 -04:00
Andrew Chow
1a6a0b0dfb wallet: Use existing feerate instead of getting a new one
During each loop of CreateTransaction, instead of constantly getting a
new feerate, use the feerate that we have already fetched for all
fee calculations. Thix fixes a race condition where the feerate required
changes during each iteration of the loop.

This commit changes behavior as the "Fee estimation failed" error will
now take priority over "Signing transaction failed".
2021-03-16 12:30:01 -04:00
Jon Atack
d09120b7d1
test: give fundraw more time for test_transaction_too_large 2021-03-16 17:18:54 +01:00
Wladimir J. van der Laan
01bb3afb51
Merge #21447: Always add -daemonwait to known command line arguments
4d008f908e Always add -daemonwait to known command line arguments (Hennadii Stepanov)

Pull request description:

  This is a follow up of #21007.

  When `AC_CHECK_DECLS([fork])` fails:

  - on master (8e6532053f):
  ```
  $ src/bitcoind -daemonwait
  Error: Error parsing command line arguments: Invalid parameter -daemonwait

  ```

  - with this PR:
  ```
  $ src/bitcoind -daemonwait
  Error: -daemon is not supported on this operating system

  ```

ACKs for top commit:
  laanwj:
    Code review ACK 4d008f908e

Tree-SHA512: 7fcb5e9d76958adcf57e04fa74bd2a98d62459d81a3c57a97bd74c346cbf47c53e560a15455fb024e912c3b44e8487a83499e993b282871ba069953e665d88a9
2021-03-16 15:10:47 +01:00
Wladimir J. van der Laan
1b6c463e03
Merge #21407: i2p: limit the size of incoming messages
7059e6d822 test: add a test to ensure RecvUntilTerminator() limit works (Vasil Dimov)
80a5a8ea2b i2p: limit the size of incoming messages (Vasil Dimov)

Pull request description:

  Put a limit on the amount of data `Sock::RecvUntilTerminator()` can read
  if no terminator is received.

  In the case of I2P this avoids a runaway (or malicious) I2P proxy
  sending us tons of data without a terminator before a timeout is
  triggered.

ACKs for top commit:
  laanwj:
    Re-ACK 7059e6d822

Tree-SHA512: 21f3f3468c765c726cdc877eae847cdb4dbe225d94c5bd1849bd752c9761fac881c554f16ea7a685ad40312159d554e126c481e21c5fd83a6d947060b920373d
2021-03-16 13:11:59 +01:00
Wladimir J. van der Laan
7723479300
Merge #220: Do not translate file extensions
88df300f20 qt: Do not translate file extensions (Hennadii Stepanov)

Pull request description:

  File extensions are untranslatable by their nature.

ACKs for top commit:
  laanwj:
    Concept and code review ACK 88df300f20
  Talkless:
    tACK 88df300f20, tested on Debian Sid with Qt 5.15.2. Tested all filters except for .psbt.
  jarolrod:
    re-ACK 88df300f20

Tree-SHA512: 104d383543edcee8fb825f98d3b6669a7aaae2c74b6602f9bc407bf1c88be121ec535f2f9be87afa6ca775dc79865165f620553f6f6ab1d31a3f9ea93f7f9593
2021-03-16 13:07:10 +01:00
Wladimir J. van der Laan
3b408d21e0
Merge #21438: test: add ParseUInt8() test coverage
76782e560b refactor: reuse test string with embedded null char in util_tests (Jon Atack)
24c6546946 test: add ParseUInt8() unit and fuzz test coverage (Jon Atack)

Pull request description:

  We have unit test and fuzzer coverage for
  - `ParseInt64()`
  - `ParseInt32()`
  - `ParseUInt64()`
  - `ParseUInt32()`

  but not `ParseUInt8()`, so this pull adds it.

  I was tempted to add a commit that applies clang formatting to the file, or one that updates the C-style casts to named casts, but resisted the temptation unless reviewers request it.

ACKs for top commit:
  laanwj:
    Code review ACK 76782e560b
  MarcoFalke:
    cr ACK 76782e560b

Tree-SHA512: 1d7948b3385632094a3b0f0e38f87dccddabf74002e68aa055a51408866b057828ffa15c4b22aa9adde458155fbb5e443b66a9dbf3d7713358fc98a14d64bdcf
2021-03-16 12:06:26 +01:00
Wladimir J. van der Laan
af6ee17545
Merge #21405: compat: remove memcpy -> memmove backwards compatibility alias
52f0be3a93 compat: remove memcpy -> memmove backwards compatibility alias (fanquake)

Pull request description:

  In glib 2.13 memcpy was changed such that the way it copied bytes was reversed.
  This caused all sorts of issues for existing software, which depended on the
  existing behavior (when they should have been using memmove). See:
  https://sourceware.org/bugzilla/show_bug.cgi?id=12518
  https://bugzilla.redhat.com/show_bug.cgi?id=638477

  Now that we require glibc 2.17+ (#17538), we should be well clear of having to
  maintain our memcpy ->  memmove aliasing, which was introduced in #4339.

  Gitian builds:
  ```bash
  # Linux:
  52dee59c8c7d5620ac9b140b79fcaf3d2f15a219293140190f9283ba871f5391  bitcoin-52f0be3a9332-aarch64-linux-gnu-debug.tar.gz
  8963473b8791c5c6033a992d7dd761832fe1fb5732be790a6e9f8c11d67ad8ae  bitcoin-52f0be3a9332-aarch64-linux-gnu.tar.gz
  1fb3365c1ef60ecd1eb2d18f671f8f1e8cde0585de7de74aa0c5121093100c26  bitcoin-52f0be3a9332-arm-linux-gnueabihf-debug.tar.gz
  305c5b032d51ba97459715211112204a09d119edd6ec2a12b796559ad3fde761  bitcoin-52f0be3a9332-arm-linux-gnueabihf.tar.gz
  1f950a3e3979a4e1a67696b3fddc3090a0489a43b49e2b58a348d4b02ada2aa8  bitcoin-52f0be3a9332-powerpc64-linux-gnu-debug.tar.gz
  0b9731dba768b30c91dadec4cd7a98c86e06fbf6354555f798b46b7c4fab7b5f  bitcoin-52f0be3a9332-powerpc64-linux-gnu.tar.gz
  c4a37aae56cc023964f8d9e82d1b66913079cab559cbfc1c9127969aa968a06f  bitcoin-52f0be3a9332-powerpc64le-linux-gnu-debug.tar.gz
  dfbaa4f3bf12988a0a7f82c4b10162e5e7a63382a7e29d0170bc32ce344c97c3  bitcoin-52f0be3a9332-powerpc64le-linux-gnu.tar.gz
  3a0280d2c06516e50b0841d6f42d9589355dc9a1f8bb9a0b123554cd91b08004  bitcoin-52f0be3a9332-riscv64-linux-gnu-debug.tar.gz
  cc199a0f254b2366e80a6a884120ec3ea442983990ba1a5eb993c36060686eba  bitcoin-52f0be3a9332-riscv64-linux-gnu.tar.gz
  eb8e7ca673cc06c167ab082fe457a41f73758ecd5b34941300e3cd378c29b197  bitcoin-52f0be3a9332-x86_64-linux-gnu-debug.tar.gz
  dad19226c0e4c54b78ca2fa85fc28c5bfd1e1178e3f765472bd2f895a1d57145  bitcoin-52f0be3a9332-x86_64-linux-gnu.tar.gz
  ef89be95b84bb7c6fef055634cd20caf2fa5b42441502918dbfbf758bb2daab6  src/bitcoin-52f0be3a9332.tar.gz
  dc61f5ca33330c1609bc56b23f39fef3c1ff5ec6a1799d5b7a18f3c3b3acc9f9  bitcoin-core-linux-22-res.yml
  ```

  Guix builds:
  ```bash
  b50d6399cb59e5e4a9247b12a3eda61de6e51bd87ef1f27b388b75b71dfccf92  output/bitcoin-52f0be3a9332-aarch64-linux-gnu-debug.tar.gz
  23d845dc13e60a581ebdfbaa6063f559a56cce06734e1b50790d2fc13e257793  output/bitcoin-52f0be3a9332-aarch64-linux-gnu.tar.gz
  79094406fe00939bbce17a6d65de5a2686625e871432350c69e674cc80b1491c  output/bitcoin-52f0be3a9332-arm-linux-gnueabihf-debug.tar.gz
  65a91913249a743015eceea5a56c497d606af17270cb7e8a3df10cf729b757ec  output/bitcoin-52f0be3a9332-arm-linux-gnueabihf.tar.gz
  5e75ca5e8cf6934ba5a5a1b4d26c1b361b118e10ef34b73845d038035ddb9b85  output/bitcoin-52f0be3a9332-osx-unsigned.dmg
  774b372696cde8ceab40f6909dadea3fc87b375b495fcfb4ee8a963afd7fbd3a  output/bitcoin-52f0be3a9332-osx-unsigned.tar.gz
  dc4bdfb7b32dcc0b6e876d6d7ab3cb8d1472f21f66546ab70515f96262292e21  output/bitcoin-52f0be3a9332-osx64.tar.gz
  ea178ff9e28439f80129445cf260215c74eea2e610f62ff045061f287675d3ff  output/bitcoin-52f0be3a9332-powerpc64-linux-gnu-debug.tar.gz
  0390687a7aaa3f0a8a78be2deab21116599e5b332f00a2d1fdce97a5bd30e3eb  output/bitcoin-52f0be3a9332-powerpc64-linux-gnu.tar.gz
  52c948719a27f252f5969558abc2718c1e365ea85496322cb4ec97eab8a234cc  output/bitcoin-52f0be3a9332-powerpc64le-linux-gnu-debug.tar.gz
  5a4a8748dffe7e6a5bd07f3f564b1f2052440c4199fe25aaa41675bfb69e61db  output/bitcoin-52f0be3a9332-powerpc64le-linux-gnu.tar.gz
  ba521bd2b4e73aea317821a9e08da9a326c0be3b38d923b35ba14bc68ee6c814  output/bitcoin-52f0be3a9332-riscv64-linux-gnu-debug.tar.gz
  783ea81ab2f6b642b13ebf7882aa822d12f95936574a8848a74b1b8978e6801d  output/bitcoin-52f0be3a9332-riscv64-linux-gnu.tar.gz
  376706fc12e58d7d559a87e1ce64be22eaac3fc32d95c60d603ad893d9128cc1  output/bitcoin-52f0be3a9332-win-unsigned.tar.gz
  7aa48242fb71e29b00992b2be8677f1ea49f2ca82c5355bf0c1d4c8d14635596  output/bitcoin-52f0be3a9332-win64-debug.zip
  41e6461ab573fa8f6ac0f198193e72a4a047bb7a4193f743b937e81739c929cc  output/bitcoin-52f0be3a9332-win64-setup-unsigned.exe
  e2c4ecb05f24577da12f722d848bf6ac89f3f549d6d2bfd30d65676099c0725b  output/bitcoin-52f0be3a9332-win64.zip
  60ed63b3b562fa2141f18f1556a03c2474b75797088cd68fdb3e7d057a6983a3  output/bitcoin-52f0be3a9332-x86_64-linux-gnu-debug.tar.gz
  adb0bb62dc8b99d025a863e921b8e670f4c8f4b5600cd6d79eb552ede10bc8b8  output/bitcoin-52f0be3a9332-x86_64-linux-gnu.tar.gz
  ef89be95b84bb7c6fef055634cd20caf2fa5b42441502918dbfbf758bb2daab6  output/src/bitcoin-52f0be3a9332.tar.gz
  ```

ACKs for top commit:
  laanwj:
    Concept and code review ACK 52f0be3a93

Tree-SHA512: 851634a633cc7d27b10f11436768f3695a7615d5850166c3718028c36d3a7dd56baa2dd1028f47802891703e9f5a1d382f559e388ecef2249e2004edc62d97bf
2021-03-16 11:52:54 +01:00
Wladimir J. van der Laan
cb0aafbd21
Merge #21444: net, doc: Doxygen updates and fixes in netbase.{h,cpp}
8348a3742b net: fix hSocket param in netbase.h::ConnectSocketDirectly() (Jon Atack)
e6bd74b2e5 net: move Doxygen docs from netbase.cpp to netbase.h (Jon Atack)
12cc5704db net: update incorrect Doxygen documentation in netbase.cpp (Jon Atack)

Pull request description:

  While doing #21328, I noticed docs that were out-of-date or in the wrong file.

  The second commit is essentially move-only and is best reviewed with `colorMoved = dimmed-zebra` and `colorMovedWs = allow-indentation-change`.

ACKs for top commit:
  laanwj:
    Code review ACK 8348a3742b

Tree-SHA512: 13dae4abd3009fc43dfffc98e0f7eebcd6ad02afdd6050a7685a2ad4e6aaad93480d93886a2d1bd2375c2439d426494e4a8bc0c60e0e3104bfaa1830831ca663
2021-03-16 11:47:36 +01:00
Vasil Dimov
7059e6d822
test: add a test to ensure RecvUntilTerminator() limit works 2021-03-16 11:00:57 +01:00
Vasil Dimov
80a5a8ea2b
i2p: limit the size of incoming messages
Put a limit on the amount of data `Sock::RecvUntilTerminator()` can read
if no terminator is received.

In the case of I2P this avoids a runaway (or malicious) I2P proxy
sending us tons of data without a terminator before a timeout is
triggered.
2021-03-16 11:00:57 +01:00
Hennadii Stepanov
4d008f908e
Always add -daemonwait to known command line arguments 2021-03-16 10:48:26 +02:00
MarcoFalke
8e6532053f
Merge bitcoin-core/gui#246: Revert "qt: Use "fusion" style on macOS Big Sur with old Qt"
77833a364a Revert "qt: Use "fusion" style on macOS Big Sur with old Qt" (Hennadii Stepanov)

Pull request description:

  This PR reverts workaround introduced in #177.

  After bumping Qt version in depends to 5.12.10 in bitcoin/bitcoin#21376, there are no reasons to use the Fusion style on macOS.

ACKs for top commit:
  leonardojobim:
    tACK 77833a364a. Tested on macOS Big Sur v11.2.3
  jarolrod:
    ACK 77833a364a
  Talkless:
    utACK 77833a364a

Tree-SHA512: f704f2027dd380dfc604231e3606a036a8be891aeeddf643c474131014fa080e123b42836ac643a2064fe7a5a018fa8b9aa61a31f9da1d15880de6a36c4c0d54
2021-03-16 09:05:26 +01:00
Jon Atack
76782e560b
refactor: reuse test string with embedded null char in util_tests 2021-03-15 23:13:52 +01:00
Jon Atack
24c6546946
test: add ParseUInt8() unit and fuzz test coverage 2021-03-15 20:50:20 +01:00
MarcoFalke
4ba1bab443
Merge #21446: Update vcpkg checkout commit
b9e3f35306 Update vcpkg checkout commit. (Aaron Clauson)

Pull request description:

  Previously vcpkg was relying on `https://repo.msys2.org/mingw/i686/mingw-w64-i686-pkg-config-0.29.2-1-any.pkg.tar.xz` which is no longer available. The vcpkg source has been updated to use `http://repo.msys2.org/mingw/i686/mingw-w64-i686-pkg-config-0.29.2-2-any.pkg.tar.zst`.

  This PR updates the commit ID used to checkout vcpkg for the updated URL.

Top commit has no ACKs.

Tree-SHA512: 3e2f6d8cc14ef0ca93f75179da3e8303e19fb27d4a95e66e35376672744733fdbed9eb330638a48aa9962792674e584b702f4fbfc2c2564c5022bf8dbde6056c
2021-03-15 20:03:24 +01:00
Wladimir J. van der Laan
b650c9140e
Merge #21141: wallet: Add new format string placeholders for walletnotify
06e1fb0b17 Add new format string placeholders for walletnotify to include relevant block information for transactions (Maayan Keshet)

Pull request description:

  This patch includes two new format placeholders for walletnotify:
  %b - the hash of the block containting the transaction (zeroed if a mempool transaction)
  %h - the height of the block containing the transaction (zero if a mempool transaction)

  I've included test suite changes to check and validate the above functional requirements as well as doc/help description changes.

  **Motivation**
  The walletnotify option is used to be notified of new transactions relevant to the wallet of the node.
  A common usage pattern is to perform afterwards additional RPC calls to determine:
  1. If this is a mempool transaction or not (i.e. are there any confirmations?)
  2. What block was it included in?
  3. Did this transaction was seen before and is now seen again because of a fork?

  All of these questions can be answered with the current features, but the resulting RPC calls may be expensive in a heavily used node. As this information is readily available when calling the walletnotify callback, it makes sense to save expensive round trips by optionally sending this information at that point in time. I can definitely say we would like to use it in Fireblocks, my employer.

  Please let me know of any questions and suggestions.

ACKs for top commit:
  laanwj:
    ACK 06e1fb0b17

Tree-SHA512: d2744e2a7a883f9c3a9fd32237110e048c4b6b11fea8221c33d10b74157f65bbc4351211f441e8c1a4af5d5d38e2ba6b1943a7673dc18860c0553d7b41e00775
2021-03-15 19:55:38 +01:00
MarcoFalke
67ec26cacf
Merge #19259: fuzz: Add fuzzing harness for LoadMempool(...) and DumpMempool(...)
68afd3eeec tests: Add fuzzing harness for LoadMempool(...) and DumpMempool(...) (practicalswift)
91af6b97c9 validation: Make DumpMempool(...) and LoadMempool(...) easier to test/fuzz/mock (practicalswift)
af322c7494 tests: Set errno in FuzzedFileProvider. Implement seek(..., ..., SEEK_END). (practicalswift)

Pull request description:

  Add fuzzing harness for `LoadMempool(...)` and `DumpMempool(...)`.

  See [`doc/fuzzing.md`](https://github.com/bitcoin/bitcoin/blob/master/doc/fuzzing.md) for information on how to fuzz Bitcoin Core. Don't forget to contribute any coverage increasing inputs you find to the [Bitcoin Core fuzzing corpus repo](https://github.com/bitcoin-core/qa-assets).

  Happy fuzzing :)

ACKs for top commit:
  jonatack:
    Tested re-ACK 68afd3eeec

Tree-SHA512: 4b5fcaa87e6eb478611d3b68eb6859645a5e121e7e3b056ad2815699dace0a6123706ff542def371b47f4ab3ce2b8a29782026d84fb505827121e9b4cc7dac31
2021-03-15 18:56:06 +01:00
MarcoFalke
3ba195aa48
Merge #21398: doc: Update fuzzing docs for afl-clang-lto
fab633d2db doc: Update fuzzing docs for afl-clang-lto (MarcoFalke)

Pull request description:

  Update the docs to default to `afl-clang-lto`. The afl-gcc (and other afl legacy fuzz engines) are still supported, though discouraged.

ACKs for top commit:
  fanquake:
    ACK fab633d2db - seems to work for me. Compiled and ran some fuzzers using Clang 11 on Bionic. Set `llvm-config` so that `clang-11` would be used over `clang` (10).
  jarolrod:
    ACK fab633d2db, tested on Ubuntu Focal

Tree-SHA512: 3d1969c167bea45a9d691f3b757f51213d550c9c1b895bed1fcf3c2f7345791787cfb13c376291b94eb3181caf4ae3126f4d01c7cebda7b2bb1c40a1294e9a68
2021-03-15 18:52:58 +01:00
Aaron Clauson
b9e3f35306
Update vcpkg checkout commit.
Previously vcpkg was relying on https://repo.msys2.org/mingw/i686/mingw-w64-i686-pkg-config-0.29.2-1-any.pkg.tar.xz which is no longer available. The vcpkg source has been updated to use http://repo.msys2.org/mingw/i686/mingw-w64-i686-pkg-config-0.29.2-2-any.pkg.tar.zst. This PR updates the commit ID used to checkout vcpkg for the updated URL.
2021-03-15 17:18:42 +00:00
Maayan Keshet
06e1fb0b17 Add new format string placeholders for walletnotify to include relevant block information for transactions 2021-03-15 18:45:36 +02:00
MarcoFalke
c771fc0dc1
Merge #21424: Net processing: Tidy up CNodeState ctor
6927933782 [net processing] Add ChainSyncTimeoutState default initializers (John Newbery)
55966e0cc0 [net processing] Remove CNodeState ctor body (John Newbery)

Pull request description:

  This addresses the two outstanding review comments from #21370.

ACKs for top commit:
  practicalswift:
    cr ACK 6927933782: patch looks correct
  hebasto:
    ACK 6927933782, I have reviewed the code and it looks OK, I agree it can be merged.

Tree-SHA512: b3ef5c8a096e447887df255406b3a760f01c73e2b942374595416b4b4031fc69b89cd93168c45040489d581f340b2a62d3fbabd207d4307f587c00a7a7daacd1
2021-03-15 17:36:16 +01:00
MarcoFalke
9a5e097435
Merge #21443: fuzz: Implement fuzzed_dns_lookup_function as a lambda
7c8c140ecc fuzz: Implement fuzzed_dns_lookup_function as lambda (practicalswift)

Pull request description:

  Implement `fuzzed_dns_lookup_function` as a lambda.

  As wisely suggested by MarcoFalke in https://github.com/bitcoin/bitcoin/pull/19415#discussion_r594244506. Thanks! :)

ACKs for top commit:
  MarcoFalke:
    cr ACK 7c8c140ecc
  vasild:
    ACK 7c8c140ecc

Tree-SHA512: b175f2ad42e9a2be1f769ac677b2872e73ae621731d27e9a24bedadc14d9a6682c7fd1946a0df436d37e7b0cc0d212c1eef69f0409fb975cf9c460cd45f6e4ac
2021-03-15 17:26:16 +01:00
Jon Atack
8348a3742b
net: fix hSocket param in netbase.h::ConnectSocketDirectly() 2021-03-15 16:57:48 +01:00
Jon Atack
e6bd74b2e5
net: move Doxygen docs from netbase.cpp to netbase.h 2021-03-15 16:53:25 +01:00
practicalswift
68afd3eeec tests: Add fuzzing harness for LoadMempool(...) and DumpMempool(...) 2021-03-15 15:42:15 +00:00
Jon Atack
12cc5704db
net: update incorrect Doxygen documentation in netbase.cpp 2021-03-15 16:41:09 +01:00
practicalswift
7c8c140ecc fuzz: Implement fuzzed_dns_lookup_function as lambda 2021-03-15 15:27:25 +00:00
MarcoFalke
eceb3f7707
Merge #19415: net: Make DNS lookup mockable, add fuzzing harness
e528075189 tests: Add fuzzing harness for Lookup(...)/LookupHost(...)/LookupNumeric(...)/LookupSubNet(...) (practicalswift)
c6b4bfb4b3 net: Make DNS lookup code testable (practicalswift)

Pull request description:

  Make DNS lookup mockable/testable/fuzzable.

  Add fuzzing harness for `Lookup(…)`/`LookupHost(…)`/`LookupNumeric(…)`/`LookupSubNet(…)`.

  See [`doc/fuzzing.md`](https://github.com/bitcoin/bitcoin/blob/master/doc/fuzzing.md) for information on how to fuzz Bitcoin Core. Don't forget to contribute any coverage increasing inputs you find to the [Bitcoin Core fuzzing corpus repo](https://github.com/bitcoin-core/qa-assets).

  Happy fuzzing :)

ACKs for top commit:
  Crypt-iQ:
    cr ACK e528075189
  vasild:
    ACK e528075189

Tree-SHA512: 9984c2e2fedc3c1e1c3dbd701bb739ebd2f01766e6e83543dae5ae43eb8646c452bba0e101dd2f06079e5258bd5846c7d27a60ed5d77c1682b54c9544ffad443
2021-03-15 12:05:13 +01:00
MarcoFalke
c47979778d
Merge #21426: rpc: remove scantxoutset EXPERIMENTAL warning
2f0b25a156 rpc: remove scantxoutset EXPERIMENTAL warning (Jon Atack)

Pull request description:

  Remove old warning per IRC wallet meeting discussion at http://www.erisian.com.au/bitcoin-core-dev/log-2021-03-12.html#l-467

  This RPC was merged 3 years ago in #12196.

ACKs for top commit:
  MarcoFalke:
    cr ACK 2f0b25a156

Tree-SHA512: 874ccd5bd19ecbbe91912171ac85af7a4658dc92f6db484ff3d03f07f1b9ba97e1c69d33a5c3ae5c5ec46cac3595a211f55fec0fbf81bac30d66a891c376ce26
2021-03-15 11:14:47 +01:00
Jon Atack
2f0b25a156
rpc: remove scantxoutset EXPERIMENTAL warning 2021-03-15 10:45:49 +01:00
MarcoFalke
1e57d14d96
Merge #21035: Remove pointer cast in CRPCTable::dumpArgMap
9048c58e10 Remove pointer cast in CRPCTable::dumpArgMap (Russell Yanofsky)
14f3d9b908 refactor: Add RPC server ExecuteCommands function (Russell Yanofsky)
6158a6d397 refactor: Replace JSONRPCRequest fHelp field with mode field (Russell Yanofsky)

Pull request description:

  This change is needed to fix the `rpc_help.py` test failing in #10102: https://cirrus-ci.com/task/5469433013469184?command=ci#L2275

  The [`CRPCTable::dumpArgMap`](16b784d953/src/rpc/server.cpp (L492)) method currently works by casting RPC `unique_id` integer field to a function pointer, and then calling it. The `unique_id` field wasn't supposed to be used this way (it's meant to be used to detect RPC aliases) and as a result, this code segfaults in the `rpc_help.py` test in multiprocess PR #10102 because wallet RPC functions aren't directly accessible from the node process.

  Fix this by adding a new `GET_ARGS` RPC request mode to retrieve argument information similar to the way the `GET_HELP` mode retrieves help information.

  ---

  This PR is part of the [process separation project](https://github.com/bitcoin/bitcoin/projects/10).

ACKs for top commit:
  MarcoFalke:
    re-ACK 9048c58e10 👑

Tree-SHA512: cd1a01c1daa5bde2c2455b63548371ee4cf39688313969ad2016d9a0fd4344102e3fd43034058f253364518e9632d57cf21abffad0d6a2c0c94b7a6921cbe615
2021-03-15 10:13:58 +01:00
MarcoFalke
6bc51af5c2
Merge bitcoin-core/gui#250: scripted-diff: Drop redundant QString calls
def1e64bb4 scripted-diff: Drop redundant QString calls (Hennadii Stepanov)

Pull request description:

  The return type of `QObject::tr` function _is_ `QString` 🐅

ACKs for top commit:
  jarolrod:
    ACK def1e64bb4, tested on macOS 10.14.6 Qt 5.15.2

Tree-SHA512: ef405c87a30d6965f6887511d8666b6da57d258ca07833a3fa2dc9fd147d0539d33c57f7551ee13c1dd8024d6057139595c6ce5d088dd6efd7aa13db2a3eebdb
2021-03-15 09:05:18 +01:00
fanquake
16209b1b19
Merge #20556: rpc: Properly document return values (submitblock, gettxout, getblocktemplate, scantxoutset)
fa7ff0790e rpc: Properly document submitblock return value (MarcoFalke)
fae542c28b rpc: Properly document getblocktemplate return value (MarcoFalke)
fabaccf031 rpc: Properly document scantxoutset return value (MarcoFalke)
faa2059547 rpc: Properly document gettxout return value (MarcoFalke)

Pull request description:

  Currently a few return values are undocumented. This is causing confusion at the least. See for example #18476

ACKs for top commit:
  fjahr:
    utACK fa7ff0790e
  amitiuttarwar:
    tACK fa7ff0790e

Tree-SHA512: 933cb8f003163d93dbedb302d4c162514c2698ec6d58dbb9a053da8b8b9a4459b0701a3d9e830ecdabd7f278a46b7a07a3af49ec60703a80fcd75390877294ea
2021-03-15 15:32:15 +08:00
fanquake
d42078e93b
Merge #21437: gitian, ci: Drop unneeded python3-dev package for macOS builds
e4c0cada79 ci, gitian: Drop unneeded python3-dev package for macOS builds (Hennadii Stepanov)

Pull request description:

ACKs for top commit:
  fanquake:
    ACK e4c0cada79 - gitian builds match and I checked that this doesn't end up installed as a side-effect of another package.

Tree-SHA512: 520a3909b106a0e005b195c5395691edf62b76ee2df43b6971b7aa193648d68e6dac69cb4f1dc474f594b015a2fc2074061865e571d89365174beb5c1780356f
2021-03-15 14:46:11 +08:00
fanquake
57e980d13c
scripted-diff: remove Optional & nullopt
-BEGIN VERIFY SCRIPT-
git rm src/optional.h

sed -i -e 's/Optional</std::optional</g' $(git grep -l 'Optional<' src)

sed -i -e 's/{nullopt}/{std::nullopt}/g' $(git grep -l 'nullopt' src)
sed -i -e 's/ nullopt;/ std::nullopt;/g' $(git grep -l 'nullopt' src)
sed -i -e 's/ nullopt)/ std::nullopt)/g' $(git grep -l 'nullopt' src)
sed -i -e 's/(nullopt)/(std::nullopt)/g' $(git grep -l 'nullopt' src)
sed -i -e 's/ nullopt,/ std::nullopt,/g' $(git grep -l 'nullopt' src)
sed -i -e 's/? nullopt :/? std::nullopt :/g' $(git grep -l 'nullopt' src)
sed -i -e 's/: nullopt}/: std::nullopt}/g' $(git grep -l 'nullopt' src)

sed -i -e '/optional.h \\/d' src/Makefile.am

sed -i -e '/#include <optional.h>/d' src/test/fuzz/autofile.cpp src/test/fuzz/buffered_file.cpp src/test/fuzz/node_eviction.cpp

sed -i -e 's/#include <optional.h>/#include <optional>/g' $(git grep -l '#include <optional.h>' src)
-END VERIFY SCRIPT-
2021-03-15 10:41:30 +08:00
Hennadii Stepanov
def1e64bb4
scripted-diff: Drop redundant QString calls
-BEGIN VERIFY SCRIPT-
sed -i 's/QString(QObject::tr(\([^)]*\))/QObject::tr(\1/' src/qt/guiutil.cpp
-END VERIFY SCRIPT-
2021-03-15 01:23:21 +02:00
Hennadii Stepanov
e4c0cada79
ci, gitian: Drop unneeded python3-dev package for macOS builds 2021-03-14 14:55:12 +02:00
MarcoFalke
3c631917f3
Merge #21111: Improve OpenRC initscript
95f97111dd contrib/init: (OpenRC) quote some unquoted variables. (parazyd)
737feadff7 contrib/init: (OpenRC) Do not fail if both rpcuser and rpcpassword are unset. (parazyd)

Pull request description:

  This pull request improves the available OpenRC initscripts in
  `contrib/init`.

  The first commit (737feadff7) reworks
  `checkconfig()` to not fail if **both** `rpcuser` and `rpcpassword`
  are unset, because this implies that bitcoind shall use the `.cookie`
  file for RPC authentication. Currently, the initscript does not allow
  starting bitcoind without a set `rpcuser` and `rpcpassword`.

  The second commit (95f97111dd) simply
  quotes some unquoted variables.

ACKs for top commit:
  kristapsk:
    ACK 95f97111dd

Tree-SHA512: 62bebcd07143c147e349c0cfc17b54ef21bd4684377b444f58c6bd1f509a4d3e1af58746fa7215f18e33021f691bbbc5e42f4df497458322b055e545b7f30d46
2021-03-13 18:52:35 +01:00
Hennadii Stepanov
77833a364a
Revert "qt: Use "fusion" style on macOS Big Sur with old Qt"
This reverts commit 4e1154dfd1.

After bumping Qt version in depends to 5.12.10 in bitcoin/bitcoin#21376,
there are no reasons to use the Fusion style on macOS.
2021-03-12 18:55:44 +02:00