Commit Graph

26156 Commits

Author SHA1 Message Date
MarcoFalke
fa5f46600f
test: Fix rpc_net intermittent issue 2020-10-21 21:07:28 +02:00
MarcoFalke
b46f37ba5e
Merge #20198: Show name, format and if uses descriptors in bitcoin-wallet tool
fa4074b395 Show name, format and if uses descriptors in bitcoin-wallet tool (Jonas Schnelli)

Pull request description:

ACKs for top commit:
  MarcoFalke:
    ACK fa4074b395
  jonatack:
    re-ACK fa4074b395

Tree-SHA512: cf6ee96ff21532fc4b0ba7a0fdfdc1fa485c9b1495447350fe65cd0bd919e0e0280613933265cdee069b8c29ccf015ac374535a70cac3d4fb89f4d08b3a03519
2020-10-21 14:48:43 +02:00
MarcoFalke
47fc883106
Merge #19967: test: Replace (dis)?connect_nodes globals with TestFramework methods
3c7d9ab8c8 test: Move (dis)?connect_nodes globals into TestFramework as helpers (Elliott Jin)
4b16c61461 scripted-diff: test: Replace uses of (dis)?connect_nodes global (Prayank)
be386840d4 test: Replace use of (dis)?connect_nodes globals (Elliott Jin)

Pull request description:

  `util.py` defines global helper functions `connect_nodes` and `disconnect_nodes`; however, these functions are confusing because they take a node and an index (instead of two indexes).

  The `TestFramework` object has enough context to convert from `i` to `self.nodes[i]`, so we can replace all instances of `connect_nodes(self.nodes[a], b)` with `self.connect_nodes(a, b)`. Similarly, we can replace instances of `disconnect_nodes`.

  The approach taken in this PR builds on #19945 but uses a scripted-diff for the majority of the changes.

  Fixes: #19821

ACKs for top commit:
  MarcoFalke:
    ACK 3c7d9ab8c8
  guggero:
    ACK 3c7d9ab8

Tree-SHA512: e027092748602904abcd986d7299624c8754c3236314b6d8e392e306741c212f266c2207e385adfb194f67ae6559a585ee7b15d639b1d65c4651dbf503e5931a
2020-10-21 14:43:12 +02:00
MarcoFalke
0f86e7f128
Merge #20157: Bugfix: chainparams: Add missing (always enabled) Taproot deployment for Signet
2d5793c016 Bugfix: chainparams: Add missing (disabled) Taproot deployment for Signet (Luke Dashjr)

Pull request description:

  Is there a way we can trigger compiler warnings if a deployment is undefined?

ACKs for top commit:
  decryp2kanon:
    utACK 2d5793c016
  MarcoFalke:
    review ACK 2d5793c016

Tree-SHA512: 135cefae0f8dc552b0f682c2b87cabca7a4716290a36410a55968850e803a5049234e3cc597c8ef8d7917ae5d5ea3fb851e160df171b6793114c6bc01c5ea3e7
2020-10-21 14:19:33 +02:00
Jonas Schnelli
fa4074b395 Show name, format and if uses descriptors in bitcoin-wallet tool 2020-10-21 13:28:15 +02:00
Luke Dashjr
2d5793c016 Bugfix: chainparams: Add missing (disabled) Taproot deployment for Signet 2020-10-20 13:32:23 +00:00
Elliott Jin
3c7d9ab8c8 test: Move (dis)?connect_nodes globals into TestFramework as helpers 2020-10-20 00:43:00 -07:00
Prayank
4b16c61461 scripted-diff: test: Replace uses of (dis)?connect_nodes global
-BEGIN VERIFY SCRIPT-

 # max-depth=0 excludes test/functional/test_framework/...
 FILES=$(git grep -l --max-depth 0 "connect_nodes" test/functional)

 # Replace (dis)?connect_nodes(self.nodes[a], b) with self.(dis)?connect_nodes(a, b)
 sed -i 's/\b\(dis\)\?connect_nodes(self\.nodes\[\(.*\)\]/self.\1connect_nodes(\2/g' $FILES

 # Remove imports in the middle of a line
 sed -i 's/\(dis\)\?connect_nodes, //g' $FILES
 sed -i 's/, \(dis\)\?connect_nodes//g' $FILES

 # Remove imports on a line by themselves
 sed -i '/^\s*\(dis\)\?connect_nodes,\?$/d' $FILES
 sed -i '/^from test_framework\.util import connect_nodes$/d' $FILES

-END VERIFY SCRIPT-

Co-authored-by: Elliott Jin <elliott.jin@gmail.com>
2020-10-20 00:42:00 -07:00
Elliott Jin
be386840d4 test: Replace use of (dis)?connect_nodes globals
A later scripted-diff commit replaces the majority of uses, which all
follow this pattern:

    (dis)?connect_nodes(self.nodes[a], b)

This commit replaces the few "special cases".
2020-10-20 00:27:45 -07:00
Samuel Dobson
f5bd46a4cc
Merge #20125: rpc, wallet: Expose database format in getwalletinfo
624bab00dd test: add coverage for getwalletinfo format field (Jon Atack)
5e737a0092 rpc, wallet: Expose database format in getwalletinfo (João Barbosa)

Pull request description:

  Support for sqlite based wallets was added in #19077. This PR adds the `format` key in `getwalletinfo` response, that can be `bdb` or  `sqlite`.

ACKs for top commit:
  jonatack:
    Tested ACK 624bab00dd
  laanwj:
    Code review ACK 624bab00dd.
  MarcoFalke:
    doesn't hurt ACK 624bab00dd
  hebasto:
    ACK 624bab00dd, tested on Linux Mint 20 (x86_64).
  meshcollider:
    utACK 624bab00dd

Tree-SHA512: a81f8530f040f6381d33e073a65f281993eccfa717424ab6e651c1203cbaf27794dcb7175570459e7fdaa211565bc060d0a3ecbe70d2b6f9c49b8d5071e4441c
2020-10-20 12:35:33 +13:00
MarcoFalke
45385018e1
Merge #20162: p2p: declare Announcement::m_state as uint8_t, add getter/setter
c8abbc9d1f p2p: declare Announcement::m_state as uint8_t, add getter/setter (Jon Atack)

Pull request description:

  Change `Announcement::m_state` in `tx_request.cpp` from type `State` to `uint8_t` and add a getter and setter for the conversion to/from `State`. This should silence these travis ci gcc compiler warnings:

  ```
  txrequest.cpp:73:21: warning: ‘{anonymous}::Announcement::m_state’ is
  too small to hold all values of ‘enum class {anonymous}::State’
       State m_state : 3;
                       ^
  ```

  The gcc warnings are based on the maximum value held by the underlying uint8_t enumerator type, even though the intention of the bitfield declaration is the maximum declared enumerator value. They have apparently been silenced in gcc 8.4+ and 9.3+ according to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61414.

ACKs for top commit:
  sipa:
    utACK c8abbc9d1f
  ajtowns:
    ACK c8abbc9d1f -- quick code review
  hebasto:
    ACK c8abbc9d1f, tested on Bionic (x86_64, gcc 7.5.0):

Tree-SHA512: 026721dd7a78983a72da77638d3327d2b252bef804e489278a852f000046c028d6557bbd6c2b4cea391d4e01f9264a1be842d502047cb90b2997cc37bee59e61
2020-10-19 13:09:32 +02:00
fanquake
4f807348af
Merge #20185: doc: Merge release notes
fa38093bee doc: Merge release notes (MarcoFalke)

Pull request description:

  Now that all features are merged, open release notes editing at the wiki

  https://github.com/bitcoin-core/bitcoin-devwiki/wiki/0.21.0-Release-Notes-Draft

ACKs for top commit:
  fanquake:
    ACK fa38093bee

Tree-SHA512: ced161a2fcb0366a77a05b020c8dd65a0cf0a0de17b8260bbca9b5833ed370f92b1b81116bfc59b83380bf28b55d8963c628cf13a0cad603e5c823341b446065
2020-10-19 18:47:55 +08:00
MarcoFalke
fa38093bee
doc: Merge release notes 2020-10-19 12:00:16 +02:00
MarcoFalke
4769942d90
Merge #19624: Warn on unknown rw_settings
fa48405ef8 Warn on unknown rw_settings (MarcoFalke)

Pull request description:

  Log a warning to debug log if unknown settings are encountered. This should probably only ever happen when the software is upgraded.

  Something similar is already done for the command line and config file. See:

  * test: Add test for unknown args #16234 (commit fa7dd88b71)

ACKs for top commit:
  ryanofsky:
    Code review ACK fa48405ef8. Looks good and I could see this being helpful for debugging. Thanks for taking suggestions

Tree-SHA512: cec7d88adf84fa0a842f56b26245157736eb50df433db951e622ea07fd145b899822b24cdab1d8b36c066415ce4f0ef09b493fa8a8d691532822a59c573aafa7
2020-10-19 11:30:49 +02:00
MarcoFalke
d9d9a29352
Merge #20179: test: Fix intermittent issue in wallet_import_rescan
faab86f6c8 test: Fix intermittent issue in wallet_send (MarcoFalke)
faca3734c0 test: Fix intermittent issue in wallet_import_rescan (MarcoFalke)

Pull request description:

  Fixes the issue

  ```
   node2 2020-10-16T14:26:28.699593Z (mocktime: 2020-10-16T16:26:46Z) [msghand] Timeout downloading block 1131f0318b913e078402524f1e63e53d52171844dd8246a03b970e540cb56924 from peer=0, disconnecting

ACKs for top commit:
  fjahr:
    utACK faab86f6c8

Tree-SHA512: 739e8ad488c50e6beae676fb6cb021033cca6192da4acb4512c182bd8843f2f42a4a07474118285cb1d91798904433e4abb09476cc9ce115aae87ce64db69eaf
2020-10-19 09:27:32 +02:00
MarcoFalke
152ddb3197
Merge #20180: test: Fix -Wunused-function warnings if configured --without-libs
76bbcc414f test: Fix -Wunused-function warning if configured --without-libs (Hennadii Stepanov)

Pull request description:

  On master (80c8a02f1b) compiling with gcc:
  ```
  $ ./configure --without-libs
  $ make clean && make
  ...
  test/script_tests.cpp:1369:23: warning: ‘CScriptWitness script_tests::ScriptWitnessFromJSON(const UniValue&)’ defined but not used [-Wunused-function]
   1369 | static CScriptWitness ScriptWitnessFromJSON(const UniValue& univalue)
        |                       ^~~~~~~~~~~~~~~~~~~~~
  test/script_tests.cpp:1357:28: warning: ‘std::vector<CTxOut> script_tests::TxOutsFromJSON(const UniValue&)’ defined but not used [-Wunused-function]
   1357 | static std::vector<CTxOut> TxOutsFromJSON(const UniValue& univalue)
        |                            ^~~~~~~~~~~~~~
  test/script_tests.cpp:1350:28: warning: ‘CMutableTransaction script_tests::TxFromHex(const string&)’ defined but not used [-Wunused-function]
   1350 | static CMutableTransaction TxFromHex(const std::string& str)
        |                            ^~~~~~~~~
  ...
  ```

  This change is move-only (nice to review with `git diff --color-moved`).

ACKs for top commit:
  practicalswift:
    ACK 76bbcc414f: diff looks correct
  fanquake:
    ACK 76bbcc414f - verified that this fixes the warnings. As mentioned can be reviewed with `git diff HEAD~ --color-moved=dimmed_zebra`.

Tree-SHA512: 7799ac190d1e3f15e38b36cfcd1f8d138be80cab6c6cfad8f7828e07deffc2037d52f1d967f7f233a3a8ed74eee184f5275076c2f364c3e363c77a1f40aa5030
2020-10-19 09:18:16 +02:00
fanquake
62af467ff0
Merge #20082: [bugfix] random: fixes read buffer to use min rather than max
bd5215103e random: fixes read buffer resizing in RandAddSeedPerfmon (Ethan Heilman)

Pull request description:

  As shown below when resizing the read buffer `vData` `std::max((vData.size() * 3) / 2, nMaxSize)` is used. This means that the buffer size immediately jumps to `nMaxSize`. I believe the intend of this code is to grow the buffer size through several steps rather than immediately resize it to the max size.

  ```cpp
      std::vector<unsigned char> vData(250000, 0);
      long ret = 0;
      unsigned long nSize = 0;
      const size_t nMaxSize = 10000000; // Bail out at more than 10MB of performance data
      while (true) {
          nSize = vData.size();
          ret = RegQueryValueExA(HKEY_PERFORMANCE_DATA, "Global", nullptr, nullptr, vData.data(), &nSize);
          if (ret != ERROR_MORE_DATA || vData.size() >= nMaxSize)
              break;
          vData.resize(std::max((vData.size() * 3) / 2, nMaxSize)); // Grow size of buffer exponentially
      }
  ```

  vData always starts at size 250,000 and nMaxSize is always 10,000,000 so the first time this line is reached:
  ```cpp
  vData.resize(std::max((vData.size() * 3) / 2, nMaxSize));
  ```
  the effect will always be to resize vData to nMaxSize. Then because the loop terminates when vData.size >= 10,000,000 only one resize operation will take place.

  To fix this issue we replace `std::min` with `std::max`

  This PR also adds a comment clarifying the behavior of this function the first time it is called.

ACKs for top commit:
  fanquake:
    ACK bd5215103e - thanks for taking a look at this Ethan. Swapping from `std::max` to `std::min` here certainly seems correct.

Tree-SHA512: 7c65f700e5bbe44bc2f1ffdcdc99ec19c542894c95b5ee9791facd09d02afae88d1f8f35af129719e4860db94bc790856e7adb1d218a395381e7c2913b95f1d0
2020-10-19 14:04:10 +08:00
fanquake
a1e0359618
Merge #19986: refactor: clean up -Wlogical-op warning in wallet/scriptpubkeyman.cp
95fedd33a2 refactor: Clean up -Wlogical-op warning (maskoficarus)

Pull request description:

  This is a quick patch that fixes #19912 . This change prevents a -Wlogical-op warning that occurs because we're treating a const int value as a boolean. There's no sense checking if a non-zero constant has a value, so I've removed the check.

  #18836 also addresses the same warning, but has a larger scope and will require more review. This pull request will act as a patch to prevent this compile warning until 18836 is merged.

ACKs for top commit:
  MarcoFalke:
    review ACK 95fedd33a2
  hebasto:
    ACK 95fedd33a2, tested on Linux Mint 20 (x86_64):

Tree-SHA512: 13a9d7f7cb472f4c22a01ca2f9771a75267ff769bdae9d0dc6b2c7f3b05369f6dfa859be2b172b39c15ede6c44cddf556380b3565e42850faa65ccd3fe6e175b
2020-10-19 11:07:11 +08:00
fanquake
c92aa8357c
Merge #19911: net: guard vRecvGetData with cs_vRecv and orphan_work_set with g_cs_orphans
da0988daf1 scripted-diff: rename vRecvGetData (Neha Narula)
ba951812ec Guard vRecvGetData (now in net processing) with its own mutex (Neha Narula)
2d9f2fca43 Move vRecvGetData to net processing (Neha Narula)
673247b58c Lock before checking if orphan_work_set is empty; indicate it is guarded (Neha Narula)
8803aee668 Move m_orphan_work_set to net_processing (Neha Narula)
9c47cb29f9 [Rename only] Rename orphan_work_set to m_orphan_work_set. (Neha Narula)

Pull request description:

  Add annotations to guard `vRecvGetData` and `orphan_work_set` and fix up places where they were accessed without a lock. There is no current data race because they happen to be accessed by only one thread, but this might not always be the case.

  Original discussion: https://github.com/bitcoin/bitcoin/pull/18861#discussion_r451778445

ACKs for top commit:
  MarcoFalke:
    review ACK da0988daf1 🐬
  jnewbery:
    Code review ACK da0988daf1
  hebasto:
    ACK da0988daf1, I have reviewed the code and it looks correct, I agree it can be merged.

Tree-SHA512: 31cadd319ddc9273a87e77afc4db7339fd636e816b5e742eba5cb32927ac5cc07a672b2268d2d38a75a0f1b17d93836adab9acf7e52f26ea9a43f54efa57257e
2020-10-19 10:25:38 +08:00
Hennadii Stepanov
76bbcc414f
test: Fix -Wunused-function warning if configured --without-libs
This is a move-only change.
2020-10-18 19:06:01 +03:00
MarcoFalke
faab86f6c8
test: Fix intermittent issue in wallet_send 2020-10-18 11:02:59 +02:00
MarcoFalke
faca3734c0
test: Fix intermittent issue in wallet_import_rescan 2020-10-18 10:10:20 +02:00
MarcoFalke
80c8a02f1b
Merge #20159: test: mining_getblocktemplate_longpoll.py improvements (use MiniWallet, add logging)
b128b56672 test: add logging for mining_getblocktemplate_longpoll.py (Sebastian Falbesoner)
8ee3536b2b test: remove unused helpers random_transaction(), make_change() and gather_inputs() (Sebastian Falbesoner)
fddce7e199 test: use MiniWallet for mining_getblocktemplate_longpoll.py (Sebastian Falbesoner)

Pull request description:

  This PR enables one more of the non-wallet functional tests (mining_getblocktemplate_longpoll.py) to be run even with the Bitcoin Core wallet disabled by using the new MiniWallet instead, as proposed in #20078. Also adds missing log messages for the subtests.

  This was the only functional test that used the `random_transaction` helper in `test_framework/util.py`, hence it is removed, together with other helpers (`make_change` and `gather_inputs`) that were again only used by `random_transaction`.

ACKs for top commit:
  MarcoFalke:
    ACK b128b56672

Tree-SHA512: 09a5fa7b0f5976a47040f7027236d7ec0426d5a4829a082221c4b5fae294470230e89ae3df0bca0eea26833162c03980517f5cc88761ad251c3df4c4a49bca46
2020-10-17 17:57:23 +02:00
fanquake
5d644778da
Merge #20169: Taproot follow-up: Make ComputeEntrySchnorr and ComputeEntryECDSA const to clarify contract
51365674e8 script: Make ComputeEntrySchnorr and ComputeEntryECDSA const to clarify contract (practicalswift)

Pull request description:

  Make `ComputeEntrySchnorr` and `ComputeEntryECDSA` `const` to clarify contract.

ACKs for top commit:
  benthecarman:
    ACK 51365674e8
  theStack:
    ACK 51365674e8 👌
  sipa:
    utACK 51365674e8

Tree-SHA512: 0f7a72bf6df7a97d21045ead9db398d2a9527c358aeeb894dec34a5386da4cc316e2f3326716e960ef8aa47bf73b99d1f92bb6d45dfa7871c84624bcad8a79f1
2020-10-17 22:46:56 +08:00
fanquake
b3527fd2e9
Merge #20168: contrib: Fix gen_key_io_test_vectors.py imports
fa68755364 contrib: Fix gen_key_io_test_vectors.py imports (MarcoFalke)

Pull request description:

  The script currently fails with

  ```
  Traceback (most recent call last):
    File "./gen_key_io_test_vectors.py", line 18, in <module>
      from segwit_addr import bech32_encode, decode, convertbits, CHARSET
  ImportError: cannot import name 'decode' from 'segwit_addr'
  ```

  Fix that.
  Also, unrelated cleanup to use the `bytearray.hex()` method instead of importing a library. https://docs.python.org/3.5/library/stdtypes.html#bytes.hex

ACKs for top commit:
  theStack:
    tested ACK fa68755364

Tree-SHA512: 45ff7d710de3d0ef5ac6d91543cff0edff6189d2cd00b0f8889f4361e66ef1825f12aea9e71d62038c14a7a531bfc95ffe9a1df83b85aa7f3dd666df07a6be81
2020-10-17 10:37:01 +08:00
Jon Atack
c8abbc9d1f
p2p: declare Announcement::m_state as uint8_t, add getter/setter
to silence these Travis CI GCC compiler warnings:

txrequest.cpp:73:21: warning: ‘{anonymous}::Announcement::m_state’ is
too small to hold all values of ‘enum class {anonymous}::State’
     State m_state : 3;
                     ^
The warnings are based on the maximum value held by the underlying uint8_t
enumerator type, though the intention of the bitfield declaration is the
maximum declared enumerator value.

The warning been silenced in GCC 8.4+ and 9.3+ according to
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61414
2020-10-16 23:33:44 +02:00
Sebastian Falbesoner
b128b56672 test: add logging for mining_getblocktemplate_longpoll.py 2020-10-16 15:41:00 +02:00
Sebastian Falbesoner
8ee3536b2b test: remove unused helpers random_transaction(), make_change() and gather_inputs() 2020-10-16 15:40:54 +02:00
MarcoFalke
9e8d2bd076
Merge bitcoin-core/gui#97: Relax GUI freezes during IBD (when using wallets)
0d9d2a1f7c Only update the updateSmartFeeLabel once in sync (Jonas Schnelli)

Pull request description:

  Calling `updateSmartFeeLabel` and therefore `estimateSmartFee` is pointless during IBD.

  GUI freezes appear because `estimateSmartFee` competes with `processBlock` for the `m_cs_fee_estimator` lock leading to multiple seconds of blocking the GUI thread in `updateSmartFeeLabel`.

ACKs for top commit:
  ryanofsky:
    Code review ACK 0d9d2a1f7c. Clever fix. Didn't test but I remember I could reproduce the startup issue easily before by putting a sleep in estimateSmartFee.
  promag:
    Code review ACK 0d9d2a1f7c.
  hebasto:
    ACK 0d9d2a1f7c, tested on Linux Mint 20 (x86_64) with `QT_FATAL_WARNINGS=1` and `-debug=qt`.

Tree-SHA512: 85ec2266f06ddd7b523e24d2a462f10ed965d5b4d479005263056f81b7fe49996e1568dafb84658af406e9202ed3bfa846d59c10bb951e0f97cee230e30fafd5
2020-10-16 14:08:35 +02:00
MarcoFalke
fa68755364
contrib: Fix gen_key_io_test_vectors.py imports 2020-10-16 13:48:17 +02:00
Sebastian Falbesoner
fddce7e199 test: use MiniWallet for mining_getblocktemplate_longpoll.py
This test can now be run even with the Bitcoin Core wallet disabled.
2020-10-16 13:05:31 +02:00
MarcoFalke
cb21d864c5
Merge #19401: QA: Use GBT to get block versions correct
d438d609cd QA: Use GBT to get block versions correct (Luke Dashjr)
1df2cd1c8f QA: blocktools: Accept block template to create_block (Luke Dashjr)

Pull request description:

  The goal here is to decouple unrelated tests from the details of block versions.

  Currently, these tests are forcing specific versions of blocks for no real reason.

ACKs for top commit:
  fjahr:
    re-ACK d438d609cd
  benthecarman:
    ACK d438d60

Tree-SHA512: 523b1cd4dac8d65c88432e126ce7f60df96ca4b94f7ecc8e83ba4ffbade23e2afe7055fdf586ce3c195a533f2004e63fff83add4267b39473a581c9f1c6d5340
2020-10-16 11:43:21 +02:00
Wladimir J. van der Laan
2947ae6f85
Merge #20035: signet: Fix uninitialized read in validation
fa723e3d43 Initialize default-initialized uint256 consensus params to zero explicitly (MarcoFalke)
fa729cdb2c doc: Move assumed-values doxygen comments to header (MarcoFalke)
fa64892b82 signet: Fix uninitialized read in validation (MarcoFalke)

Pull request description:

ACKs for top commit:
  practicalswift:
    re-ACK fa723e3d43: patch still looks correct
  kallewoof:
    ReACK fa723e3d43
  theStack:
    re-ACK fa723e3d43 🍐

Tree-SHA512: db562bcc15af23bbcbf485f0bbf7564c64c144a4368230fd7682e8861d9500f6f5240351e31c560140df43b2e8456eafd9d27d1e8dd682b20afcc279a39dc329
2020-10-16 11:12:08 +02:00
fanquake
82d3596dfe
Merge #20161: Minor Taproot follow-ups
1d22300b99 Address functional test nits (Pieter Wuille)
5669642a0b docs: mention BIPs 340-342 in doc/bips.md (Pieter Wuille)

Pull request description:

  This addresses some nits in the tests, and adds entries for BIP 340-342 to doc/bips.md.

ACKs for top commit:
  fanquake:
    ACK 1d22300b99
  benthecarman:
    ACK 1d22300b99

Tree-SHA512: ad8f937dc6a34db86c585f65beb80e7eceda1822d9a20c86346a319908870381062856d0b95b42049a2791317a038c77fbcbf896c9f4aaa7318e4864b7fcf7a4
2020-10-16 15:01:42 +08:00
practicalswift
51365674e8 script: Make ComputeEntrySchnorr and ComputeEntryECDSA const to clarify contract 2020-10-16 06:26:46 +00:00
MarcoFalke
fa723e3d43
Initialize default-initialized uint256 consensus params to zero explicitly 2020-10-16 06:29:23 +02:00
fanquake
cbb5f3a2d5
Merge #19836: rpc: Properly deserialize txs with witness before signing
3333077823 rpc: Adjust witness-tx deserialize error message (MarcoFalke)
cccc752569 rpc: Properly deserialize txs with witness before signing (MarcoFalke)

Pull request description:

  Signing a transaction can only happen when the transaction has inputs. A transaction with inputs can always be deserialized as witness-transaction. If `try_no_witness` decoding is attempted, this will lead to rare intermittent failures.

  Fixes #18803

ACKs for top commit:
  achow101:
    ACK 3333077823
  ajtowns:
    ACK 3333077823

Tree-SHA512: 73f8a5cdfe03fb0e68908d2fa09752c346406f455694a020ec0dd1267ef8f0a583b8e84063ea74aac127106dd193b72623ca6d81469a94b3f5b3c766ebf2c42b
2020-10-16 12:05:26 +08:00
Pieter Wuille
1d22300b99 Address functional test nits 2020-10-15 15:39:09 -07:00
Pieter Wuille
5669642a0b docs: mention BIPs 340-342 in doc/bips.md 2020-10-15 14:20:20 -07:00
Wladimir J. van der Laan
9ad7cd2887
Merge #20090: [doc] Tiny followups to new getpeerinfo connection type field
41dca087b7 [trivial] Extract connection type doc into file where it is used. (Amiti Uttarwar)
3069b56a45 [doc] Improve help for getpeerinfo connection_type field. (Amiti Uttarwar)

Pull request description:

  two commits addressing small followups from #19725

  * first commit adds a clarification in the release notes that this field shouldn't be expected to be stable (suggested by sdaftuar in https://github.com/bitcoin/bitcoin/pull/19725#issuecomment-697421878)

  * second commit moves the `CONNECTION_TYPE_DOC` object out of the header file to reduce the size of the binary (suggested by MarcoFalke in https://github.com/bitcoin/bitcoin/pull/19725#discussion_r495467895, he tested and found a decrease of 10kB)

ACKs for top commit:
  achow101:
    ACK 41dca087b7
  laanwj:
    Code review ACK 41dca087b7

Tree-SHA512: a555df978b4341fbe05deeb40a8a655f0d3c5c1c0adcc1737fd2cf61b204a5a24a301ca0c2b5a3616554d4abf8c57074d22dbda5a50d8450bc22c57679424985
2020-10-15 20:45:56 +02:00
Wladimir J. van der Laan
9855422e65
Merge #17428: p2p: Try to preserve outbound block-relay-only connections during restart
a490d074b3 doc: Add anchors.dat to files.md (Hennadii Stepanov)
0a85e5a7bc p2p: Try to connect to anchors once (Hennadii Stepanov)
5543c7ab28 p2p: Fix off-by-one error in fetching address loop (Hennadii Stepanov)
4170b46544 p2p: Integrate DumpAnchors() and ReadAnchors() into CConnman (Hennadii Stepanov)
bad16aff49 p2p: Add CConnman::GetCurrentBlockRelayOnlyConns() (Hennadii Stepanov)
c29272a157 p2p: Add ReadAnchors() (Hennadii Stepanov)
567008d2a0 p2p: Add DumpAnchors() (Hennadii Stepanov)

Pull request description:

  This is an implementation of #17326:
  - all (currently 2) outbound block-relay-only connections (#15759) are dumped to `anchors.dat` file
  - on restart a node tries to connect to the addresses from `anchors.dat`

  This PR prevents a type of eclipse attack when an attacker exploits a victim node restart to force it to connect to new, probably adversarial, peers.

ACKs for top commit:
  jnewbery:
    code review ACK a490d074b3
  laanwj:
    Code review ACK a490d074b3

Tree-SHA512: 0f5098a3882f2814be1aa21de308cd09e6654f4e7054b79f3cfeaf26bc02b814ca271497ed00018d199ee596a8cb9b126acee8b666a29e225b08eb2a49b02ddd
2020-10-15 20:19:55 +02:00
Wladimir J. van der Laan
0d22482353
Merge #20002: net, rpc, cli: expose peer network in getpeerinfo; simplify/improve -netinfo
6272604bef refactor: enable -netinfo to add future networks (i2p, cjdns) (Jon Atack)
82fd40216c refactor: promote some -netinfo localvars to class members (Jon Atack)
5133fab37e cli: simplify -netinfo using getpeerinfo network field (Jon Atack)
4938a109ad rpc, test: expose CNodeStats network in RPC getpeerinfo (Jon Atack)
6df7882029 net: add peer network to CNodeStats (Jon Atack)

Pull request description:

  This PR:

  - builds on #19991 and #19998
  - exposes peer networks via a new getpeerinfo `network` field ("ipv4", "ipv6", or "onion"), and adds functional tests
  - updates -netinfo to use getpeerinfo `network` rather than detecting the peer networks client-side
  - refactors -netinfo to easily add future networks

ACKs for top commit:
  laanwj:
    ACK 6272604bef

Tree-SHA512: 28883487585135ceaaf84ce09131f2336e3193407f2e3df0960e3f4ac340f500ab94ffecb9d06a4c49bc05e3cca4f914ea4379860bea0bd5df2f834f74616015
2020-10-15 17:44:38 +02:00
Jon Atack
624bab00dd
test: add coverage for getwalletinfo format field 2020-10-15 16:46:34 +02:00
Wladimir J. van der Laan
711ddce943
Merge #20131: test: Remove unused nVersion=1 in p2p tests
faad92fe1c test: Remove unused nVersion=1 in p2p tests (MarcoFalke)

Pull request description:

  After commit ddefb5c0b7 nVersion is no
  longer used in p2p logic when sending messages. Only when receiving
  messages, but in this test no messages are received.

ACKs for top commit:
  laanwj:
    Code review ACK faad92fe1c
  fanquake:
    ACK faad92fe1c

Tree-SHA512: 9a7029187aaa5a7929a4a2199646131ff1ea72df6a855ce7022dd3bb2647dd525356dbc5e460c77007eebcdeab400a689db8cb77e8239af3b539c117a4e0d16e
2020-10-15 12:01:11 +02:00
MarcoFalke
560dea9b26
Merge #19770: RPC: getpeerinfo: Deprecate "whitelisted" field (replaced by "permissions")
5b57dc5458 RPC: getpeerinfo: Wrap long help line for bytesrecv_per_msg (Luke Dashjr)
d681a28219 RPC: getpeerinfo: Deprecate "whitelisted" field (replaced by "permissions") (Luke Dashjr)

Pull request description:

  If we were going to continue support for "whitelisted", we should have probably made it true if any permission flag was set, rather than only if "default permissions" were used.

  This corrects the description, and deprecates it.

ACKs for top commit:
  laanwj:
    ACK 5b57dc5458

Tree-SHA512: a2e2137f8be8110357c1b2fef2c923fa8c7c4a49b0b2b3a2d78aedf12f8ed5cc7e140018a21b37e6ec7770ed4007542aeef7ad4558973901b107e8e0f81d6003
2020-10-15 11:49:34 +02:00
Wladimir J. van der Laan
e3b474c548
Merge #20140: Restore compatibility with old CSubNet serialization
886be97af5 Ignore incorrectly-serialized banlist.dat entries (Pieter Wuille)
883cea7dea Restore compatibility with old CSubNet serialization (Pieter Wuille)

Pull request description:

  #19628 changed CSubNet for IPv4 netmasks, using the first 4 bytes of `netmask` rather than the last 4 to store the actual mask. Unfortunately, CSubNet objects are serialized on disk in banlist.dat, breaking compatibility with existing banlists (and bringing them into an inconsistent state where entries reported in `listbanned` cannot be removed).

  Fix this by reverting to the old format (just for serialization). Also add a sanity check to the deserializer so that nonsensical banlist.dat entries are ignored (which would otherwise be possible if someone added IPv4 entries after #19628 but without this PR).

  Reported by Greg Maxwell.

ACKs for top commit:
  laanwj:
    Code review ACK 886be97af5
  vasild:
    ACK 886be97af

Tree-SHA512: d3fb91e8ecd933406e527187974f22770374ee2e12a233e7870363f52ecda471fb0b7bae72420e8ff6b6b1594e3037a5115984c023dbadf38f86aeaffcd681e7
2020-10-15 11:44:36 +02:00
MarcoFalke
fa729cdb2c
doc: Move assumed-values doxygen comments to header 2020-10-15 11:28:13 +02:00
MarcoFalke
fa64892b82
signet: Fix uninitialized read in validation 2020-10-15 11:27:43 +02:00
Wladimir J. van der Laan
3956165903
Merge #17775: DecodeHexTx: Try case where txn has inputs first
27fc6a38f8 DecodeHexTx: Break out transaction decoding logic into own function (Gregory Sanders)
6020ce3c01 DecodeHexTx: Try case where txn has inputs first (Gregory Sanders)

Pull request description:

  Alternative/complementary to https://github.com/bitcoin/bitcoin/pull/17773 to avoid random `decoderawtransaction` failures. Most cases this is used now is on complete transactions, especially with the uptake of PSBT.

ACKs for top commit:
  ajtowns:
    ACK 27fc6a38f8
  achow101:
    ACK 27fc6a38f8

Tree-SHA512: 0a836d7c9951bf7d2764507788dbcc871d520f1ea9b77d6b22f051f4d6224ed779aba0e4f28c5c165040095ee0c70b67080c39164d82de61b19158f7ae6fddb2
2020-10-15 10:55:44 +02:00
Wladimir J. van der Laan
3caee16946
Merge #19953: Implement BIP 340-342 validation (Schnorr/taproot/tapscript)
0e2a5e448f tests: dumping and minimizing of script assets data (Pieter Wuille)
4567ba034c tests: add generic qa-asset-based script verification unit test (Pieter Wuille)
f06e6d0345 tests: functional tests for Schnorr/Taproot/Tapscript (Pieter Wuille)
3c226639eb tests: add BIP340 Schnorr signature support to test framework (Pieter Wuille)
206fb180ec --- [TAPROOT] Tests --- (Pieter Wuille)
d7ff237f29 Activate Taproot/Tapscript on regtest (BIP 341, BIP 342) (Pieter Wuille)
e9a021d7e6 Make Taproot spends standard + policy limits (Pieter Wuille)
865d2c37e2 --- [TAPROOT] Regtest activation and policy --- (Pieter Wuille)
72422ce396 Implement Tapscript script validation rules (BIP 342) (Johnson Lau)
330de894a9 Use ScriptExecutionData to pass through annex hash (Pieter Wuille)
8bbed4b7ac Implement Taproot validation (BIP 341) (Pieter Wuille)
0664f5fe1f Support for Schnorr signatures and integration in SignatureCheckers (BIP 340) (Pieter Wuille)
5de246ca81 Implement Taproot signature hashing (BIP 341) (Johnson Lau)
9eb590894f Add TaggedHash function (BIP 340) (Pieter Wuille)
450d2b2371 --- [TAPROOT] BIP340/341/342 consensus rules --- (Pieter Wuille)
5d62e3a68b refactor: keep spent outputs in PrecomputedTransactionData (Pieter Wuille)
8bd2b4e784 refactor: rename scriptPubKey in VerifyWitnessProgram to exec_script (Pieter Wuille)
107b57df9f scripted-diff: put ECDSA in name of signature functions (Pieter Wuille)
f8c099e220 --- [TAPROOT] Refactors --- (Pieter Wuille)

Pull request description:

  This is an implementation of the Schnorr/taproot consensus rules proposed by BIPs [340](https://github.com/bitcoin/bips/blob/master/bip-0340.mediawiki), [341](https://github.com/bitcoin/bips/blob/master/bip-0340.mediawiki), and [342](https://github.com/bitcoin/bips/blob/master/bip-0340.mediawiki).

  See the list of commits [below](https://github.com/bitcoin/bitcoin/pull/19953#issuecomment-691815830). No signing or wallet support of any kind is included, as testing is done entirely through the Python test framework.

  This is a successor to https://github.com/bitcoin/bitcoin/pull/17977 (see discussion following [this comment](https://github.com/bitcoin/bitcoin/pull/17977#issuecomment-682285983)), and will have further changes squashed/rebased. The history of this PR can be found in #19997.

ACKs for top commit:
  instagibbs:
    reACK 0e2a5e448f
  benthecarman:
    reACK 0e2a5e4
  kallewoof:
    reACK 0e2a5e448f
  jonasnick:
    ACK 0e2a5e448f almost only looked at bip340/libsecp related code
  jonatack:
    ACK 0e2a5e448f modulo the last four commits (tests) that I plan to finish reviewing tomorrow
  fjahr:
    reACK 0e2a5e448f
  achow101:
    ACK 0e2a5e448f

Tree-SHA512: 1b00314450a2938a22bccbb4e177230cf08bd365d72055f9d526891f334b364c997e260c10bc19ca78440b6767712c9feea7faad9a1045dd51a5b96f7ca8146e
2020-10-15 10:22:35 +02:00