Commit graph

31636 commits

Author SHA1 Message Date
Hennadii Stepanov
a3f61676e8
test: Make more shell scripts verifiable by the shellcheck tool 2021-11-28 14:08:54 +02:00
Arnab Sen
2bc51c5c32 [tracing] tracepoints to utxocache add, spent and uncache
Signed-off-by: Arnab Sen <arnabsen1729@gmail.com>
2021-11-28 11:51:21 +05:30
Arnab Sen
a26e8eef43 [tracing] tracepoint for utxocache flushes
Signed-off-by: Arnab Sen <arnabsen1729@gmail.com>
2021-11-28 11:34:44 +05:30
fanquake
4f8b1f8759
Merge bitcoin/bitcoin#23608: test: fix feature_rbf.py --descriptors and add to test runner
b79dbe86a9 test: add feature_rbf.py --descriptors to test_runner.py (Sebastian Falbesoner)
166f8ec28e test: always rescan after importing private keys in `init_wallet` helper (Sebastian Falbesoner)

Pull request description:

  The functional test feature_rbf.py currently fails on master branch, if descriptor wallets are used (argument `--descriptors`). This is due to the fact that in this case, a call to the helper `init_wallet`

  111c3e06b3/test/functional/test_framework/test_framework.py (L428-L434)

  creates a wallet without rescanning the blockchain; the test framework maps the importprivkey RPC calls to the importdescriptors RPC without rescanning by default (timestamp='now'). Fix this by always calling with `rescan=True`, which calls importdescriptors with timestamp=0. Also add `feature_rbf.py --descriptors` to the list of the test runner's calls.

  Fixes #23563.

ACKs for top commit:
  mjdietzx:
    ACK b79dbe86a9

Tree-SHA512: a3f3f7a4077066e3c910919d3b5e04bc6b580c1e0a06e9a2fc258950eaea5e59c0f805c8f00432aea722609f2f7e41eebfab653471b76729c5a316825a3d8c86
2021-11-28 09:51:45 +08:00
fanquake
4aa06f9447
Merge bitcoin/bitcoin#23600: doc: Tidy up nMinDiskSpace comment
fa5a886fa3 doc: Tidy up nMinDiskSpace comment (MarcoFalke)

Pull request description:

  nMinDiskSpace was removed in commit 04cca33

  Also, remove incorrect doxygen comment. See https://doxygen.bitcoincore.org/class_c_chain.html#aeb563751f7362d4308c7c2cb35b834a5

ACKs for top commit:
  theStack:
    ACK fa5a886fa3

Tree-SHA512: d57a6a0f0a66615bebb3cca19dc831cca38be0f18a580bb88e774384c55ccc545279b6d115b86fda70528a86630065393fb692fc2997ef87f97eec2d162808bb
2021-11-28 09:42:52 +08:00
Samuel Dobson
200d97faf2
Merge bitcoin/bitcoin#22868: wallet: Call load handlers without cs_wallet locked
f13a22a631 wallet: Call load handlers without cs_wallet locked (João Barbosa)

Pull request description:

  Don't have `cs_wallet` locked while calling each `context.wallet_load_fns`. A load handler can always lock `cs_wallet` if needed.

  The lock was added in 1c7e25db0c to satisfy TSAN. With 44c430ffac most of the code requiring the lock is in `CWallet::AttachChain`. A comment is added to warn about wallets_mutex and cs_wallet lock ordering.

ACKs for top commit:
  meshcollider:
    re-utACK f13a22a631
  ryanofsky:
    Code review ACK f13a22a631. Only change since last review is adding a lock order comment
  jonatack:
    ACK f13a22a631

Tree-SHA512: d51976c3aae4bebc2d1997c88edff712d21fc5523801f5614062a10f826e164579973aeb1981bb1cbc243ecff6af3250362f544c02a79e5d135cbbca1704be62
2021-11-27 22:30:46 +13:00
Sebastian Falbesoner
b79dbe86a9 test: add feature_rbf.py --descriptors to test_runner.py 2021-11-26 17:16:08 +01:00
Sebastian Falbesoner
166f8ec28e test: always rescan after importing private keys in init_wallet helper
This fixes the functional test feature_rbf.py for descriptor wallets.
2021-11-26 17:10:55 +01:00
MarcoFalke
fae239208d
wallet: Split signmessage from rpcwallet
Can be reviewed with --color-moved=dimmed-zebra --color-moved-ws=ignore-all-space
2021-11-26 14:50:49 +01:00
fanquake
111c3e06b3
Merge bitcoin/bitcoin#23594: build: don't set PORT=no in config.site
05cdceb19d build: don't set PORT=no in config.site (fanquake)

Pull request description:

  This should have been a part of dropping macports support in #15175.

ACKs for top commit:
  hebasto:
    ACK 05cdceb19d, I have reviewed the code and it looks OK, I agree it can be merged.

Tree-SHA512: 278b2f308e55aad5524530e654ac08462714676b71e01d31e5f152f69e02f916afc553510ac8352ed0bb0184f7fdb2ee7038ab5ac2de6923f366829859e0b6ee
2021-11-26 19:03:48 +08:00
Vasil Dimov
6c9ee92ffe
net: don't check if the listening socket is valid
Listening sockets in `CConnman::vhListenSocket` are always valid
(underlying file descriptor is not `INVALID_SOCKET`).
2021-11-26 11:58:05 +01:00
MarcoFalke
fa5a886fa3
doc: Tidy up nMinDiskSpace comment
nMinDiskSpace was removed in commit
04cca33094

Also, remove incorrect doxygen comment.
See https://doxygen.bitcoincore.org/class_c_chain.html#aeb563751f7362d4308c7c2cb35b834a5
2021-11-26 11:17:43 +01:00
fanquake
2a492d4ce5
Merge bitcoin/bitcoin#23598: contrib: Specify wb mode when creating mac sdk
655d52a0cd contrib: Specify wb mode when creating mac sdk (João Barbosa)

Pull request description:

  Fix the warning:
  ```
  ./contrib/macdeploy/gen-sdk:84: FutureWarning: GzipFile was opened for writing, but this will change in future Python releases.  Specify the mode argument for opening it for writing.
  ```

ACKs for top commit:
  fanquake:
    Tested ACK 655d52a0cd with Python 3.10.

Tree-SHA512: 095cd301f211531a8b8f50e7915fe13c7ab0b278fb23dc50a03625cfae9e2fd7a0d8c315fced4af3011552e3e455ce562b7f717a0ed096c4433ddcf24f22b2c9
2021-11-26 16:48:07 +08:00
MarcoFalke
16d698cdcf
Merge bitcoin/bitcoin#23517: scripted-diff: Move miner to src/node
fa4e09924b refactor: Replace validation.h include with forward-decl in miner.h (MarcoFalke)
fa0739a7d3 style: Sort file list after rename (MarcoFalke)
fa53e3a58c scripted-diff: Move miner to src/node (MarcoFalke)

Pull request description:

  It is impossible to run the miner without a node (validation, chainstate, mempool, rpc, ...). Also, the module is in the node library. Thus, it should be moved to `src/node`.

  Also, replace the `validation.h` include in the header with a forward-declaration.

ACKs for top commit:
  theStack:
    Code-review ACK fa4e09924b

Tree-SHA512: 791e6caa5839d8dc83b0f58f3f49bc0a7e3c1710822e8a44dede254c87b6f7531a0586fb95e8a067c181457a3895ad6041718aa2a2fac64cfc136bf04bb851d5
2021-11-26 09:03:39 +01:00
João Barbosa
655d52a0cd contrib: Specify wb mode when creating mac sdk
Fix the warning:
```
./contrib/macdeploy/gen-sdk:84: FutureWarning: GzipFile was opened for writing, but this will change in future Python releases.  Specify the mode argument for opening it for writing.
```
2021-11-25 21:38:34 +00:00
W. J. van der Laan
14fe4dbd4c
Merge bitcoin/bitcoin#23579: script install_db4.sh check for patch command before continuing to install db4
7bb8eb0bc3 script install_db4.sh added check for patch command (Nathan Garabedian)

Pull request description:

  First contribution.  I've read the CONTRIBUTING guide and hope I'm doing this correctly, but please kindly point out anything I should do differently.

  I found while running the contrib/install_db4.sh patch that it would fail suddenly with "patch: command not found".  I'd rather see it fail early before doing any work, allow me to install the `patch` command, and then run again.  (CentOS Linux) Here's a PR proposed to fix it.

  error message:
  ```
  ...
  db-4.8.30.NC/txn/txn_rec.c
  db-4.8.30.NC/txn/txn_region.c
  db-4.8.30.NC/txn/txn_stat.c
  db-4.8.30.NC/txn/txn_util.c
  ./contrib/install_db4.sh: line 71: patch: command not found
  ```

ACKs for top commit:
  laanwj:
    Code review and tested ACK 7bb8eb0bc3

Tree-SHA512: f0c59ec509dff6637c41eec2923fe708456c3a7ae04495b12c5492681a1f95d1d9a643a2649df13ba8e6ac708680c627657b6989b62eff63be021e92e1d7c4a8
2021-11-25 21:28:28 +01:00
Hennadii Stepanov
6c7b8837d3
ci: Always run merge_base_script first for consistency 2021-11-25 21:23:43 +02:00
Hennadii Stepanov
3ad5ace351
ci: Revamp Android SDK cache, and update it timely 2021-11-25 21:23:34 +02:00
W. J. van der Laan
cf24152596
Merge bitcoin/bitcoin#21206: refactor: Make CWalletTx sync state type-safe
d8ee8f3cd3 refactor: Make CWalletTx sync state type-safe (Russell Yanofsky)

Pull request description:

  Current `CWalletTx` state representation makes it possible to set inconsistent states that won't be handled correctly by wallet sync code or serialized & deserialized back into the same form.

  For example, it is possible to call `setConflicted` without setting a conflicting block hash, or `setConfirmed` with no transaction index. And it's possible update individual `m_confirm` and `fInMempool` data fields without setting an overall consistent state that can be serialized and handled correctly.

  Fix this without changing behavior by using `std::variant`, instead of an enum and collection of fields, to represent sync state, so state tracking code is safer and more legible.

  This is a first step to fixing state tracking bugs https://github.com/bitcoin-core/bitcoin-devwiki/wiki/Wallet-Transaction-Conflict-Tracking, by adding an extra margin of safety that can prevent new bugs from being introduced as existing bugs are fixed.

ACKs for top commit:
  laanwj:
    re-ACK d8ee8f3cd3
  jonatack:
    Code review ACK d8ee8f3cd3

Tree-SHA512: b9f15e9d99dbdbdd3ef7a76764e11f66949f50e6227e284126f209e4cb106af6d55e9a9e8c7d4aa216ddc92c6d5acc6f4aa4746f209bbd77f03831b51a2841c3
2021-11-25 19:41:53 +01:00
Hennadii Stepanov
e988bc7f2e
ci: Make macOS SDK cache independent, and update it timely 2021-11-25 20:39:07 +02:00
MarcoFalke
fa2c991ec9
refactor: Use underlying type of isminetype for isminefilter 2021-11-25 14:56:30 +01:00
fanquake
05cdceb19d
build: don't set PORT=no in config.site
This should have been a part of dropping macports support in #15175.
2021-11-25 21:40:50 +08:00
fanquake
681b25e3cd
Merge bitcoin/bitcoin#23152: build: add --enable-lto configuration option
68e5aafde3 build: add `--enable-lto` configuration option (fanquake)

Pull request description:

  It's been 5 years since using LTO was first suggested for use when building Bitcoin Core, and it's time to revisit it again. Compilers, and their LTO implementations, have matured, and Bitcoin Core has come a long way in terms of pruning dependencies which may have proved troublesome (i.e Boost previously had issues when using LTO). We'll have even less Boost code after moving to `std::filesystem` (#20744).

  Experimenting with LTO came up on IRC last night:
  > sipa: jamesob: i'm interested in knowing whether "-flto" and/or "-fdata-sections -ffunction-sections -Wl,--gc-sections" are possible/beneficial with our current compiler suite; what would be a good way to have your test infrastructure benchmark things?

  So this PR just adds the bare minimum to make it easier to configure, compile and perform some bench-marking using `-flto`. This PR doesn't do anything depends wise, however if we decide this is what we want to do, I'll expand the changes here.

  I had previously had a PR open (#18605) to perform link time garbage collection (`-ffunction-sections -fdata-sections` & `-Wl,--gc-sections`), however moving straight to using LTO would be preferable.

  Note that our minimum required set of compilers, GCC 8.1 and Clang 7, all support the `-flto` option.

  Related #18579.
  Previous discussion: #10616, #14277.
  Previous related PRs: #10800 (`-flto`), #16791 (ThinLTO).

  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
  1f3a7c5be4169aaa444b481d3e65a7bb72da9007fee6e6c416ded2e70f97374b  guix-build-68e5aafde3e8/output/aarch64-linux-gnu/SHA256SUMS.part
  fa8f4cf223d9aaf0b2c1ef55ce61256a19cd1ad7f42b99d0b98c9a52fe6ad8ba  guix-build-68e5aafde3e8/output/aarch64-linux-gnu/bitcoin-68e5aafde3e8-aarch64-linux-gnu-debug.tar.gz
  9a9967078cd1849b4e85db619e1f55d305c6d44e9e013067c0e8d62c1ba54087  guix-build-68e5aafde3e8/output/aarch64-linux-gnu/bitcoin-68e5aafde3e8-aarch64-linux-gnu.tar.gz
  18c71f30722102baaf3dfda67f7c7aac38723510b142e8df8ee7063c5d499368  guix-build-68e5aafde3e8/output/arm-linux-gnueabihf/SHA256SUMS.part
  0854cc0d17c045a118df2a24e4cf36d727e7e7e2dea37c2492ee21b71cb79b4b  guix-build-68e5aafde3e8/output/arm-linux-gnueabihf/bitcoin-68e5aafde3e8-arm-linux-gnueabihf-debug.tar.gz
  215256897dde4e8412ed60473376c694a80c5479fb08039107fb62435f2816ef  guix-build-68e5aafde3e8/output/arm-linux-gnueabihf/bitcoin-68e5aafde3e8-arm-linux-gnueabihf.tar.gz
  5fad0d9d12bc514ec46ed5d66fd29b7da1376a4a69c3b692936f1ab2356e2f85  guix-build-68e5aafde3e8/output/dist-archive/bitcoin-68e5aafde3e8.tar.gz
  4f32989d4ab1946048ca7caee9a983fa875be262282562f5a3e040f4bf92158e  guix-build-68e5aafde3e8/output/powerpc64-linux-gnu/SHA256SUMS.part
  ae45df309ae8ada52891efac0a369a69fed4ab93847a7bc4150a62230df4c8d7  guix-build-68e5aafde3e8/output/powerpc64-linux-gnu/bitcoin-68e5aafde3e8-powerpc64-linux-gnu-debug.tar.gz
  0ced227de15cb578567131271e2effe80681b4d7a436c92bf1caec735a576fa4  guix-build-68e5aafde3e8/output/powerpc64-linux-gnu/bitcoin-68e5aafde3e8-powerpc64-linux-gnu.tar.gz
  26fc5d2ccc1bc17ee0a146cacada6f4909d90c136ae640c8337332adce414ee0  guix-build-68e5aafde3e8/output/powerpc64le-linux-gnu/SHA256SUMS.part
  9956b544d90a62a8ba9fc9dc6b6b7f0efe193357332ec19e88053a89d4aab37e  guix-build-68e5aafde3e8/output/powerpc64le-linux-gnu/bitcoin-68e5aafde3e8-powerpc64le-linux-gnu-debug.tar.gz
  be8e39ceea1d36086ce5fa93bfb138c68d3bdf0dd6950b192dfa27a65cce3836  guix-build-68e5aafde3e8/output/powerpc64le-linux-gnu/bitcoin-68e5aafde3e8-powerpc64le-linux-gnu.tar.gz
  a7755edc394972885c4c77a7798007e5ba4126b177c4ff6224275c4fb8f3b1c4  guix-build-68e5aafde3e8/output/riscv64-linux-gnu/SHA256SUMS.part
  b6d252993d8aae7582ad6385fe53c61c54c284c68ece6cb2b2d1ac9554e06139  guix-build-68e5aafde3e8/output/riscv64-linux-gnu/bitcoin-68e5aafde3e8-riscv64-linux-gnu-debug.tar.gz
  bb4860f3bbd815f800333124ff901d880741792ab47097f49bda3a6931144da0  guix-build-68e5aafde3e8/output/riscv64-linux-gnu/bitcoin-68e5aafde3e8-riscv64-linux-gnu.tar.gz
  3dd17deed5c5935fb28b62dfc7afca5caab0d67862cdcbf3337edae73e1d0c4c  guix-build-68e5aafde3e8/output/x86_64-apple-darwin19/SHA256SUMS.part
  fa2d68c54fda0816188c81ce2201a77340b82645da2ffe412526f92c297a82df  guix-build-68e5aafde3e8/output/x86_64-apple-darwin19/bitcoin-68e5aafde3e8-osx-unsigned.dmg
  f6e5accdcd201f522b6426e4d8cc9b3643d4d43a57d268fa0e79ea9a34cfac01  guix-build-68e5aafde3e8/output/x86_64-apple-darwin19/bitcoin-68e5aafde3e8-osx-unsigned.tar.gz
  4e5a127df957d1c73b65925d685f6620e7bc5667efcb6dcd98be76effc22fc12  guix-build-68e5aafde3e8/output/x86_64-apple-darwin19/bitcoin-68e5aafde3e8-osx64.tar.gz
  56ccd216a69acafacbdc6bae0bdcc1faa50b6a51be1aebfa7068206c88b3241a  guix-build-68e5aafde3e8/output/x86_64-linux-gnu/SHA256SUMS.part
  77b93dd5fad322636853e5b0244ffafd97cc97f3b4b4ee755d5f830b75d77d13  guix-build-68e5aafde3e8/output/x86_64-linux-gnu/bitcoin-68e5aafde3e8-x86_64-linux-gnu-debug.tar.gz
  1feda932fc127b900316a232432b91e46e57ee12a81e12a7d888fdc3296219c1  guix-build-68e5aafde3e8/output/x86_64-linux-gnu/bitcoin-68e5aafde3e8-x86_64-linux-gnu.tar.gz
  aa7c53ab4164b3736049065c3c24391fc5bd7f26b4bda4aa877c378f0636a125  guix-build-68e5aafde3e8/output/x86_64-w64-mingw32/SHA256SUMS.part
  5e76148e67aef7e91e70074bfadc08e94373449ac3b966f4343b04d230c778fd  guix-build-68e5aafde3e8/output/x86_64-w64-mingw32/bitcoin-68e5aafde3e8-win-unsigned.tar.gz
  34123e3d818beeb70113caeda66945bc7cb9d9e987515d5b149bd17b4b38da90  guix-build-68e5aafde3e8/output/x86_64-w64-mingw32/bitcoin-68e5aafde3e8-win64-debug.zip
  2bba7f40a2b23c6ea3d47c4f564ab54201bf27f7f57103a98cc9bceea4e70c4d  guix-build-68e5aafde3e8/output/x86_64-w64-mingw32/bitcoin-68e5aafde3e8-win64-setup-unsigned.exe
  0e7e124144af4a92a4344cf70a3b7c06fbd2b8782aee7ede7263893afa3a5ef0  guix-build-68e5aafde3e8/output/x86_64-w64-mingw32/bitcoin-68e5aafde3e8-win64.zip
  ```

ACKs for top commit:
  laanwj:
    Code review ACK 68e5aafde3

Tree-SHA512: 5c25249cc178b9d54159e268390c974b739df9458d773e23c14b14d808f87f7afe314058b3c068601a9132042321973b0c9b6f81becb925665eca2738ae9a613
2021-11-25 20:15:00 +08:00
fanquake
0d7ecd5bef
Merge bitcoin/bitcoin#23583: build, qt, macOS: Don't hard-code x86_64 as the arch when using qmake
d0204199d6 Revert "doc: Install Rosetta on M1-macOS for qt in depends" (Hennadii Stepanov)
f6e2781675 build, qt, macOS: Don't pass -device-option when building natively (Hennadii Stepanov)
667f0689ca build, qt, macOS: Don't hard-code x86_64 as the arch when using qmake (Hennadii Stepanov)

Pull request description:

  On master (4018e23aa7) the Qt build system hard-coded the x86_64 as the architecture when using qmake.

  This means that compiling the `qt` package on M1 Apple Silicon for the same system, i.e., without providing the `HOST` variable,—that is supposed to be compiled natively—is a cross-compiling actually:
  ```
  % make -C depends qt_configured
  ...
  Configure summary:

  Building on: macx-clang (x86_64, CPU features: cx16 mmx sse sse2 sse3 ssse3 sse4.1)
  Building for: macx-clang (arm64, CPU features: neon crc32)
  Target compiler: clang (Apple) 13.0.0
  Configuration: cross_compile largefile neon precompile_header silent release c++11 c++14 c++1z reduce_exports static stl
  ...
  ```

  Also this bug caused another [issue](https://github.com/bitcoin/bitcoin/pull/22402) which currently is worked around by installing Rosetta.

  With this PR it is no longer needed to have Rosetta installed on M1-based macOS, and:
  ```
  % make -C depends qt_configured
  ...
  Configure summary:

  Build type: macx-clang (arm64, CPU features: neon crc32)
  Compiler: clang (Apple) 13.0.0
  Configuration: largefile neon precompile_header silent release c++11 c++14 c++1z reduce_exports static stl
  ...
  ```

ACKs for top commit:
  promag:
    Tested ACK d0204199d6
  fanquake:
    ACK d0204199d6

Tree-SHA512: 2fcd88d172286b7d22ec7ea7ce0939b012211c0160df56de2f4cb69e99743c71df6b6ff4777c1722ec22b974f48a77cc22e7c14d7d64d02c4f82ac22bafe4087
2021-11-25 20:06:40 +08:00
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
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