Commit graph

31782 commits

Author SHA1 Message Date
MarcoFalke
76392b042e
Merge bitcoin/bitcoin#22829: refactor: various RecursiveMutex replacements in CConnman
3726a45958 refactor: replace RecursiveMutex m_added_nodes_mutex with Mutex (Sebastian Falbesoner)
7d52ff5c38 refactor: replace RecursiveMutex m_addr_fetches_mutex with Mutex (Sebastian Falbesoner)
d51d2a3bb5 scripted-diff: rename node vector/mutex members in CConnman (Sebastian Falbesoner)
574cc4271a refactor: remove RecursiveMutex cs_totalBytesRecv, use std::atomic instead (Sebastian Falbesoner)

Pull request description:

  This PR is related to #19303 and gets rid of the following RecursiveMutex members in class `CConnman`:
  * for `cs_totalBytesRecv`, protecting `nTotalBytesRecv`, `std::atomic` is used instead (the member is only increment at one and read at another place, so this is sufficient)
  * for `m_addr_fetches_mutex`, protecting `m_addr_fetches`, a regular `Mutex` is used instead (there is no chance that within one critical section, another one is called)
  * for `cs_vAddedNodes`, protecting `vAddedNodes`, a regular `Mutex` is used instead (there is no chance that within one critical section, another one is called)

  Additionally, the PR takes the chance to rename all node vector members (vNodes, vAddedNodes) and its corresponding mutexes (cs_vNodes, cs_vAddedNodes) to match the coding guidelines via a scripted-diff.

ACKs for top commit:
  vasild:
    ACK 3726a45958
  promag:
    Code review ACK 3726a45958.
  hebasto:
    re-ACK 3726a45958

Tree-SHA512: 4f5ad41ba2eca397795080988c1739c6abb44c1204dddaa75cc38a396fa821fbe1010694ba7bead1b606beaa677661e66da2a5dca233b2937214f63a54848348
2021-11-25 11:55:37 +01:00
MarcoFalke
faad05c6d2
Crash debug builds when mempool ConsensusScriptChecks fails 2021-11-25 11:45:50 +01:00
W. J. van der Laan
791dd1f41e
Merge bitcoin/bitcoin#23538: Remove strtol in torcontrol
fa186eb7f4 Remove strtol in torcontrol (MarcoFalke)

Pull request description:

  The sequence of octal chars is fully validated before calling `strtol`, so it can be replaced by a simple loop. This removes the last "locale depended" `strtol` call. Also, removes some unused includes.

ACKs for top commit:
  laanwj:
    Code review and tested ACK fa186eb7f4

Tree-SHA512: aafa4c68046e5ec48824c4f2c18e4920e5fe1d1fa03a8a297b2f40d0a1967cd0dad3554352519073a1620714e958ed5133cbc6b70bedcc508a423551d829f80e
2021-11-25 11:39:54 +01:00
Hennadii Stepanov
9facad0da6
Merge bitcoin-core/gui#477: Monospaced output in Console on macOS
b9f0aff6b4 qt: monospaced output in Console on macOS (randymcmillan)

Pull request description:

  This PR addresses issue https://github.com/bitcoin-core/gui/issues/273
  A monospace font is used on Linux and Windows for the console output - but not on MacOS.
  This change forces the MacOS GUI to use the embedded RobotoMono-Bold.ttf font,
  which is defined as the GUIUtil::fixedPitchFont()

ACKs for top commit:
  hebasto:
    ACK b9f0aff6b4, Tested on macOS Big Sur 11.6.1 (20G224) + Homebrew's Qt 5.15.2:
  shaavan:
    reACK b9f0aff6b4
  jarolrod:
    tACK b9f0aff6b4

Tree-SHA512: 53e6635a0189e133681c85d442c6c9c4a10438151e4bf7da5bbd62abca7ab55685caf2c9a75ff200aadea771c1602902e6ab14afdc4f411e1b3013dd49625dbc
2021-11-25 09:59:52 +02:00
Hennadii Stepanov
d0204199d6
Revert "doc: Install Rosetta on M1-macOS for qt in depends"
This reverts commit cdb41d5573.

It is no longer required because of the previous commit.
2021-11-25 09:35:25 +02:00
Hennadii Stepanov
f6e2781675
build, qt, macOS: Don't pass -device-option when building natively 2021-11-25 09:35:24 +02:00
Hennadii Stepanov
667f0689ca
build, qt, macOS: Don't hard-code x86_64 as the arch when using qmake
This change fixes qt build on M1 Apple Silicon
2021-11-25 09:35:17 +02:00
fanquake
4cc998ce9d
Merge bitcoin/bitcoin#23580: build: patch qt to explicitly define previously implicit header include
8196b0a2bc build: patch qt to explicitly define previously implicit header include (Kittywhiskers Van Gogh)

Pull request description:

  ### Description

  macOS Monterey has refactored some includes such that implicitly defined headers were no longer exposed and that in turns breaks building Qt on macOS 12. First observed when building on an M1 Pro. See "Additional Reading" for more information.

  ### Additional Reading

  * https://github.com/microsoft/vcpkg/issues/21055 (resolved by c32ccbb34c)
  * ["Add missing macOS header file that was indirectly included before"](https://code.qt.io/cgit/qt/qtbase.git/commit/src/plugins/platforms/cocoa?id=dece6f5840463ae2ddf927d65eb1b3680e34a547) on https://code.qt.io/

ACKs for top commit:
  hebasto:
    ACK 8196b0a2bc, verified that the patch is applied cleanly:
  fanquake:
    ACK 8196b0a2bc

Tree-SHA512: efe6d93edd2e2f68f33a1c353d353c8e7b5aa680733561caa6eb092fd0f68153f8ed1649a61048ef873f6be8041b9ca8e6919d80b947181b6fe4152464e2d383
2021-11-25 15:33:10 +08:00
MarcoFalke
064c729a96
Merge bitcoin/bitcoin#23512: policy: Treat taproot as always active
fa3e0da06b policy: Treat taproot as always active (MarcoFalke)

Pull request description:

  Now that taproot is active, it can be treated as if it was always active for policy for the next major release. This simplifies the code and changes two things:

  * Importing `tr` descriptors can be done before the chain is fully synced. This is fine, because the wallet will already generate `tr` descriptors by default (regardless of the taproot status) after commit 47fe7445e7.
  * Valid taproot spends won't be rejected from the mempool before taproot is active. This is strictly speaking a bugfix after commit 47fe7445e7, since the wallet may generate taproot spends before the chain is fully synced. For example, a slow node or a purposefully offline node. Currently, the wallet needs the mempool to account for change. See https://github.com/bitcoin/bitcoin/issues/11887.

  A similar change was done for segwit v0 in https://github.com/bitcoin/bitcoin/pull/13120 .

  This effectively reverts commit c5ec0367d7.

ACKs for top commit:
  mjdietzx:
    Code Review ACK fa3e0da06b
  achow101:
    ACK fa3e0da06b
  sipa:
    utACK fa3e0da06b
  gruve-p:
    ACK fa3e0da06b
  gunar:
    Code Review + tACK fa3e0da06
  rajarshimaitra:
    code review + tACK fa3e0da06b

Tree-SHA512: c6dc7a4e6c345bdec33f256847dc63906ab1696aa683ab9b32a79e715613950884ac3a1a7a44e95f31bb28e58dd64679a616175f7e152b21f5550f3337c8e622
2021-11-25 08:16:19 +01:00
Sebastian Falbesoner
3726a45958 refactor: replace RecursiveMutex m_added_nodes_mutex with Mutex
The RecursiveMutex m_added_nodes_mutex is used at three places:
    - CConnman::GetAddedNodeInfo()
    - CConnman::AddNode()
    - CConnman::ThreadOpenConnections()
In each of the critical sections, only the the m_added_nodes member is
accessed (and in the last case, also m_addr_fetches), without any chance
that within one section another one is called. Hence, we can use an
ordinary Mutex instead of RecursiveMutex.
2021-11-24 19:34:26 +01:00
Sebastian Falbesoner
7d52ff5c38 refactor: replace RecursiveMutex m_addr_fetches_mutex with Mutex
The RecursiveMutex m_addr_fetches_mutex is used at three places:
    - CConnman::AddAddrFetch()
    - CConnman::ProcessAddrFetch()
    - CConnman::ThreadOpenConnections()
In each of the critical sections, only the the m_addr_fetches is accessed
(and in the last case, also vAddedNodes), without any chance that within
one section another one is called. Hence, we can use an ordinary Mutex
instead of RecursiveMutex.
2021-11-24 19:34:26 +01:00
Sebastian Falbesoner
d51d2a3bb5 scripted-diff: rename node vector/mutex members in CConnman
-BEGIN VERIFY SCRIPT-

ren() { sed -i "s/$1/$2/g" $3 $4 $5; }

ren cs_vAddedNodes         m_added_nodes_mutex     src/net.h src/net.cpp
ren vAddedNodes            m_added_nodes           src/net.h src/net.cpp
ren cs_vNodes              m_nodes_mutex           src/net.h src/net.cpp src/test/util/net.h
ren vNodesDisconnectedCopy nodes_disconnected_copy src/net.cpp
ren vNodesDisconnected     m_nodes_disconnected    src/net.h src/net.cpp
ren vNodesCopy             nodes_copy              src/net.cpp
ren vNodesSize             nodes_size              src/net.cpp
ren vNodes                 m_nodes                 src/net.h src/net.cpp src/test/util/net.h

-END VERIFY SCRIPT-
2021-11-24 19:34:21 +01:00
Sebastian Falbesoner
574cc4271a refactor: remove RecursiveMutex cs_totalBytesRecv, use std::atomic instead
The RecursiveMutex cs_totalBytesRecv is only used at two places: in
CConnman::RecordBytesRecv() to increment the nTotalBytesRecv member, and in
CConnman::GetTotalBytesRecv() to read it. For this simple use-case, we can
make the member std::atomic instead to achieve the same result.
2021-11-24 19:19:42 +01:00
W. J. van der Laan
64059b78f5
Merge bitcoin/bitcoin#21943: Dedup and RAII-fy the creation of a copy of CConnman::vNodes
f52b6b2d9f net: split CConnman::SocketHandler() (Vasil Dimov)
c7eb19ec83 style: remove unnecessary braces (Vasil Dimov)
664ac22c53 net: keep reference to each node during socket wait (Vasil Dimov)
75e8bf55f5 net: dedup and RAII-fy the creation of a copy of CConnman::vNodes (Vasil Dimov)

Pull request description:

  _This is a piece of https://github.com/bitcoin/bitcoin/pull/21878, chopped off to ease review._

  The following pattern was duplicated in CConnman:

  ```cpp
  lock
  create a copy of vNodes, add a reference to each one
  unlock
  ... use the copy ...
  lock
  release each node from the copy
  unlock
  ```

  Put that code in a RAII helper that reduces it to:

  ```cpp
  create snapshot "snap"
  ... use the copy ...
  // release happens when "snap" goes out of scope

ACKs for top commit:
  jonatack:
    ACK  f52b6b2d9f changes since last review are reordered commits, removing an unneeded local variable, and code formatting and documentation improvements
  LarryRuane:
    code review ACK f52b6b2d9f
  promag:
    Code review ACK f52b6b2d9f, only format changes and comment tweaks since last review.

Tree-SHA512: 5ead7b4c641ebe5b215e7baeb7bc0cdab2a588b2871d9a343a1d518535c55c0353d4e46de663f41513cdcc79262938ccea3232f6d5166570fc2230286c985f68
2021-11-24 17:44:07 +01:00
MarcoFalke
9394964f6b
Merge bitcoin/bitcoin#23451: span: Add std::byte helpers
faa3ec2304 span: Add std::byte helpers (MarcoFalke)
fa18038f51 refactor: Use ignore helper when unserializing an invalid pubkey (MarcoFalke)
fabe18d0b3 Use value_type in CDataStream where possible (MarcoFalke)

Pull request description:

  This adds (currently unused) span std::byte helpers, so that they can be used in new code.

  The refactors are also required for https://github.com/bitcoin/bitcoin/pull/23438, but they are split up because the other pull doesn't compile with msvc right now.

  The third commit is not needed for the other pull, but still nice.

ACKs for top commit:
  klementtan:
    reACK  faa3ec2. Verified that all the new `std::byte` helper functions are tested.
  laanwj:
    Code review ACK faa3ec2304

Tree-SHA512: b1f6af39f03ea4dfebf20d4a8538fa993a6104e7fc92ddf0c4606a7efc3ca9a8c1a4741d98a1418569c11bb9ce9258bf0c0c06d93d85ed7e208902a2db04e407
2021-11-24 11:04:37 +01:00
MarcoFalke
73ac195e29
Merge bitcoin/bitcoin#23249: util: ParseByteUnits - Parse a string with suffix unit
21b58f430f util: ParseByteUnits - Parse a string with suffix unit [k|K|m|M|g|G|t|T] (Douglas Chimento)

Pull request description:

  A convenience utility for parsing human readable strings sizes e.g. `500G` is `500 * 1 << 30`

  The argument/setting `maxuploadtarget`  now accept human readable byte units `[k|K|m|M|g|G||t|T]`
  This change  backward compatible, defaults to `M` if no unit specified.

ACKs for top commit:
  vasild:
    ACK 21b58f430f
  ryanofsky:
    Code review ACK 21b58f430f. Only changes since last review are dropping optional has_value call, fixing comment punctuation, squashing commits.

Tree-SHA512: c9b85acc0f77c847a0290b27ac5dc586ecc078110cf133063140576a04c11aa9c553159b9b4993488edcf6e60db6837de7c83b2964639bc21e8ffa4d455a5eb7
2021-11-24 10:49:13 +01:00
Kittywhiskers Van Gogh
8196b0a2bc build: patch qt to explicitly define previously implicit header include
macOS Monterey has refactored some includes such that implicitly defined headers were no longer exposed and that in turns breaks building Qt on macOS 12.

Additional Resources:
 - https://bugreports.qt.io/browse/QTBUG-97855
 - https://codereview.qt-project.org/c/qt/qtbase/+/378706
 - https://code.qt.io/cgit/qt/qtbase.git/commit/src/plugins/platforms/cocoa?id=dece6f5840463ae2ddf927d65eb1b3680e34a547
2021-11-24 14:03:12 +05:30
Nathan Garabedian
7bb8eb0bc3 script install_db4.sh added check for patch command 2021-11-23 07:24:35 -08:00
fanquake
4018e23aa7
Merge bitcoin/bitcoin#23573: refactor: cast bool operands to int to silence compiler warning
ab22a71429 refactor: cast bool to int to silence compiler warning (Jon Atack)

Pull request description:

  This fixes a compiler warning:
  ```
  node/interfaces.cpp:544:16: warning: use of bitwise '&' with boolean operands [-Wbitwise-instead-of-logical]
          return FillBlock(ancestor, ancestor_out, lock, active) & FillBlock(block1, block1_out, lock, active) & FillBlock(block2, block2_out, lock, active);
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                                                                                               &&
  node/interfaces.cpp:544:16: note: cast one or both operands to int to silence this warning
  node/interfaces.cpp:544:16: warning: use of bitwise '&' with boolean operands [-Wbitwise-instead-of-logical]
          return FillBlock(ancestor, ancestor_out, lock, active) & FillBlock(block1, block1_out, lock, active) & FillBlock(block2, block2_out, lock, active);
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                                                 &&
  node/interfaces.cpp:544:16: note: cast one or both operands to int to silence this warning
  2 warnings generated.
  ```

ACKs for top commit:
  sipa:
    utACK ab22a71429
  theStack:
    Concept and code-review ACK ab22a71429
  shaavan:
    ACK ab22a71429

Tree-SHA512: 84e5aeabc1514a7586ac7c78a8eff1d15a5967dced7b2485b266b6fd79a530e1b22d99ded0a5df39f7806d3c5fd6d9752f08a722cc3be17850a6242c4022ab03
2021-11-23 17:46:59 +08:00
Samuel Dobson
c8b9a224e7 Report encoding type in bech32 error message 2021-11-23 15:48:59 +13:00
Samuel Dobson
92f0cafdca Improve Bech32 boost tests 2021-11-23 15:48:59 +13:00
Samuel Dobson
bb4d3e9b97 Address review comments for Bech32 error validation 2021-11-23 15:48:59 +13:00
Jon Atack
ab22a71429 refactor: cast bool to int to silence compiler warning
This fixes -Wbitwise-instead-of-logical compiler warnings:

node/interfaces.cpp:544:16: warning: use of bitwise '&' with boolean operands [-Wbitwise-instead-of-logical]
        return FillBlock(ancestor, ancestor_out, lock, active) & FillBlock(block1, block1_out, lock, active) & FillBlock(block2, block2_out, lock, active);
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                                                                                             &&
node/interfaces.cpp:544:16: note: cast one or both operands to int to silence this warning
node/interfaces.cpp:544:16: warning: use of bitwise '&' with boolean operands [-Wbitwise-instead-of-logical]
        return FillBlock(ancestor, ancestor_out, lock, active) & FillBlock(block1, block1_out, lock, active) & FillBlock(block2, block2_out, lock, active);
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                                               &&
node/interfaces.cpp:544:16: note: cast one or both operands to int to silence this warning
2 warnings generated.

A similar change was recently made to libsecp in commit 16d13221
for the same reason.
2021-11-22 15:11:58 +01:00
W. J. van der Laan
95d19f8c1a
Merge bitcoin/bitcoin#16807: Let validateaddress locate error in Bech32 address
88cc481092 Modify copyright header on Bech32 code (Samuel Dobson)
5599813b80 Add lots of comments to Bech32 (Samuel Dobson)
2eb5792ec7 Add release notes for validateaddress Bech32 error detection (MeshCollider)
42d6a029e5 Refactor and add more tests for validateaddress (Samuel Dobson)
c4979f77c1 Add boost tests for bech32 error detection (MeshCollider)
02a7bdee42 Add error_locations to validateaddress RPC (Samuel Dobson)
b62b67e06c Add Bech32 error location function (Samuel Dobson)
0b06e720c0 More detailed error checking for base58 addresses (Samuel Dobson)

Pull request description:

  Addresses (partially) #16779 - no GUI change in this PR

  Adds a LocateError function the bech32 library, which is then called by `validateaddress` RPC, (and then eventually from a GUI tool too, future work). I think modifying validateaddress is nicer than adding a separate RPC for this.
  Includes tests.

  Based on https://github.com/sipa/bech32/blob/master/ecc/javascript/bech32_ecc.js
  Credit to sipa for that code

ACKs for top commit:
  laanwj:
    Code review and manually tested ACK 88cc481092
  ryanofsky:
    Code review ACK 88cc481092 with caveat that I only checked the new `LocateErrors` code to try to verify it didn't have unsafe or unexpected operations or loop forever or crash. Did not try to verify behavior corresponds to the spec. In the worst case bugs here should just affect error messages not actual decoding of addresses so this seemed ok.
  w0xlt:
    tACK 88cc481

Tree-SHA512: 9c7fe9745bc7527f80a30bd4c1e3034e16b96a02cc7f6c268f91bfad08a6965a8064fe44230aa3f87e4fa3c938f662ff4446bc682c83cb48c1a3f95cf4186688
2021-11-22 13:26:01 +01:00
randymcmillan
b9f0aff6b4
qt: monospaced output in Console on macOS 2021-11-22 06:52:42 -05:00
MarcoFalke
ee7e061563
Merge bitcoin/bitcoin#23557: configure.ac: remove Bashism
cf7292597e configure.ac: remove Bashism (Matt Whitlock)

Pull request description:

  Configure scripts are supposed to adhere to the POSIX shell language. The POSIX `test` builtin does not implement an `==` operator. Bash does, but not all systems have Bash installed as `/bin/sh`. In particular, many systems use the lighter-weight Dash as the default POSIX shell. Dash emits the following error when running `configure`:

  ```
  ./configure: 39065: test: xno: unexpected operator
  ```

  This PR removes the Bashism and restores correct operation with POSIX-compliant shells like Dash.

ACKs for top commit:
  katesalazar:
    ACK cf7292597e.
  laanwj:
    Code review ACK cf7292597e

Tree-SHA512: 578c873fba52e0472baed9e024bddcf58a0e088600bd5854f3011f1f8d135773ad923bb16baefc960d17ecedee9cc980b36aaa70fb32eb9bc7de93f7fe60541d
2021-11-22 11:54:16 +01:00
MarcoFalke
3a36ec83d0
Merge bitcoin/bitcoin#23521: test: refactor: dedup code by taking use of create_block parameters
e57c0eb865 test: refactor: replace OP_1/OP_TRUE magic numbers by constants (Sebastian Falbesoner)
df5d783aef test: refactor: take use of `create_block` txlist parameter (Sebastian Falbesoner)
ae9df4ef93 test: refactor: take use of `create_block` version parameter (or use default) (Sebastian Falbesoner)

Pull request description:

  The helper `create_block` offers two parameters `version` and `txlist` which set the `nVersion` field / extend the `vtx` array of the block, respectively. By taking use of those, we can remove a lot of code, including the recalculation of the merkle root. Both passing txs in string and `CTransaction` format is supported, i.e. we also save potential calls to `tx_from_hex`.
  The PR also contains another commit which replaces magic numbers for OP_TRUE/OP_1 (0x51) with the proper constant from the `script` module.

  Instances setting the block version of 4 explicitely after calling `create_block` are removed, as this is the default since #16333 got merged (see https://github.com/bitcoin/bitcoin/pull/23521#discussion_r751173671).

ACKs for top commit:
  stratospher:
    tested ACK e57c0eb.

Tree-SHA512: a56965168d36b40b84e7f334b00472b82c31e8482c9e2651c97a791abd7fee3b40ca15e943a7acafa3acf172066fdace38bb13240084b789fd6ff4f6e510e23a
2021-11-22 10:55:30 +01:00
João Barbosa
f13a22a631 wallet: Call load handlers without cs_wallet locked
Co-authored-by: Russell Yanofsky <russ@yanofsky.org>
2021-11-22 09:42:36 +00:00
MarcoFalke
47fe7445e7
Merge bitcoin/bitcoin#22364: wallet: Make a tr() descriptor by default
4868c9f1b3 Extract Taproot internal keyid with GetKeyFromDestination (Andrew Chow)
d8abbe119c Mention bech32m in -addresstype and -changetype help (Andrew Chow)
8fb57845ee Create a tr() descriptor bech32m DescriptorScriptPubKeyMan by default (Andrew Chow)
54b3699862 Store pubkeys in TRDescriptor::MakeScripts (Andrew Chow)

Pull request description:

  Make a `tr()` descriptor by default in descriptor wallets so that users will be able to make and use segwit v1 bech32m addresses.

ACKs for top commit:
  MarcoFalke:
    Concept ACK 4868c9f1b3
  Sjors:
    re-utACK 4868c9f1b3
  gruve-p:
    ACK 4868c9f1b3
  meshcollider:
    Concept + code review ACK 4868c9f1b3

Tree-SHA512: e5896e665b8d559f1d759b6582d1bb24f70d4698a57307684339d9fdcdac28ae9bc17bc946a7efec9cb35c130a95ffc36e3961a335124ec4535d77b8d00e9631
2021-11-22 10:01:17 +01:00
fanquake
a2ed33b23b
Merge bitcoin/bitcoin#23564: build: don't use deprecated brew package names
4d83038714 build: don't check for deprecated qt5 package (fanquake)
d0fe9c2180 build: don't check for deprecated berkeley-db4 package (fanquake)

Pull request description:

  Fixes:
  ```bash
  checking for brew... brew
  Warning: Use berkeley-db@4 instead of deprecated berkeley-db4
  ```

  on macOS.

ACKs for top commit:
  mjdietzx:
    Tested ACK 4d83038714 on macOS Big Sur
  hebasto:
    ACK 4d83038714, I have reviewed the code and it looks OK, I agree it can be merged.

Tree-SHA512: 0eeac9e1add652bd101472880c7a6e7688a6429ce98faf920cb7f572a6471ac9af755de7f34047b17ea1d26bfc4517bd0e9f403b966de0ff361bf2942eae6a41
2021-11-22 14:27:06 +08:00
Samuel Dobson
a42923ce21
Merge bitcoin/bitcoin#23348: rpc, wallet: Do not return "keypoololdest" for blank descriptor wallets
ee03c782ba wallet: Make GetOldestKeyPoolTime return nullopt for blank wallets (Hennadii Stepanov)
3e4f069d23 wallet, refactor: Make GetOldestKeyPoolTime return type std::optional (Hennadii Stepanov)

Pull request description:

  The "keypoololdest" field in the `getwalletinfo` RPC response should be used for legacy wallets only.

  Th current implementation (04437ee721) assumes that `CWallet::GetOldestKeyPoolTime()` always return `0` for descriptor wallets. This assumption is wrong for _blank_ descriptor wallets, when `m_spk_managers` is empty. As a result:
  ```
  $ src/bitcoin-cli -signet -rpcwallet=211024-d-DPK getwalletinfo
  {
    "walletname": "211024-d-DPK",
    "walletversion": 169900,
    "format": "sqlite",
    "balance": 0.00000000,
    "unconfirmed_balance": 0.00000000,
    "immature_balance": 0.00000000,
    "txcount": 0,
    "keypoololdest": 9223372036854775807,
    "keypoolsize": 0,
    "keypoolsize_hd_internal": 0,
    "paytxfee": 0.00000000,
    "private_keys_enabled": false,
    "avoid_reuse": false,
    "scanning": false,
    "descriptors": true
  }
  ```

  This PR fixes this issue with direct checking of the `WALLET_FLAG_DESCRIPTORS` flag.

ACKs for top commit:
  lsilva01:
    re-ACK ee03c78
  stratospher:
    ACK ee03c78.
  meshcollider:
    Code review ACK ee03c782ba

Tree-SHA512: 9852f9f8ed5c08c07507274d7714f039bbfda66da6df65cf98f67bf11a600167d0f7f872680c95775399477f4df9ba9fce80ec0cbe0adb7f2bb33c3bd65b15df
2021-11-22 17:08:26 +13:00
Hennadii Stepanov
79e64a053d
Merge bitcoin-core/gui#319: Paste button in Open URI dialog
dbde0558ce gui: Paste button in Open URI dialog (Kristaps Kaupe)

Pull request description:

  Picking up https://github.com/bitcoin/bitcoin/pull/17955, with some review comments addressed.

ACKs for top commit:
  shaavan:
    tACK dbde055
  jarolrod:
    ACK dbde055
  promag:
    Tested ACK dbde0558ce.

Tree-SHA512: db47f19673aff6becd6d1f938cd2aa5dc2291d6e80150d2b99f435674330a5eae678b20e42ef327ea9b05c44925a941fc251e622c73b3585018fc7c1d245edb5
2021-11-21 23:46:21 +02:00
Hennadii Stepanov
06782cf8e7
Merge bitcoin-core/gui#449: Restore "S" accelerator for "Start on system login" option
25a581419d GUI/Options: Restore "S" accelerator for "Start on system login" option (Luke Dashjr)

Pull request description:

  bitcoin-core/gui#416 changed the option assigned to accelerator key "S", but there's no rationale given.

  Best to leave it alone, and give the new option a new accelerator key.

  Since "R" is already taken for Reset, this shifts the new RPC server option to use "P" instead

ACKs for top commit:
  jarolrod:
    ACK 25a581419d
  hebasto:
    ACK 25a581419d, tested on Linux Mint 20.2 (Qt 5.12.8).

Tree-SHA512: 2212aa32572cbcbcce78304ffcb1dcfc65f9d7e2ffd6c6a4b65e4a3ca2a8a7cc7505c28314ad46e0bc13b4e3bb3fc61e7e196356d26354f3689fad71fb688b27
2021-11-21 23:29:19 +02:00
fanquake
19815b096c
Merge bitcoin/bitcoin#23535: PE: check for control flow instrumentation
f31d4bd214 scripts: test for PE control flow instrumentation (fanquake)
0445e1a1a5 build: use -fcf-protection=full when building Windows Boost in depends (fanquake)

Pull request description:

  Addresses the Windows portion of #21888.

  Now that we require GCC 8+ we can unconditionally use `-fcf-protection=full` when building Boost in depends. Building Boost with this option is required so that the `main` provided to `test_bitcoin.exe` has instrumentation.

  Note that the presence of instrumentation does not mean it will be used, as that is determined at runtime by the CPU.
  From the Intel control flow enforcement documentation:

  > The ENDBR32 and ENDBR64 instructions will have the same effect as the NOP instruction on Intel 64 processors that do not support CET. On processors supporting CET, these instructions do not change register or flag state. This allows CET instrumented programs to execute on processors that do not support CET. Even when CET is supported and enabled, these NOP–like instructions do not affect the execution state of the program, do not cause any additional register pressure, and are minimally intrusive from power and performance perspectives.

  Guix Build:
  ```bash
  bash-5.1# find guix-build-$(git rev-parse --short=12 HEAD)/output/ -type f -print0 | env LC_ALL=C sort -z | xargs -r0 sha256sum
  5d41d43c44945810f92193504e8b4c1ac8eb9dfc3b19d0ab8d53bff0c8443a2a  guix-build-f31d4bd21401/output/aarch64-linux-gnu/SHA256SUMS.part
  8edb0e01b7bc2d646b62e4e35b1867ee940acca18a02ee609c52c4f7680de5ae  guix-build-f31d4bd21401/output/aarch64-linux-gnu/bitcoin-f31d4bd21401-aarch64-linux-gnu-debug.tar.gz
  1a06306f365e8329cea0eba7436085d30fe59c244a888ecb6407faf5110c57ab  guix-build-f31d4bd21401/output/aarch64-linux-gnu/bitcoin-f31d4bd21401-aarch64-linux-gnu.tar.gz
  b5b74926ff9ff597d66b92d33926df34c3e1c6f92b863850a6fb1beea019fd6e  guix-build-f31d4bd21401/output/arm-linux-gnueabihf/SHA256SUMS.part
  743b5c5cec7881b032520a309ae2399ec8dadb82eb9da424aefd646f9252ff1d  guix-build-f31d4bd21401/output/arm-linux-gnueabihf/bitcoin-f31d4bd21401-arm-linux-gnueabihf-debug.tar.gz
  1f218a954b65b352c80922ea6b61276e8e7050ad8bdd9d7610049b87c66069e5  guix-build-f31d4bd21401/output/arm-linux-gnueabihf/bitcoin-f31d4bd21401-arm-linux-gnueabihf.tar.gz
  c164de32c6cc24ec247b5a8de7f1a5442369d5804a4b2a3e0d9dc4ab4e5ec401  guix-build-f31d4bd21401/output/dist-archive/bitcoin-f31d4bd21401.tar.gz
  feb0a055eabd6ddd2ce0dac954f5f5886044800a7535b8f78c7dfbd9c243512c  guix-build-f31d4bd21401/output/powerpc64-linux-gnu/SHA256SUMS.part
  0b6e877b5de7b69a5d474469d666a536cd8f6f6e865230a7763f62426357ae91  guix-build-f31d4bd21401/output/powerpc64-linux-gnu/bitcoin-f31d4bd21401-powerpc64-linux-gnu-debug.tar.gz
  fb38bcfd319af1e8bace03f240b32592940ac3efe15d23fd39353f36f9ae3838  guix-build-f31d4bd21401/output/powerpc64-linux-gnu/bitcoin-f31d4bd21401-powerpc64-linux-gnu.tar.gz
  15fffe69f33297ef30a8b2eb8bdef8564f030920bed6d5ff56d6e7b8bef9c199  guix-build-f31d4bd21401/output/powerpc64le-linux-gnu/SHA256SUMS.part
  f847b92c7c098bf8a4f6c84714270c173d4323e2d3025dd8f4444ee921a0bdd0  guix-build-f31d4bd21401/output/powerpc64le-linux-gnu/bitcoin-f31d4bd21401-powerpc64le-linux-gnu-debug.tar.gz
  9b8b6e12dd8a1a3ba0f5522c2a22f2bd60d5473880fa22d42e91364a08e48396  guix-build-f31d4bd21401/output/powerpc64le-linux-gnu/bitcoin-f31d4bd21401-powerpc64le-linux-gnu.tar.gz
  6f0f3b603b35c751a364b77ca94477085cf54a1c5d811dd3407dd1b86b2e3c64  guix-build-f31d4bd21401/output/riscv64-linux-gnu/SHA256SUMS.part
  69f1a93a8d698e68d8baf81a6c871f9eab0446ec352f7709971293b0b898f128  guix-build-f31d4bd21401/output/riscv64-linux-gnu/bitcoin-f31d4bd21401-riscv64-linux-gnu-debug.tar.gz
  b71d415f30a893fada9d6609fab309a3c099716462c795e444bf49bd8631ea53  guix-build-f31d4bd21401/output/riscv64-linux-gnu/bitcoin-f31d4bd21401-riscv64-linux-gnu.tar.gz
  6f842bc5483e867b8d1c769d1faa19b9f08bc0fa28d027fe0fac108858a4926e  guix-build-f31d4bd21401/output/x86_64-apple-darwin19/SHA256SUMS.part
  a9a43aa4aade18bf606493009229ad3239af7365594ef60a0c39789d870f159d  guix-build-f31d4bd21401/output/x86_64-apple-darwin19/bitcoin-f31d4bd21401-osx-unsigned.dmg
  26891e7d258ec8a85344a0a888fd4159378d747a2a77fb8d9e5655f1a3ad4aee  guix-build-f31d4bd21401/output/x86_64-apple-darwin19/bitcoin-f31d4bd21401-osx-unsigned.tar.gz
  a2578799da61a3f1b6cd047aa5641e050de2e810162ec8596931cec12d1cbb56  guix-build-f31d4bd21401/output/x86_64-apple-darwin19/bitcoin-f31d4bd21401-osx64.tar.gz
  571803809f358ed5ef1f1ed6b6266b54bd33b0e6308c53ddae967e53af930a46  guix-build-f31d4bd21401/output/x86_64-linux-gnu/SHA256SUMS.part
  ea45499e8d2a2f0791f29732a5f169fb97525d6d8adcdfa1c160e950944ce8fe  guix-build-f31d4bd21401/output/x86_64-linux-gnu/bitcoin-f31d4bd21401-x86_64-linux-gnu-debug.tar.gz
  ba5b63e64267d7685de77e3063e24659f223d4b4c42d43f42fb15e716afcfe78  guix-build-f31d4bd21401/output/x86_64-linux-gnu/bitcoin-f31d4bd21401-x86_64-linux-gnu.tar.gz
  b4ba9d8cfd6999c0039890330afab5d5b1faf5ded33dcbebc5e73d8dae308246  guix-build-f31d4bd21401/output/x86_64-w64-mingw32/SHA256SUMS.part
  3aa5cf722341b79aca78ea11fe4e65e0c642997b0214d3893a86a2e808afbe87  guix-build-f31d4bd21401/output/x86_64-w64-mingw32/bitcoin-f31d4bd21401-win-unsigned.tar.gz
  b48402235751f15f09fad64b7bd42f851a64a9744e47ed6888b4e9754fb0d3d9  guix-build-f31d4bd21401/output/x86_64-w64-mingw32/bitcoin-f31d4bd21401-win64-debug.zip
  e33183aa7316f399621fd7b1c258d850294cdaaebb505364410a399467c0943b  guix-build-f31d4bd21401/output/x86_64-w64-mingw32/bitcoin-f31d4bd21401-win64-setup-unsigned.exe
  4baba568a8a93d04086055df512d680c8365d42779123c56bccee41e4de33e5e  guix-build-f31d4bd21401/output/x86_64-w64-mingw32/bitcoin-f31d4bd21401-win64.zip
  ```

ACKs for top commit:
  laanwj:
    Code review ACK f31d4bd214

Tree-SHA512: fbed1fa4e9317677e24ebc6f9d95ef791e2182ad709b3629ed35e373d9f8d26bbf3dee6f78a4bdf3f7ae2c05fe5fd744c0753298ee1387d9b0c719a09717b522
2021-11-21 20:13:37 +08:00
fanquake
4d83038714
build: don't check for deprecated qt5 package
Use qt@5 instead.
2021-11-21 19:34:43 +08:00
fanquake
d0fe9c2180
build: don't check for deprecated berkeley-db4 package
Fixes:
```bash
checking for brew... brew
Warning: Use berkeley-db@4 instead of deprecated berkeley-db4
```
2021-11-21 19:34:43 +08:00
MarcoFalke
368831371d
Merge bitcoin/bitcoin#23558: test: run rpc-generateblock.py even with wallet disabled
1e86ff7941 test: run rpc-generateblock.py even with wallet disabled (Darius Parvin)

Pull request description:

  Run rpc_generateblock.py test even when the wallet is disabled, as discussed in #20078.

  This PR picked up from where #20808 left off, started by @ nginocchio. Since then, there have been many improvements to `MiniWallet`, making this PR more straightforward.

  L23 makes use of `MiniWallet.rescan_utxos()` to add the pre-mined block utxos (when `self.setup_clean_chain` is not set to `True`), rather than generating new blocks during the test.

ACKs for top commit:
  mjdietzx:
    Tested ACK 1e86ff7941

Tree-SHA512: 4285f61516dd53a08004eeea26d58f45b4c1c67f5ca4c94ff1bc9fc7e50f486de2e033a8b4aaf67cb4c33d73aa929362e18dc75d5c7951cbf58120b5fb1de555
2021-11-21 08:28:09 +01:00
fanquake
cf06c9b35c
Merge bitcoin/bitcoin#23555: util: Add missing fstatfs to syscall sandbox
fade4b3aca util: Add missing fstatfs to syscall sandbox (MarcoFalke)

Pull request description:

  Looks like this is used by boost 1.77 in `./test/functional/wallet_backup.py --descriptors`.

  Fixes https://github.com/bitcoin/bitcoin/issues/23554

ACKs for top commit:
  fanquake:
    ACK fade4b3aca - reproduced the failure on Tumbleweed:

Tree-SHA512: cd7381e87c7cb4596da0b9e36c8776a3ef19f5aeb29ee9db1867657c4c1f071485ffea0fba0af950f10a16a8bdb0a0c70ffcc5be802e82d60882e00f7d2009ac
2021-11-21 15:24:27 +08:00
Darius Parvin
1e86ff7941 test: run rpc-generateblock.py even with wallet disabled 2021-11-20 00:57:35 -08:00
fanquake
80ae64db6b
Merge bitcoin/bitcoin#23553: test: Remove sanitizer suppression implicit-signed-integer-truncation:netaddress.cpp
fae5fec0fe test: Remove sanitizer suppression implicit-signed-integer-truncation:netaddress.cpp (MarcoFalke)

Pull request description:

  This reverts commit fa865287e5.

  This was fixed in commit efd6f904c7.

ACKs for top commit:
  vasild:
    ACK fae5fec0fe

Tree-SHA512: 3bebf1babd5c68cbb2506bcab9b8e9ffed8697213cf66190484748741f05c59b847a103be171360f7fd6ddb57dfd86ed34a123f72860b76e533ed46bb53a4852
2021-11-20 13:40:37 +08:00
Matt Whitlock
cf7292597e configure.ac: remove Bashism 2021-11-19 14:26:58 -05:00
MarcoFalke
fade4b3aca
util: Add missing fstatfs to syscall sandbox 2021-11-19 17:18:59 +01:00
MarcoFalke
fae5fec0fe
test: Remove sanitizer suppression implicit-signed-integer-truncation:netaddress.cpp
This reverts commit fa865287e5.

This was fixed in commit efd6f904c7.
2021-11-19 16:45:43 +01:00
MarcoFalke
fa00447442
scripted-diff: Use clang-tidy syntax for C++ named arguments
-BEGIN VERIFY SCRIPT-
 perl -0777 -pi -e 's:((\(|\{|,)(\n| )*)\/\* ?([^=* ]+) ?\*\/ ?:\1/*\4=*/:g' $( git ls-files ./src/test ./src/wallet/test )
-END VERIFY SCRIPT-
2021-11-19 12:41:47 +01:00
MarcoFalke
fae13c3989
doc: Use clang-tidy comments in crypto_tests
Also, fix argument name for FastRandomContext.
2021-11-19 12:40:13 +01:00
Luke Dashjr
cd8d156354 Bugfix: RPC/mining: Fail properly in estimatesmartfee if smart fee data is unavailable 2021-11-18 18:35:45 +00:00
MarcoFalke
fa186eb7f4
Remove strtol in torcontrol 2021-11-18 18:13:21 +01:00
brunoerg
988024fe37 test: add check_node_connections in util 2021-11-18 13:40:43 -03:00
Vasil Dimov
f52b6b2d9f
net: split CConnman::SocketHandler()
`CConnman::SocketHandler()` does 3 things:
1. Check sockets for readiness
2. Process ready listening sockets
3. Process ready connected sockets

Split the processing (2. and 3.) into separate methods to make the code
easier to grasp.

Also, move the processing of listening sockets after the processing of
connected sockets to make it obvious that there is no dependency and
also explicitly release the snapshot before dealing with listening
sockets - it is only necessary for the connected sockets part.
2021-11-18 13:39:10 +01:00
Vasil Dimov
c7eb19ec83
style: remove unnecessary braces
They were needed to define the scope of `LOCK(cs_vNodes)` which was
removed in the previous commit. Re-indent in a separate commit to ease
review (use `--ignore-space-change`).
2021-11-18 13:39:09 +01:00