Commit Graph

29750 Commits

Author SHA1 Message Date
Hennadii Stepanov
cdb41d5573
doc: Install Rosetta on M1-macOS for qt in depends 2021-07-05 13:42:14 +03:00
fanquake
c609e10545
Merge bitcoin/bitcoin#22292: bench, doc: benchmarking updates and fixups
d8513fe411 doc: update doc/benchmarking.md (Jon Atack)
84e2d5b781 bench: bench_bitcoin.cpp help fixups (Jon Atack)
10f4ce2078 bench: bench.h fixes and improvements (Jon Atack)

Pull request description:

  Fixups and updates I noticed while writing benchmarks for #22284.

ACKs for top commit:
  za-kk:
    ACK d8513fe411
  theStack:
    ACK d8513fe411 🚤

Tree-SHA512: d494956b5d6a3329e98e8b6f4405a10613b8fce51a04bbf4493d8b3497b8d5b177c1a9a3eeb828796eb4edb92b0ace769595151e223671c0dc8f09bcf631ebb5
2021-07-05 08:47:36 +08:00
MarcoFalke
7a49fdc581
Merge bitcoin/bitcoin#22388: ci: use Ubuntu 20.04 as the default Docker container
7fc1e14ce6 ci: use Ubuntu 20.04 as the default Docker container (fanquake)

Pull request description:

  All but 2 of the Ubuntu CIs (native qt5 & nowallet) are already using 20.04 or 21.04.

ACKs for top commit:
  MarcoFalke:
    cr ACK 7fc1e14ce6

Tree-SHA512: f35d79a87af6c6955695b5e627884f94aed19bafaed4657d03ef4db66cf47cae5311464bb39961570140325652941283b9d88dff862776e8becfff9130162917
2021-07-02 07:29:12 +02:00
fanquake
7fc1e14ce6
ci: use Ubuntu 20.04 as the default Docker container
All but 2 of the Ubuntu CIs are already using 20.04 or 21.04.
2021-07-02 10:29:03 +08:00
MarcoFalke
ddc6979b8b
Merge bitcoin/bitcoin#19438: Introduce deploymentstatus
e48826ad87 tests: remove ComputeBlockVersion shortcut from versionbits tests (Anthony Towns)
c5f36725e8 [refactor] Move ComputeBlockVersion into VersionBitsCache (Anthony Towns)
4a69b4dbe0 [move-only] Move ComputeBlockVersion from validation to versionbits (Anthony Towns)
0cfd6c6a8f [refactor] versionbits: make VersionBitsCache a full class (Anthony Towns)
8ee3e0bed5 [refactor] rpc/blockchain.cpp: SoftForkPushBack (Anthony Towns)
92f48f360d deploymentinfo: Add DeploymentName() (Anthony Towns)
ea68b3a572 [move-only] Rename versionbitsinfo to deploymentinfo (Anthony Towns)
c64b2c6a0f scripted-diff: rename versionbitscache (Anthony Towns)
de55304f6e [refactor] Add versionbits deployments to deploymentstatus.h (Anthony Towns)
2b0d291da8 [refactor] Add deploymentstatus.h (Anthony Towns)
eccd736f3d versionbits: Use dedicated lock instead of cs_main (Anthony Towns)
36a4ba0aaa versionbits: correct doxygen comments (Anthony Towns)

Pull request description:

  Introduces helper functions to make it easy to bury future deployments, along the lines of the suggestion from [11398](https://github.com/bitcoin/bitcoin/pull/11398#issuecomment-335599326) "I would prefer it if a buried deployment wouldn't require all code paths that check the BIP9 status to require changing".

  This provides three functions: `DeploymentEnabled()` which tests if a deployment can ever be active, `DeploymentActiveAt()` which checks if a deployment should be enforced in the given block, and `DeploymentActiveAfter()` which checks if a deployment should be enforced in the block following the given block, and overloads all three to work both with buried deployments and versionbits deployments.

  This adds a dedicated lock for the versionbits cache, which is acquired internally by the versionbits functions, rather than relying on `cs_main`. It also moves moves versionbitscache into deploymentstatus to avoid a circular dependency with validation.

ACKs for top commit:
  jnewbery:
    ACK e48826ad87
  gruve-p:
    ACK e48826ad87
  MarcoFalke:
    re-ACK e48826ad87 🥈

Tree-SHA512: c846ba64436d36f8180046ad551d8b0d9e20509b9bc185aa2639055fc28803dd8ec2d6771ab337e80da0b40009ad959590d5772f84a0bf6199b65190d4155bed
2021-07-01 19:15:09 +02:00
MarcoFalke
a926d6dfd2
Merge bitcoin/bitcoin#22310: test: Add functional test for replacement relay fee check
c4ddee64c7 test: Add test for replacement relay fee check (Antoine Riard)

Pull request description:

  This PR adds rename the `reject_reason` of our implementation of BIP125 rule 4 and adds missing functional test coverage. Note, `insufficient fee` is already the `reject_reason` of few others `PreChecks` replacement checks and as such might be confusing.

  > The replacement transaction must also pay for its own bandwidth at or above the rate set by the node's minimum relay fee setting. For example, if the minimum relay fee is 1 satoshi/byte and the replacement transaction is 500 bytes total, then the replacement must pay a fee at least 500 satoshis higher than the sum of the originals.

  ```
          // Finally in addition to paying more fees than the conflicts the
          // new transaction must pay for its own bandwidth.
          CAmount nDeltaFees = nModifiedFees - nConflictingFees;
          if (nDeltaFees < ::incrementalRelayFee.GetFee(nSize))
          {
              return state.Invalid(TxValidationResult::TX_MEMPOOL_POLICY, "insufficient fee",
                      strprintf("rejecting replacement %s, not enough additional fees to relay; %s < %s",
                          hash.ToString(),
                          FormatMoney(nDeltaFees),
                          FormatMoney(::incrementalRelayFee.GetFee(nSize))));
          }
  ```

ACKs for top commit:
  MarcoFalke:
    cr ACK c4ddee64c7
  glozow:
    ACK c4ddee6, one small suggestion if you retouch.

Tree-SHA512: 7c5d1065db6e6fe57a9f083bf051a7a55eb9892de3a2888679d4a6853491608c93b6e35887ef383a9988d14713fa13a0b1d6134b7354af5fd54765f0d4e98568
2021-07-01 18:36:17 +02:00
Hennadii Stepanov
091d35c70e
Merge bitcoin-core/gui#377: Translations update
c7f74f1a7f Translations update (Hennadii Stepanov)

Pull request description:

  Translation string freeze, see [Release schedule for 22.0](https://github.com/bitcoin/bitcoin/issues/20851).

ACKs for top commit:
  laanwj:
    ACK c7f74f1a7f, I get the same output

Tree-SHA512: 85c12a88290f46db0d6724ef51c2789bb1f7dfc242682b95420cb1310cb986e8d8a53e628fb7e184008ca23236e36bb5dc8ea65c4e41e01ca2c8f17863894125
2021-07-01 17:40:30 +03:00
Hennadii Stepanov
c7f74f1a7f
Translations update
Translation string freeze, see Release schedule for 22.0.
2021-07-01 17:16:14 +03:00
fanquake
2749613020
Merge bitcoin/bitcoin#22348: build: Fix cross build for Windows with Boost Process
67669ab425 build: Fix Boost Process compatibility with mingw-w64 compiler (Hennadii Stepanov)

Pull request description:

  On master (9c3751a0c9) the cross build for Win64 is broken if configured with `--enable-external-signer`:
  ```
  ...
    CXX      crypto/libbitcoin_crypto_base_a-chacha_poly_aead.o
  In file included from /home/hebasto/GitHub/bitcoin/depends/x86_64-w64-mingw32/include/boost/process/detail/windows/handles.hpp:11,
                   from /home/hebasto/GitHub/bitcoin/depends/x86_64-w64-mingw32/include/boost/process/detail/used_handles.hpp:17,
                   from /home/hebasto/GitHub/bitcoin/depends/x86_64-w64-mingw32/include/boost/process/detail/windows/async_in.hpp:20,
                   from /home/hebasto/GitHub/bitcoin/depends/x86_64-w64-mingw32/include/boost/process/async.hpp:49,
                   from /home/hebasto/GitHub/bitcoin/depends/x86_64-w64-mingw32/include/boost/process.hpp:23,
                   from util/system.cpp:9:
  /home/hebasto/GitHub/bitcoin/depends/x86_64-w64-mingw32/include/boost/process/detail/windows/handle_workaround.hpp:208:51: error: expected ‘)’ before ‘*’ token
    208 | typedef ::boost::winapi::NTSTATUS_ (__kernel_entry *nt_system_query_information_p )(
        |                                    ~              ^~
        |                                                   )
  /home/hebasto/GitHub/bitcoin/depends/x86_64-w64-mingw32/include/boost/process/detail/windows/handle_workaround.hpp:223:51: error: expected ‘)’ before ‘*’ token
    223 | typedef ::boost::winapi::NTSTATUS_ (__kernel_entry *nt_query_object_p )(
        |                                    ~              ^~
        |                                                   )
  /home/hebasto/GitHub/bitcoin/depends/x86_64-w64-mingw32/include/boost/process/detail/windows/handle_workaround.hpp: In function ‘boost::winapi::NTSTATUS_ boost::process::detail::windows::workaround::nt_system_query_information(boost::process::detail::windows::workaround::SYSTEM_INFORMATION_CLASS_, void*, boost::winapi::ULONG_, boost::winapi::PULONG_)’:
  /home/hebasto/GitHub/bitcoin/depends/x86_64-w64-mingw32/include/boost/process/detail/windows/handle_workaround.hpp:239:12: error: ‘nt_system_query_information_p’ does not name a type; did you mean ‘nt_system_query_information’?
    239 |     static nt_system_query_information_p f = reinterpret_cast<nt_system_query_information_p>(::boost::winapi::get_proc_address(h, "NtQuerySystemInformation"));
        |            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        |            nt_system_query_information
  In file included from /home/hebasto/GitHub/bitcoin/depends/x86_64-w64-mingw32/include/boost/process/detail/windows/handles.hpp:11,
                   from /home/hebasto/GitHub/bitcoin/depends/x86_64-w64-mingw32/include/boost/process/detail/used_handles.hpp:17,
                   from /home/hebasto/GitHub/bitcoin/depends/x86_64-w64-mingw32/include/boost/process/detail/windows/async_in.hpp:20,
                   from /home/hebasto/GitHub/bitcoin/depends/x86_64-w64-mingw32/include/boost/process/async.hpp:49,
                   from /home/hebasto/GitHub/bitcoin/depends/x86_64-w64-mingw32/include/boost/process.hpp:23,
                   from util/system.cpp:9:
  /home/hebasto/GitHub/bitcoin/depends/x86_64-w64-mingw32/include/boost/process/detail/windows/handle_workaround.hpp:241:14: error: ‘f’ was not declared in this scope
    241 |     return (*f)(SystemInformationClass, SystemInformation, SystemInformationLength, ReturnLength);
        |              ^
  /home/hebasto/GitHub/bitcoin/depends/x86_64-w64-mingw32/include/boost/process/detail/windows/handle_workaround.hpp: In function ‘boost::winapi::BOOL_ boost::process::detail::windows::workaround::nt_query_object(boost::winapi::HANDLE_, boost::process::detail::windows::workaround::OBJECT_INFORMATION_CLASS_, void*, boost::winapi::ULONG_, boost::winapi::PULONG_)’:
  /home/hebasto/GitHub/bitcoin/depends/x86_64-w64-mingw32/include/boost/process/detail/windows/handle_workaround.hpp:253:12: error: ‘nt_query_object_p’ does not name a type; did you mean ‘nt_query_object’?
    253 |     static nt_query_object_p f = reinterpret_cast<nt_query_object_p>(::boost::winapi::get_proc_address(h, "NtQueryObject"));
        |            ^~~~~~~~~~~~~~~~~
        |            nt_query_object
  /home/hebasto/GitHub/bitcoin/depends/x86_64-w64-mingw32/include/boost/process/detail/windows/handle_workaround.hpp:255:14: error: ‘f’ was not declared in this scope
    255 |     return (*f)(Handle, ObjectInformationClass, ObjectInformation, ObjectInformationLength, ReturnLength);
        |              ^
  make[2]: *** [Makefile:9906: util/libbitcoin_util_a-system.o] Error 1
  make[2]: *** Waiting for unfinished jobs....
    CXX      crypto/libbitcoin_crypto_base_a-chacha20.o
  make[2]: Leaving directory '/home/hebasto/GitHub/bitcoin/src'
  make[1]: *** [Makefile:16141: all-recursive] Error 1
  make[1]: Leaving directory '/home/hebasto/GitHub/bitcoin/src'
  make: *** [Makefile:820: all-recursive] Error 1
  ```

  The upstream bug: https://github.com/boostorg/process/issues/96
  Also see: https://stackoverflow.com/a/59338759

  https://github.com/bitcoin/bitcoin/pull/22348#issuecomment-871061160:
  > [This commit](7fc41b2815), containing the `__kernel_entry` [SAL annotations](https://docs.microsoft.com/en-us/cpp/code-quality/using-sal-annotations-to-reduce-c-cpp-code-defects?view=msvc-160) was included in Boost Process as part of the `1.71.0` release, which broke support for compiling with mingw-w64 because it doesn't define the `__kernel_entry` SAL annotation (but it does define some others, i.e see [`sal.h`](https://github.com/mirror/mingw-w64/blob/master/mingw-w64-headers/include/sal.h)).
  >
  > A [commit was made](d7a721ee0d) to remove the annotations, however, it hasn't made it into either of the two Boost releases that have happened since (1.75.0 & 1.76.0). Meaning that this is currently needed for all versions of Boost process from 1.71.0 onwards.

ACKs for top commit:
  fanquake:
    ACK 67669ab425 - thanks for updating this.

Tree-SHA512: 5931ca1fb77ce38c042cf5a7556add024ea2386c208bf26c792a8ca4a771d97fac9802c32fa8aa2e3de1ad35f3362d8c066f0a83ee675859d226c602fd0bcf93
2021-07-01 20:17:11 +08:00
fanquake
185acdb5e8
Merge bitcoin/bitcoin#22334: wallet: do not spam about non-existent spk managers
6084d2caed wallet: do not spam about non-existent spk managers (S3RK)

Pull request description:

  Avoid spam in logs during `loadwallet`, `listdescriptors` and probably other commands as well.

  **`loadwallet` Before:**
  ```
  2021-06-24T06:31:45Z init message: Loading wallet…
  2021-06-24T06:31:45Z [desc] Wallet File Version = 169900
  2021-06-24T06:31:45Z [desc] Keys: 0 plaintext, 0 encrypted, 0 w/ metadata, 0 total. Unknown wallet records: 0
  2021-06-24T06:31:45Z [desc] External scriptPubKey Manager for output type 0 does not exist
  2021-06-24T06:31:45Z [desc] External scriptPubKey Manager for output type 1 does not exist
  2021-06-24T06:31:45Z [desc] External scriptPubKey Manager for output type 2 does not exist
  2021-06-24T06:31:45Z [desc] Internal scriptPubKey Manager for output type 0 does not exist
  2021-06-24T06:31:45Z [desc] Internal scriptPubKey Manager for output type 1 does not exist
  2021-06-24T06:31:45Z [desc] Internal scriptPubKey Manager for output type 2 does not exist
  2021-06-24T06:31:45Z [desc] Wallet completed loading in             197ms
  2021-06-24T06:31:45Z [desc] External scriptPubKey Manager for output type 0 does not exist
  2021-06-24T06:31:45Z [desc] External scriptPubKey Manager for output type 1 does not exist
  2021-06-24T06:31:45Z [desc] External scriptPubKey Manager for output type 2 does not exist
  2021-06-24T06:31:45Z [desc] Internal scriptPubKey Manager for output type 0 does not exist
  2021-06-24T06:31:45Z [desc] Internal scriptPubKey Manager for output type 1 does not exist
  2021-06-24T06:31:45Z [desc] Internal scriptPubKey Manager for output type 2 does not exist
  2021-06-24T06:31:45Z [desc] External scriptPubKey Manager for output type 0 does not exist
  2021-06-24T06:31:45Z [desc] External scriptPubKey Manager for output type 1 does not exist
  2021-06-24T06:31:45Z [desc] External scriptPubKey Manager for output type 2 does not exist
  2021-06-24T06:31:45Z [desc] Internal scriptPubKey Manager for output type 0 does not exist
  2021-06-24T06:31:45Z [desc] Internal scriptPubKey Manager for output type 1 does not exist
  2021-06-24T06:31:45Z [desc] Internal scriptPubKey Manager for output type 2 does not exist
  2021-06-24T06:31:45Z [desc] setKeyPool.size() = 0
  2021-06-24T06:31:45Z [desc] mapWallet.size() = 0
  2021-06-24T06:31:45Z [desc] m_address_book.size() = 0
  2021-06-24T06:31:45Z [desc] External scriptPubKey Manager for output type 0 does not exist
  2021-06-24T06:31:45Z [desc] External scriptPubKey Manager for output type 1 does not exist
  2021-06-24T06:31:45Z [desc] External scriptPubKey Manager for output type 2 does not exist
  2021-06-24T06:31:45Z [desc] Internal scriptPubKey Manager for output type 0 does not exist
  2021-06-24T06:31:45Z [desc] Internal scriptPubKey Manager for output type 1 does not exist
  2021-06-24T06:31:45Z [desc] Internal scriptPubKey Manager for output type 2 does not exist
  {
    "name": "desc",
    "warning": ""
  }
  ```

  **After:**
  ```
  2021-06-24T06:26:58Z init message: Loading wallet…
  2021-06-24T06:26:58Z [desc] Wallet File Version = 169900
  2021-06-24T06:26:58Z [desc] Keys: 0 plaintext, 0 encrypted, 0 w/ metadata, 0 total. Unknown wallet records: 0
  2021-06-24T06:26:58Z [desc] Wallet completed loading in             158ms
  2021-06-24T06:26:58Z [desc] setKeyPool.size() = 0
  2021-06-24T06:26:58Z [desc] mapWallet.size() = 0
  2021-06-24T06:26:58Z [desc] m_address_book.size() = 0
  {
    "name": "desc",
    "warning": ""
  }
  ```

ACKs for top commit:
  achow101:
    ACK 6084d2caed

Tree-SHA512: c7d7345c3182a575db088fd731b7f6e428c42e4f3f2e10d5adb50bf74a2defe88768e65ebb91a08590be48cf766a5697e36fafa73f68ffe45e76a60600f072e2
2021-07-01 19:11:20 +08:00
fanquake
fa46e48982
Merge bitcoin/bitcoin#22379: wallet: erase spkmans rather than setting to nullptr
b945a31afa wallet: erase spkmans rather than setting to nullptr (Andrew Chow)

Pull request description:

  In many places in ScriptPubKeyMan managing code, we assume that the ScriptPubKeyMan being retrieved actually exists and is not a nullptr. Thus removing a ScriptPubKeyMan requires erasing the object from the map rather than setting it to a nullptr.

  This fixes a segmentation fault that can be reached with `test/functional/wallet_descriptors.py --descriptors`

ACKs for top commit:
  S3RK:
    ACK b945a31

Tree-SHA512: 344a4cf9b1c168428750c751dcd24c52032506f20c81977fe93c4b5307ea209de72bb62a9c5284820f225b03acdc9573fceb734833d29b82f49d5a799ddcaea7
2021-07-01 18:03:32 +08:00
Hennadii Stepanov
67669ab425
build: Fix Boost Process compatibility with mingw-w64 compiler
Boost 1.71 has a broken compatibility with mingw-w64 compiler due to the
added __kernel_entry SAL annotations.
2021-07-01 12:16:47 +03:00
MarcoFalke
3ef2d400fa
Merge bitcoin/bitcoin#22376: ci: Do not clone bitcoin-core/qa-assets git repository if not necessary
30450a1bd5 Do not clone qa-assets git repository if not necessary (Kiminuo)

Pull request description:

  This PR attempts to remove an unnecessary step when CI runs.

  The main motivation for the change is that I locally use `MAKEJOBS="-j15" FILE_ENV="./ci/test/00_setup_env_android.sh" ./ci/test_run_all.sh` to find out if a patch of mine works or not. Cloning `bitcoin-core/qa-assets` is slow on my machine (which is by no means slow).

ACKs for top commit:
  MarcoFalke:
    cr ACK 30450a1bd5

Tree-SHA512: 5763b53da9554b06039c39f8fc729de1b106cce2a242de8f97528d001bfa01d4f48d2a128f458a3cdee3da36312354c6714839b947f313c089c2c5cb30233a39
2021-07-01 08:32:00 +02:00
Hennadii Stepanov
333ec8be82
Merge bitcoin-core/gui#330: Allow prompt icon to be colorized
2f23ad2c40 qt: allow prompt icon to be colorized (Jarol Rodriguez)

Pull request description:

  Opening the console on macOS, while in dark mode, the console prompt icon will not be colorized white like other icons. This applies the `platformStyle` to the icon so that It can be colorized white.

  While here, refactor the `promptIcon` widget from a `QPushButton` to `QLabel`; which is more appropriate, per [Qt Docs](https://doc.qt.io/qt-5/qlabel.html#details):
  > QLabel is used for displaying text or an image. No user interaction functionality is provided.

  | Master        | PR               |
  | ----------- | ----------- |
  | ![Screen Shot 2021-05-14 at 11 46 33 PM](https://user-images.githubusercontent.com/23396902/118347462-8f689780-b511-11eb-8335-329f7d2a9992.png) | ![Screen Shot 2021-05-14 at 11 45 41 PM](https://user-images.githubusercontent.com/23396902/118347463-92638800-b511-11eb-9044-073f51ef27ff.png) |

ACKs for top commit:
  hebasto:
    ACK 2f23ad2c40

Tree-SHA512: 21f8b1610e4820c9064bbd08608b5467e5b9499e2a3b149ff223e37b60e7d560497255c733eafa5434628a84b9f7b7c91d8b0f34b02be2f9ceb3ab21a4d555a8
2021-07-01 09:14:02 +03:00
Hennadii Stepanov
34f554dbd3
Merge bitcoin-core/gui#366: Dark Mode fixes/portability
9d5bf6bf01 GUI: Always call parent changeEvent handler (Luke Dashjr)
c901d4d8ce GUI: Enable palette change adaptation on all platforms (Luke Dashjr)

Pull request description:

  The changes to support macOS "Dark Mode" are valid for any platform, and should work so long as Qt implements the PaletteChange event. (Worst case, we're no worse off with trying.)

  Additionally, we shouldn't block the parent classes from implementing event handlers. Who knows what side effects that could have.

ACKs for top commit:
  hebasto:
    ACK 9d5bf6bf01, tested on Linux Mint 20.1 (Qt 5.12.8) with the [`qt5ct`](https://packages.ubuntu.com/focal/qt5ct) package installed.
  kristapsk:
    ACK 9d5bf6bf01. Tested on Gentoo Linux with Xfce4 and Qt 5.15.2, does not break anything on my computer.

Tree-SHA512: dce2fff0ff129eda208132390a37424ff9607539287dbdbfdfd659ed9c4ea0472541e987489a04fd935e391dc006a35bfc9cfa9bcff33602b7dbd29b81c51626
2021-07-01 09:02:00 +03:00
Andrew Chow
b945a31afa wallet: erase spkmans rather than setting to nullptr
In many places in ScriptPubKeyMan managing code, we assume that the
ScriptPubKeyMan being retrieved actually exists and is not a nullptr.
Thus removing a ScriptPubKeyMan requires erasing the object from the
map rather than setting it to a nullptr.
2021-07-01 01:22:38 -04:00
fanquake
5a95c5179c
Merge bitcoin/bitcoin#20191: wallet, refactor: make DescriptorScriptPubKeyMan agnostic of internal flag
181181019c refactor: remove m_internal from DescriptorSPKman (S3RK)

Pull request description:

  Rationale: improve consistency between `CWallet` and `DescriptorScriptPubKeyMan`; simplify `ScriptPubKeyMan` interface.

  Descriptor in itself is neither internal or external. It's responsibility of a wallet to assign and manage descriptors for a specific purpose. Duplicating information about internalness of a descriptor could lead to inconsistencies and unexpected behaviour (for example misreporting keypool size).

ACKs for top commit:
  instagibbs:
    reACK 181181019c
  achow101:
    reACK 181181019c

Tree-SHA512: d5613b7f6795b290bfa0fd8cb0536de1714d0cf72cba402266bd06d550758ebad690b54fc0a336a1c7414b5814aa4a37c90a6ae89926474a97d30956d7e034ff
2021-07-01 10:16:33 +08:00
fanquake
045bb06ebd
Merge bitcoin/bitcoin#19651: wallet: importdescriptors update existing
3efaf83c75 wallet: deactivate descriptor (S3RK)
6737d9655b test: wallet importdescriptors update existing (S3RK)
586f1d53d6 wallet: maintain SPK consistency on internal flag change (S3RK)
f1b7db1474 wallet: don't mute exceptions in importdescriptors (S3RK)
bf68ebc1cd wallet: allow to import same descriptor twice (S3RK)

Pull request description:

  Rationale: allow updating existing descriptors with `importdescriptors` command.

  Currently if you run same `importdescriptors` command twice with a descriptor containing private key you will get very confusing error — `Missing required fields`. What happens is that Wallet tries to write imported private key to the disk, but it exists already so we get `DB_KEYEXIST (-30995)` from BerkelyDB. Please note, that we set `DB_NOOVERWRITE` (I guess not to lose some keys accidentally). The exception is caught in `catch (...)` in rpcdump.cpp with a generic error.

  With this PR if a descriptor is already present than we will update its activeness, internalness, label, range and next_index.
  For the range only expansion is allowed (range start can only decrease, range end increase).

ACKs for top commit:
  achow101:
    re-ACK 3efaf83c75
  meshcollider:
    Code review ACK 3efaf83c75
  jonatack:
    Light ACK 3efaf83c75 per `git range-diff a000cb0 5d96704 3efaf83` and as a sanity check, re-debug-built on debian with gcc 10.2.1 and clang 11, ran wallet_importdescriptors.py

Tree-SHA512: 122c4b621d64ec8a3b625f3aed9f01a2b5cbaf2029ad0325b5ff38d67fff5cd35324335fabe2dd5169548b01b267c81be6ae0f5c834342f3d5f6eeed515c4843
2021-07-01 10:06:56 +08:00
Antoine Riard
c4ddee64c7 test: Add test for replacement relay fee check 2021-06-30 18:47:08 -04:00
Samuel Dobson
722776c0fd
Merge bitcoin/bitcoin#21329: descriptor wallet: Cache last hardened xpub and use in normalized descriptors
e6cf0ed92d wallet, rpc: listdescriptors does not need unlocked (Andrew Chow)
3280704886 Pass in DescriptorCache to ToNormalizedString (Andrew Chow)
7a26ff10c2 Change DescriptorImpl::ToStringHelper to use an enum (Andrew Chow)
75530c93a8 Remove priv option for ToNormalizedString (Andrew Chow)
74fede3b8b wallet: Upgrade existing descriptor caches (Andrew Chow)
432ba9e543 wallet: Store last hardened xpub cache (Andrew Chow)
d87b544b83 descriptors: Cache last hardened xpub (Andrew Chow)
cacc391098 Move DescriptorCache writing to WalletBatch (Andrew Chow)
0b4c8ef75c Refactor Cache merging and writing (Andrew Chow)
976b53b085 Revert "Cache parent xpub inside of BIP32PubkeyProvider" (Andrew Chow)

Pull request description:

  Currently fetching a normalized descriptor requires the wallet to be unlocked as it needs the private keys to derive the last hardened xpub. This is not very user friendly as normalized descriptors shouldn't require and don't involve the private keys except for derivation. We solve this problem by caching the last hardened xpub (which has to be derived at some point when generating the address pool).

  However the last hardened xpub was not already being cached. We only cached the immediate parent xpub and derived child keys. For example, with a descriptor derivation path of `/84'/0'/0'/0/*`, the parent xpub that is cached is `m/84'/0'/0'/0`, and the child keys of `m/84'/0'/0'/0/i` (note that child keys would not be cached in this case). This parent xpub is not suitable for the normalized descriptor form as we want the key at `m/84'/0'/0'`. So this PR adds another field to `DescriptorCache` to cache the last hardened xpub so that we can use them for normalized descriptors.

  Since `DescriptorCache` is changing, existing descriptor wallets need to be upgraded to use this new cache. The upgrade will occur in the background either at loading time (if the wallet is not encrypted) or at unlocking time in the same manner that `UpgradeKeyMetadata` operates. It will use a new wallet flag `WALLET_FLAG_LAST_HARDENED_XPUB_CACHED` to indicate whether the descriptor wallet has the last hardened xpub cache.

  Lastly `listdescriptors` will not require the wallet to be locked and `getaddressinfo`'s `parent_desc` will always be output (assuming the upgrade has occurred).

ACKs for top commit:
  fjahr:
    tACK e6cf0ed92d
  S3RK:
    reACK e6cf0ed
  jonatack:
    Semi ACK e6cf0ed92d reviewed, debug-built and ran unit tests and some of the descriptor functional tests at each commit. I'm not very familiar with this code and it could be clearer to the uninitiated IMHO, so I'm not confident enough to give a full ACK. Various minor suggestions follow, most of them for readability, feel free to pick and choose.
  meshcollider:
    Code review + functional test run ACK e6cf0ed92d

Tree-SHA512: ac27aade8644525cd65bfcaf27ff32afb974085b1451faf4ff68c6671a690bd6a41d4f39a33cbf461ae0fbe85995c0a4c08dbd36171da1c1d2a1d00053ad298d
2021-07-01 09:58:40 +12:00
Jarol Rodriguez
2f23ad2c40 qt: allow prompt icon to be colorized 2021-06-30 13:27:31 -04:00
Kiminuo
30450a1bd5 Do not clone qa-assets git repository if not necessary 2021-06-30 11:59:49 +02:00
fanquake
3fc20abab0
Merge bitcoin/bitcoin#22353: ci: Upgrading pip version in macos environment
057750c09d ci: Upgrading pip version in macos environment (Tushar Singla)

Pull request description:

  During each CI run, in macos native environment, python packages lief and zmq are rebuilt everytime which wastes a lot of resources and time and fixes #22206. The latest version of pip directly fetches pre-built binaries. Through this commit pip version is upgraded in macos environment before installation of these packages.

ACKs for top commit:
  MarcoFalke:
    cr ACK 057750c09d

Tree-SHA512: e61d02e46c8fe6a89119014d025a26aba090f9507d725315680893290f5bbc20a375ef408c71fa8db2f485b44ec91cfa0c140198ca44a9d3e0a57055b6bb9582
2021-06-30 16:23:19 +08:00
MarcoFalke
e1a13f12e1
Merge bitcoin/bitcoin#18096: doc: IsFinalTx comment about nSequence & OP_CLTV
f9e37f33ce doc: IsFinalTx comment about nSequence & OP_CLTV (Yuval Kogman)

Pull request description:

  It's somewhat surprising that a transaction's `nLockTime` field is ignored
  when all `nSequence` fields are final, so this change aims to clarify this
  behavior and cross reference relevant details of `OP_CHECKLOCKTIMEVERIFY`.

ACKs for top commit:
  MarcoFalke:
    ACK f9e37f33ce

Tree-SHA512: 88460dacbe4b8115fb1948715f09b21d4f34ba1da9e88d52f0b774a969f845e9eddc5940e7fee66eacdd3062dc40d6d44c3f282b0e5144411fd47eb2320b44f5
2021-06-30 09:43:21 +02:00
S3RK
181181019c refactor: remove m_internal from DescriptorSPKman
Descriptor in itself is neither internal or external.
It's responsibility of a wallet to assign and manage descriptors
for a specific purpose. Duplicating such information could lead to
inconsistencies and unexpected behaviour.
2021-06-30 08:37:50 +02:00
fanquake
bfd910cae4
Merge bitcoin/bitcoin#18568: doc: Clarify developer notes about constant naming
05f9770c1f doc: Clarify developer notes about constant naming (Russell Yanofsky)

Pull request description:

  I'm pretty sure developer notes were intended to say constants should be upper case and variables should be lower case, but right now they are ambiguous about whether to write:

  ```c++
  extern const int SYMBOL;
  ```

  or:

  ```c++
  extern const int g_symbol;
  ```

  First convention above is better than the second convention because it tells you without having to look anything up that the value of `SYMBOL` won't change at runtime. Also I haven't seen other c++ projects using the second convention.

ACKs for top commit:
  MarcoFalke:
    cr ACK 05f9770c1f
  practicalswift:
    ACK 05f9770c1f
  jarolrod:
    ACK 05f9770c1f 🥃

Tree-SHA512: 766d0e25d9db818d45df4ad6386987014f2053584cbced4b755ceef8bda6b7e2cfeb34eb8516423bd03b140faaf577614d5e3be2799f7eed0eb439187ab85323
2021-06-30 09:23:15 +08:00
Anthony Towns
e48826ad87 tests: remove ComputeBlockVersion shortcut from versionbits tests 2021-06-30 08:19:12 +10:00
Anthony Towns
c5f36725e8 [refactor] Move ComputeBlockVersion into VersionBitsCache
This also changes ComputeBlockVersion to take the versionbits cache
mutex once, rather than once for each versionbits deployment.
2021-06-30 08:19:12 +10:00
Anthony Towns
4a69b4dbe0 [move-only] Move ComputeBlockVersion from validation to versionbits 2021-06-30 08:19:12 +10:00
Anthony Towns
0cfd6c6a8f [refactor] versionbits: make VersionBitsCache a full class
Moves the VersionBits* functions to be methods of the cache class,
and makes the cache and its lock private to the class.
2021-06-30 08:19:12 +10:00
Anthony Towns
8ee3e0bed5 [refactor] rpc/blockchain.cpp: SoftForkPushBack
Rename BIP9SoftForkPushBack and BuriedSoftForkPushBack to SoftForkPushBack
and have the compiler figure out which one to use based on the deployment
type. Avoids the need to update the file when burying a deployment.
2021-06-30 08:19:12 +10:00
Anthony Towns
92f48f360d deploymentinfo: Add DeploymentName() 2021-06-30 08:19:12 +10:00
Anthony Towns
ea68b3a572 [move-only] Rename versionbitsinfo to deploymentinfo 2021-06-30 08:19:12 +10:00
Anthony Towns
c64b2c6a0f scripted-diff: rename versionbitscache
-BEGIN VERIFY SCRIPT-
sed -i -e 's/versionbitscache/g_versionbitscache/g' $(git grep -l versionbitscache)
-END VERIFY SCRIPT-
2021-06-30 08:19:12 +10:00
Anthony Towns
de55304f6e [refactor] Add versionbits deployments to deploymentstatus.h
Adds support for versionbits deployments to DeploymentEnabled,
DeploymentActiveAfter and DeploymentActiveAt. Also moves versionbitscache
from validation to deploymentstatus.
2021-06-30 08:18:58 +10:00
Anthony Towns
2b0d291da8 [refactor] Add deploymentstatus.h
Provides DeploymentEnabled, DeploymentActiveAt, and DeploymentActiveAfter
helpers for checking the status of buried deployments. Can be overloaded
so the same syntax works for non-buried deployments, allowing future
soft forks to be changed from signalled to buried deployments without
having to touch the implementation code.

Replaces IsWitnessEnabled and IsScriptWitnessEnabled.
2021-06-29 17:11:12 +10:00
Anthony Towns
eccd736f3d versionbits: Use dedicated lock instead of cs_main 2021-06-29 17:11:12 +10:00
Anthony Towns
36a4ba0aaa versionbits: correct doxygen comments 2021-06-29 17:11:12 +10:00
MarcoFalke
a000cb013c
Merge bitcoin/bitcoin#22361: refactor: Make httpserver work queue a unique_ptr
fa92e60f38 refactor: Make httpserver work queue a unique_ptr (MarcoFalke)

Pull request description:

  This simplifies the code a bit because `if (p) { delete p; p = nullptr; }` can be replaced by a call to the `reset()` member.

ACKs for top commit:
  promag:
    Core review ACK fa92e60f38.
  jonatack:
    ACK fa92e60f38 code review, debug build clean, ran test/functional/interface*.py tests locally as a sanity check
  hebasto:
    ACK fa92e60f38, I have reviewed the code and it looks OK, I agree it can be merged.

Tree-SHA512: 6b122162317dd4ad6889341745c7ac1903a3ee510f6548f46dc356308442a6eff13eb8dc604c38ba18783e7a66d2b836d641a8594ff980a010c12c97f3856684
2021-06-29 08:24:26 +02:00
S3RK
6084d2caed wallet: do not spam about non-existent spk managers 2021-06-29 08:16:39 +02:00
fanquake
e0face9235
Merge bitcoin/bitcoin#22358: Remove unused wallet pointer from wallet signals
8888cf45f5 Remove unused wallet pointer from NotifyAddressBookChanged (MarcoFalke)
faf3640303 Remove unused wallet pointer from NotifyTransactionChanged signal (MarcoFalke)

Pull request description:

  The signals are members of the wallet, so passing the pointer would be redundant even if it was used.

  Also, fix `with` -> `without`, which was forgotten in commit ca4cf5cff6.

ACKs for top commit:
  jonatack:
    Code review ACK 8888cf45f5 also verified with/without lock cs_wallet status for each of the two functions and debian clang 11 debug build clean
  promag:
    Code review ACK 8888cf45f5.
  theStack:
    Code review ACK 8888cf45f5

Tree-SHA512: e3b80931ce9bcb05213619f5435ac7c21d3c7848643950a70db610902bd1803c92bb75e501d46b0e519bc576901f160e088e8882c4f1adce892a80df565f897b
2021-06-29 12:41:06 +08:00
fanquake
8071ec179d
Merge bitcoin/bitcoin#21789: refactor: Remove ::Params() global from CChainState
fa0d9211ef refactor: Remove chainparams arg from CChainState member functions (MarcoFalke)
fa38947125 refactor: Remove ::Params() global from inside CChainState member functions (MarcoFalke)

Pull request description:

  The `::Params()` global is verbose and confusing. Also it makes tests a bit harder to write because they'd have to mock a global.

  Fix all issues by simply using a member variable that points to the right params.

  (Can be reviewed with `--word-diff-regex=.`)

ACKs for top commit:
  jnewbery:
    ACK fa0d9211ef
  kiminuo:
    utACK fa0d9211
  theStack:
    ACK fa0d9211ef 🍉

Tree-SHA512: 44676b19c9ed471ccb536331d3029bad192d7d50f394fd7b8527ec431452aeec8c4494164b9cf8e16e0123c4463b16be864366c6b599370032c17262625a0356
2021-06-29 11:22:57 +08:00
S3RK
3efaf83c75 wallet: deactivate descriptor 2021-06-28 21:44:50 +02:00
S3RK
6737d9655b test: wallet importdescriptors update existing 2021-06-28 21:44:50 +02:00
S3RK
586f1d53d6 wallet: maintain SPK consistency on internal flag change 2021-06-28 21:44:50 +02:00
S3RK
f1b7db1474 wallet: don't mute exceptions in importdescriptors 2021-06-28 21:37:44 +02:00
S3RK
bf68ebc1cd wallet: allow to import same descriptor twice 2021-06-28 21:37:37 +02:00
MarcoFalke
3f56ef7bef
Merge bitcoin/bitcoin#22146: Reject invalid coin height and output index when loading assumeutxo
fa9ebedec3 Reject invalid coin height and output index when loading assumeutxo (MarcoFalke)

Pull request description:

  It should be impossible to have a coin at a height higher than the height of the snapshot block, so reject those early to avoid integer wraparounds and hash collisions later on.

  Same for the outpoint index.

  Both issues were found by fuzzing:

  * The height issue by OSS-Fuzz: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=34793
  * The outpoint issue by my fuzz server: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=34793#c2

ACKs for top commit:
  practicalswift:
    cr ACK fa9ebedec3: patch looks correct
  jamesob:
    crACK fa9ebedec3
  theStack:
    Code review ACK fa9ebedec3
  benthecarman:
    crACK fa9ebedec3

Tree-SHA512: dae7caee4b3862b23ebdf2acb7edec4baf75b0dbf1409b370b1a73aa6b632b317ebfac596dcbaf4edfb1301b513f45465ea75328962460f35e2af0d7e547c9ac
2021-06-28 16:11:44 +02:00
MarcoFalke
fa92e60f38
refactor: Make httpserver work queue a unique_ptr 2021-06-28 11:47:05 +02:00
MarcoFalke
8888cf45f5
Remove unused wallet pointer from NotifyAddressBookChanged 2021-06-28 10:39:49 +02:00