Commit Graph

36620 Commits

Author SHA1 Message Date
Hennadii Stepanov
8a61527cf6
ci: Re-introduce depends_built cache back in macOS and Android tasks 2023-02-09 12:11:26 +00:00
merge-script
dc905f6c2a
Merge bitcoin/bitcoin#27063: ci: Use the latest Ubuntu LTS for "ARM64 Android APK" task
887bb53b67 ci: Use the latest Ubuntu LTS for "ARM64 Android APK" task (Hennadii Stepanov)

Pull request description:

  Suggested in https://github.com/bitcoin/bitcoin/pull/25797#discussion_r1100172227:

  >  I don't expect that anyone is building for android, and if they did, it should be fine to just require the latest Ubuntu LTS, which is Jammy

ACKs for top commit:
  fanquake:
    ACK 887bb53b67 - but I'd also suggest we remove this task entirely, and either replacing it with another task, maybe a *BSD, or delegating the resources to other jobs.

Tree-SHA512: 1f4b6155e5bbb8ca3580809c5999e3abf6b15b409d164a719b0a89205ca48c178aa6401039a22151ce464009adc48ba272a5a2ff05dc3ca06d3b2d64c99e3e22
2023-02-09 10:44:48 +01:00
fanquake
835af48e03
Merge bitcoin/bitcoin#27057: build: set boost cppflags with --enable-fuzz
b03a98291b build: set boost cppflags with --enable-fuzz (fanquake)

Pull request description:

  Even though all other targets are disabled, we still need Boost CPPFLAGS (`use_boost`) to compile. This currently works everywhere, except on arm macOS (where the include path is non-standard), because generally, the Boost include path is generic, i.e `/usr/include`.

ACKs for top commit:
  hebasto:
    ACK b03a98291b

Tree-SHA512: 7544a903ce641fd4b994ae51423a7007de85628ae29be36362a5cbdd62f9b16ac0a62e9edadaaa998ad4c1e82c0fde0d8c53aba41f94ad30ffa9f10ba0984521
2023-02-08 17:09:40 +00:00
fanquake
b03a98291b
build: set boost cppflags with --enable-fuzz
Even though all other targets are disabled, we still need Boost CPPFLAGS
(use_boost) to compile. This currently works everywhere, except on arm
macOS (where the include path is pretty non-standard), because
generally, the Boost include path is generic, i.e `/usr/include`.
2023-02-08 16:10:34 +00:00
merge-script
07a23b4946
Merge bitcoin/bitcoin#26994: depends: define __BSD_VISIBLE for FreeBSD bdb build
0e02f72548 depends: define `__BSD_VISIBLE` for FreeBSD bdb build (fanquake)

Pull request description:

  Required for additional definitions (`IPC_R` & friends), to be available, when compiling under C11, which would otherwise cause compile fails.

  See: https://github.com/MarcoFalke/btc_nightly/pull/4.

ACKs for top commit:
  hebasto:
    ACK 0e02f72548, tested on FreeBSD 13.1:

Tree-SHA512: 885d4aa341d9668da360cf6dfafb97ce816803c54e76c0a06e448db39a723666d42cd14b3e713d17ecbe33163f5af69924567cf449d679a2db95b36357005d43
2023-02-08 16:37:09 +01:00
fanquake
7b850bc2a1
Merge bitcoin/bitcoin#27061: doc: Document affected gcc versions for -fstack-reuse=none workaround
fa83005a26 doc: Document affected gcc versions for -fstack-reuse=none workaround (MarcoFalke)

Pull request description:

  gcc version(s) 11 and prior won't be fixed, looking at the activity in the bug report. So it seems best to just document gcc 12.1+ as fixed, so that in the future the workaround can be removed once the minimum compiler is gcc12.1.

ACKs for top commit:
  fanquake:
    ACK fa83005a26
  hebasto:
    re-ACK fa83005a26

Tree-SHA512: a19723457eb1925196828a5fafd4e7f75a04f86ffae63cb86679d732c662fd1a22e17fe3c69195a97438ff189ba3ff681be3650cf99aa195d7a3e89cd8ee137c
2023-02-08 14:59:43 +00:00
Hennadii Stepanov
887bb53b67
ci: Use the latest Ubuntu LTS for "ARM64 Android APK" task 2023-02-08 14:15:13 +00:00
MarcoFalke
fa83005a26
doc: Document affected gcc versions for -fstack-reuse=none workaround 2023-02-08 13:06:11 +01:00
MarcoFalke
de1d189534
Merge bitcoin/bitcoin#27056: doc: use arch agnostic clang path in fuzzing doc (macOS)
b49e19ccd9 doc: use arch agnostic clang path in fuzzing doc (macOS) (fanquake)

Pull request description:

  The current path will only work for clang installed via brew on x86_64 macOS.

ACKs for top commit:
  hebasto:
    ACK b49e19ccd9, similar to 702836530f.

Tree-SHA512: 8ae4845e1953d5a7178f2b422e2241af1057d8cce1ab79da65df0cd068456dbf85da3489355f81fc4ee09ba602a4b53e989e2dc02476b4abf6c5b3bc3e96473b
2023-02-08 12:49:49 +01:00
MarcoFalke
51d51d3082
Merge bitcoin/bitcoin#26507: test: remove unused vars in feature_block
741c215b5f test: remove unused vars in `feature_block` (brunoerg)

Pull request description:

  There is no need to assign `self.next_block` to variables if we're not using its return value. Most cases touched here, we're reassigning it right after with the value from `self.update_block`.

Top commit has no ACKs.

Tree-SHA512: 25bbea2a09f38c3a3483fa363f024d2a8edd06a00cccc93cef99e489b9a3485d58bbd6a1ed2dddc00f1cebec7e63aed8ad95701a2645ce20a0db9b69573c20a7
2023-02-08 11:42:22 +01:00
fanquake
8d69b614cc
Merge bitcoin/bitcoin#23810: docs: avoid C-style casts; use modern C++ casts
75347236f2 docs: document c-style cast prohibition (Pasta)

Pull request description:

  In the words of practicalswift:
  ```
  A C-style cast is equivalent to try casting in the following order:

      const_cast(...)
      static_cast(...)
      const_cast(static_cast(...))
      reinterpret_cast(...)
      const_cast(reinterpret_cast(...))

  By using static_cast<T>(...) explicitly we avoid the possibility of an unintentional and
  dangerous reinterpret_cast. Furthermore static_cast<T>(...) allows for easier grepping of casts.

  For a more thorough discussion, see "ES.49: If you must use a cast, use a named cast"
  in the C++ Core Guidelines (Stroustrup & Sutter).
  ```

  Modern tooling, specifically `-Wold-style-cast` can enable us to enforce never using C-style casts. I believe this is especially important due to the number of C-style casts the codebase is currently being used as a reinterpret_cast. reinterpret_casts are especially dangerous, and should never be done via C-style casts.

  Update the docs to suggest the use of named cast or functional casts.

Top commit has no ACKs.

Tree-SHA512: 29a98de396f0c78e32d8a1831319162203c4405a670da5add5da956fcc7df200a1cec162ef1cfac4ddfb02714b66406081d40ed435c7f0f28581cfa24d94fac1
2023-02-08 10:36:43 +00:00
fanquake
b49e19ccd9
doc: use arch agnostic clang path in fuzzing doc (macOS) 2023-02-08 09:45:04 +00:00
MarcoFalke
1bcabe6f2a
Merge bitcoin-core/gui#697: Remove reindex special case from the progress bar label
faff2ba4f8 Remove reindex special case from the progress bar label (MarcoFalke)

Pull request description:

  The user knows which option they passed to the program, so it seems overly verbose to offer the user feedback whether or not they passed `-reindex`. Treat it as `DISK`, like all other cases that are treated as `DISK`:

  * `-reindex-chainstate`
  * `-loadblock`

ACKs for top commit:
  john-moffett:
    Re-ACK faff2ba4f8
  hebasto:
    ACK faff2ba4f8, I have reviewed the code and it looks OK, I agree it can be merged.

Tree-SHA512: 7f110c4beb1451d26f32da3a60150dac91c8a7b8d1c01749017204712b73cc1b77578af492930e4b6704097a73ed051f77bc39d8f60e0ff15a797a201805312e
2023-02-07 16:49:13 +01:00
fanquake
fe86616bb4
Merge bitcoin/bitcoin#26421: build: copy config.{guess,sub} post autogen in zmq package
1914e470e3 build: copy config.{guess,sub} post autogen in zmq package (fanquake)

Pull request description:

  Otherwise our config.guess and config.sub will be copied over. This problem has been masked by the fact that modern systems ship with versions that recognise all the triplets we use (namely arm64-apple-darwin). However building on ubuntu 20.04 surfaces the issue.

  Fixes #26420.

ACKs for top commit:
  hebasto:
    ACK 1914e470e3, tested on Ubuntu 18.04.

Tree-SHA512: dff64c3c62d9f8fc205e5a4dffe8befd58838418d073a15dfe304a0f64b182dfffd9dcf98b53df44bfab905c12a62d03cd5c0f91fa7c4b246ac21ae5f20540fd
2023-02-07 12:01:30 +00:00
fanquake
ab5b26f072
Merge bitcoin/bitcoin#21995: build: Make dependency package archive timestamps deterministic
6ebe57622c build: Make dependency package archive timestamps deterministic (Hennadii Stepanov)

Pull request description:

  This PR makes testing changes like bitcoin/bitcoin#20641, bitcoin/bitcoin#21593, bitcoin/bitcoin#22142, bitcoin/bitcoin#24279, bitcoin/bitcoin#24285 as easy as comparing hashes.

  With this PR:
  ```
  $ make -C depends clean
  $ make -C depends HOST=x86_64-w64-mingw32
  $ find depends/built/x86_64-w64-mingw32 -name '*.hash' | sort | xargs cat
  1f685a61cbf205f81977ecf88cba91fa1ccdfbe77ab4ec3405dcd33ceb778af4  bdb-4.8.30-ca950bd6d13.tar.gz
  08a9acde276e6e5e5c8913e3ad07eeecda184a996882ae226b3ed056c7ec1b01  boost-1.80.0-b537c466dcb.tar.gz
  144c6d92e4108fcc90740bee27007db58a88336a97be6367f9c8ba4cc208af27  libevent-2.1.12-stable-e13b2bdd8b8.tar.gz
  e3c9c9609bf32bfd460432c6ab99a64e9f8750ed775a193925ff4f5aed363e4c  libnatpmp-07004b97cf691774efebe70404cf22201e4d330d-82255b84667.tar.gz
  62c6a089a4b24a413eccd2f389bf4c8b0716423b0ace5e87e984069635da9f83  miniupnpc-2.2.2-c43fc4cf2f6.tar.gz
  78762700066273e597698a78479a506b33532ea565d18ef561614b9fc3820cf5  qrencode-3.4.4-663de0dc628.tar.gz
  5e2183faf91838510a48e6dbb4b65ae74a7d48ba1abc070b82767c4076582360  qt-5.15.5-986926343e2.tar.gz
  9f8459f8d27fc3af9146712be6ba6577f15741429936504a950cc51c17da1ba8  sqlite-3380500-bec6a4d3299.tar.gz
  0eca5d01d427de50be4bd57c8bb100ab69b017792c32b8733e2b20443f4c9c28  zeromq-4.3.4-8ae81bab6f4.tar.gz
  ```

  As an example, here is an evidence that bitcoin/bitcoin#24279 is a strict refactoring change:
  ```
  $ git fetch origin pull/24279/head
  $ git cherry-pick 706026838d917a3d853e03e83db040f1fd4aeb74
  $ git cherry-pick 3f90ddea8a6a2061cfb347a1d77df2c0a6fa238c
  $ make -C depends clean
  $ make -C depends HOST=x86_64-w64-mingw32
  $ find depends/built/x86_64-w64-mingw32 -name '*.hash' | sort | xargs cat
  1f685a61cbf205f81977ecf88cba91fa1ccdfbe77ab4ec3405dcd33ceb778af4  bdb-4.8.30-c7faf31d5ca.tar.gz
  08a9acde276e6e5e5c8913e3ad07eeecda184a996882ae226b3ed056c7ec1b01  boost-1.80.0-1af3dd1d99e.tar.gz
  144c6d92e4108fcc90740bee27007db58a88336a97be6367f9c8ba4cc208af27  libevent-2.1.12-stable-6228a9f8534.tar.gz
  e3c9c9609bf32bfd460432c6ab99a64e9f8750ed775a193925ff4f5aed363e4c  libnatpmp-07004b97cf691774efebe70404cf22201e4d330d-41aa6194ecc.tar.gz
  62c6a089a4b24a413eccd2f389bf4c8b0716423b0ace5e87e984069635da9f83  miniupnpc-2.2.2-6a93027769c.tar.gz
  78762700066273e597698a78479a506b33532ea565d18ef561614b9fc3820cf5  qrencode-3.4.4-d40cb2d45c9.tar.gz
  5e2183faf91838510a48e6dbb4b65ae74a7d48ba1abc070b82767c4076582360  qt-5.15.5-120c3cb745d.tar.gz
  9f8459f8d27fc3af9146712be6ba6577f15741429936504a950cc51c17da1ba8  sqlite-3380500-bbd4d813c69.tar.gz
  0eca5d01d427de50be4bd57c8bb100ab69b017792c32b8733e2b20443f4c9c28  zeromq-4.3.4-df0858a19d2.tar.gz
  ```

ACKs for top commit:
  TheCharlatan:
    Code review ACK 6ebe57622c

Tree-SHA512: 20e0222781f5dcb50126c11677d0671bcdd7be144b2e528c75a02983acc494206552fb35039697ccd094de27a21b3fb439e9965c34feb8a6d74627fa20a9a5e7
2023-02-07 11:59:11 +00:00
fanquake
6e08e5cb5c
Merge bitcoin/bitcoin#17127: util: Set safe permissions for data directory and wallets/ subdir
c9ba4f9ecb test: Add test for file system permissions (Hennadii Stepanov)
581f16ef34 Apply default umask in `SetupEnvironment()` (Hennadii Stepanov)
8a6219e543 Remove `-sysperms` option (Hennadii Stepanov)

Pull request description:

  On master (1e7564eca8) docs say:
  ```
  $ ./src/bitcoind -help | grep -A 3 sysperms
    -sysperms
         Create new files with system default permissions, instead of umask 077
         (only effective with disabled wallet functionality)

  ```

  Basing on that, one could expect that running `bitcoind` first time will create data directory and `wallets/` subdirectory with safe 0700 permissions.

  But that is not the case:
  ```
  $ stat .bitcoin | grep id
  Access: (0775/drwxrwxr-x)  Uid: ( 1000/ hebasto)   Gid: ( 1000/ hebasto)
  $ stat .bitcoin/wallets | grep id
  Access: (0775/drwxrwxr-x)  Uid: ( 1000/ hebasto)   Gid: ( 1000/ hebasto)
  ```

  Both directories, in fact, are created with system default permissions.

  With this PR:
  ```
  $ stat .bitcoin/wallets | grep id
  Access: (0700/drwx------)  Uid: ( 1000/ hebasto)   Gid: ( 1000/ hebasto)
  $ stat .bitcoin/wallets | grep id
  Access: (0700/drwx------)  Uid: ( 1000/ hebasto)   Gid: ( 1000/ hebasto)
  ```

  ---

  This PR:
  - is alternative to bitcoin/bitcoin#13389
  - fixes bitcoin/bitcoin#15902
  - fixes bitcoin/bitcoin#22595
  - closes bitcoin/bitcoin#13371
  - reverts bitcoin/bitcoin#4286

  Changes in behavior: removed `-sysperms` command-line argument / configure option. The related discussions are here:
  - https://github.com/bitcoin/bitcoin/pull/13389#issuecomment-395306690
  - https://github.com/bitcoin/bitcoin/pull/13389#issuecomment-539906114
  - https://github.com/bitcoin/bitcoin/pull/13389#discussion_r279160472

  If users rely on non-default access permissions, they could use `chmod`.

ACKs for top commit:
  john-moffett:
    ACK c9ba4f9ecb
  willcl-ark:
    ACK c9ba4f9ecb

Tree-SHA512: 96c745339e6bd0e4d7bf65daf9a721e2e1945b2b0ab74ca0f66576d0dc358b5de8eb8cdb89fe2160f3b19c39d2798bb8b291784316085dc73a27102d3415bd57
2023-02-07 10:44:40 +00:00
MarcoFalke
faff2ba4f8
Remove reindex special case from the progress bar label 2023-02-07 11:02:01 +01:00
MarcoFalke
5a80086ec2
Merge bitcoin/bitcoin#26701: contrib: make DNS seeds file an argument in CLI (makeseeds)
1c07500dbb contrib: make DNS seeds file an argument in CLI (brunoerg)

Pull request description:

  Instead of using `makeseeds.py` this way:
  ```sh
  python3 makeseeds.py -a asmap-filled.dat < seeds_main.txt > nodes_main.txt
  ```

  We could use the DNS seeds file as an argument since it is a required one. It improves the way the script handles it when that file is missing as well as makes this script more friendly.
  E.g:
  ```sh
  python3 makeseeds.py -a asmap-filled.dat -s seeds_main.txt > nodes_main.txt
  ```

ACKs for top commit:
  vincenzopalazzo:
    ACK  1c07500dbb

Tree-SHA512: bddf728d5d376659155f5bbeb1fa0d42aa273ec4a0cf5687f4d3f3be85625f541d392f30008e3c9d2c65967cb882deb36af34330994727771be73c9adeb521e0
2023-02-07 10:03:36 +01:00
Andrew Chow
52ddbd52f9
Merge bitcoin/bitcoin#26345: refactor: modernize the implementation of uint256.*
935acdcc79 refactor: modernize the implementation of uint256.* (pasta)

Pull request description:

  - Constructors of uint256 to utilize Span instead of requiring a std::vector
  - converts m_data into a std::array
  - Prefers using `WIDTH` instead of `sizeof(m_data)`
  - make all the things constexpr
  - replace C style functions with c++ equivalents
      - memset -> std::fill
          This may also be replaced by std::memset, but I think that std::fill is more idiomatic of modern c++ and readable.
      - memcpy -> std::copy
          Note: In practice, implementations of std::copy avoid multiple assignments and use bulk copy functions such as std::memmove if the value type is TriviallyCopyable and the iterator types satisfy LegacyContiguousIterator. (https://en.cppreference.com/w/cpp/algorithm/copy)
          This could also likely be replaced by std::memcpy, but as said above, I believe the using std::copy is the more c++ way to do anything and is almost guaranteed to compile to the same asm
      - memcmp -> std::memcmp

ACKs for top commit:
  achow101:
    ACK 935acdcc79
  hebasto:
    Approach ACK 935acdcc79.
  aureleoules:
    reACK 935acdcc79
  john-moffett:
    ACK 935acdcc79
  stickies-v:
    Approach ACK 935acdcc7

Tree-SHA512: 4f1ba54ff2198eea0e505d41e73d552c84c60f6878d5c85a94a8ab57f39afc94ef8d79258e7afd01fa84ec2a99f4404bb877eecd671f65e1ee9273f3129fc650
2023-02-06 13:56:51 -05:00
Hennadii Stepanov
c9ba4f9ecb
test: Add test for file system permissions 2023-02-06 11:08:57 +00:00
Hennadii Stepanov
581f16ef34
Apply default umask in SetupEnvironment()
This change makes all filesystem artifacts--files and directories--being
created with the default umask.
2023-02-06 11:08:03 +00:00
MarcoFalke
aff75463e2
Merge bitcoin/bitcoin#27036: test: Remove last uses of snprintf and simplify
b8032293e6 Remove use of snprintf and simplify (John Moffett)

Pull request description:

  These are the only remaining uses of `snprintf` in our project, and they can cause unexpected issues -- for example, see https://github.com/bitcoin/bitcoin/issues/27014. Change them to use our `ToString` (which uses a locale-independent version of `std::to_string`) to convert an `int` to `std::string`. Also remove resulting unused parts of `StringContentsSerializer`.

  Closes https://github.com/bitcoin/bitcoin/issues/27014

ACKs for top commit:
  Sjors:
    tACK b8032293e6, fixes #27014.

Tree-SHA512: c903977e654711929decafe8887d0de13b38a340d7082875acc5d41950d834dcfde074e9cabecaf5f9a760f62c34322297b4b156af29761650ef5803b1a54b59
2023-02-06 10:32:55 +01:00
fanquake
d8f9826037
Merge bitcoin/bitcoin#27030: Update nanobench to version v4.3.10
82f895d7b5 Update nanobench to version v4.3.10 (Martin Leitner-Ankerl)

Pull request description:

  Nothing has changed that would affect Bitcoin's usage of nanobench.

   Here is a detailed list of the changes
  * Plenty of clang-tidy updates
  * documentation updates
  * faster Rng::shuffle
  * Enable perf counters on older kernels
  * Raise default minimum epoch time to 1ms (doesn't effect bitcoin's usage)
  * Add support for custom information per benchmark

ACKs for top commit:
  hebasto:
    ACK 82f895d7b5, I've reviewed the code, all related changes from #26642 have been implemented.

Tree-SHA512: 942518398809a2794617a347ab8182b784a8e822e84de5af078b2531eabb438412d687cac22a21936585e60e07138a89b41c28c9750744c05a3d1053f55cad01
2023-02-05 15:16:16 +00:00
fanquake
8f4ae65818
Merge bitcoin/bitcoin#27009: validation: Skip VerifyDB checks of level >=3 if dbcache is too small
fe683f3524 log: Log VerifyDB Progress over multiple lines (Martin Zumsande)
61431e3a57 validation: Skip VerifyDB checks of level >=3 if dbcache is too small (Martin Zumsande)

Pull request description:

  This is the first two commits from #25574, leaving out all changes to `-verifychain` error-handling :

  - The Problem of [25563](https://github.com/bitcoin/bitcoin/issues/25563) is that when we skip blocks at level 3 due to an insufficient dbcache (skipping some `DisconnectBlock()` calls), we would still attempt the level 4 checks, attempting to reconnect a block that was never disconnected, leading to an assert in `ConnectBlock()`.
  Fix this by not attempting level 4 checks in this case.
  - Logging of verification progress is now split over multiple lines. This is more verbose, but now each update has its own timestamp, and other threads logging concurrently will no longer lead to mangled output.

  This can be tested with a small `dbcache` value, for example:
  `bitcoind -signet -dbcache=10`
  `bitcoin-cli -signet verifychain 4 1000`

  Fixes #25563

ACKs for top commit:
  MarcoFalke:
    review ACK fe683f3524 🗄
  john-moffett:
    ACK fe683f3524

Tree-SHA512: 3e2e0f8b73cbc518a0fa17912c1956da437787aab95001c110b01048472e0dfe4783c44df22bd903d198069dd2f6b02bfdf74e0b934c7a776f144c2e86cb818a
2023-02-05 13:28:05 +00:00
Hennadii Stepanov
8a6219e543
Remove -sysperms option
This change effectively reverts commits from
https://github.com/bitcoin/bitcoin/pull/4286.

Users, who rely on non-default access permissions, should use `chmod`
command.
2023-02-05 08:09:16 +00:00
Andrew Chow
d71b0e78eb
Merge bitcoin/bitcoin#25966: test: Remove redundant test
fb1c6c14c1 test: Remove redundant test (yancy)

Pull request description:

  I can't think of any reason to keep this test case around labeled [fix me](https://github.com/bitcoin/bitcoin/blob/master/src/wallet/test/coinselector_tests.cpp#L242).  The test was originally added [here](4566ab75f2) however there was never an assertion about the coins that should be selected, only that a solution is found (which is a redundant solution to the test [above](https://github.com/bitcoin/bitcoin/blob/master/src/wallet/test/coinselector_tests.cpp#L222)).  The comment was later added here to [fix](384273260a) it, however it's unclear what exactly it's testing.  A test was later added [here](https://github.com/bitcoin/bitcoin/blob/master/src/wallet/test/coinselector_tests.cpp#L366) where if the [long term fee](https://github.com/bitcoin/bitcoin/blob/master/src/wallet/test/coinselector_tests.cpp#L357) is less than the current [fee](https://github.com/bitcoin/bitcoin/blob/master/src/wallet/test/coinselector_tests.cpp#L356), then select fewer UTXOs, which may have been the original intent.

ACKs for top commit:
  S3RK:
    ACK fb1c6c14c1
  Zero-1729:
    Concept ACK fb1c6c14c1
  achow101:
    ACK fb1c6c14c1

Tree-SHA512: bce2cdae669c144ffaa130237a1643e3b6728e13d603cebf5d9493c4c7c68b3635868e4d93d210783c2ded2a871f185ca09a2053168c05b26a1e056ff6edf68f
2023-02-03 17:32:46 -05:00
Andrew Chow
e2ae5c349c
Merge bitcoin/bitcoin#27037: rpc: decode Miniscript descriptor when possible in decodescript
6699d850e4 doc: release notes for #27037 (Antoine Poinsot)
dfc9acbf01 rpc: decode Miniscript descriptor when possible in decodescript (Antoine Poinsot)

Pull request description:

  The descriptor inference logic would previously always use a dummy signing provider and would never analyze the witness script of a P2WSH scriptPubKey.

  It's often not possible to infer a Miniscript only from the onchain Script, but it was such a low hanging fruit that it's probably worth having it?

  Fixes https://github.com/bitcoin/bitcoin/issues/27007. I think it also closes https://github.com/bitcoin/bitcoin/issues/25606.

ACKs for top commit:
  instagibbs:
    ACK 6699d850e4
  achow101:
    ACK 6699d850e4
  sipa:
    utACK 6699d850e4

Tree-SHA512: e592bf1ad45497e7bd58c26b33cd9d05bb3007f1e987bee773d26013c3824e1b394fe4903809d80997d5ba66616cc79d77850cd7e7f847a0efb2211c59466982
2023-02-03 15:34:38 -05:00
Hennadii Stepanov
2ccd7be26f
Merge bitcoin-core/gui#653: Show watchonly balance only for Legacy wallets
fdb8dc8a5a gui: Show watchonly balance only for Legacy wallets (Andrew Chow)

Pull request description:

  Descriptor wallets do not have a watchonly balance as wallets are designated watchonly or not. Thus we should not be displaying the empty watchonly balance for descriptor wallets.

  The result is that instead of the send page showing "Watch-only balance: 0.00000000 BTC" for watchonly descriptor wallets, we see the actual balance as "Balance: 10.00000000 BTC"

ACKs for top commit:
  johnny9:
    tACK fdb8dc8a5a
  furszy:
    ACK fdb8dc8a
  hebasto:
    ACK fdb8dc8a5a

Tree-SHA512: e5c0703a62d25c881c8dadfb9cffd482791f3d437a4ec5ae0088ce1a2069c2455ad6d3ec6c95a4404a3b55fbd727f92694529c35052236951553ca90c4ed31b5
2023-02-03 19:18:30 +00:00
Hennadii Stepanov
daebf9ebb0
Merge bitcoin-core/gui#705: doc: Fix comment about how wallet txs are sorted
c497a198db Fix comment about how wallet txs are sorted (John Moffett)

Pull request description:

  The wallet transactions in the node are not sorted by txid (or any hash) since https://github.com/bitcoin/bitcoin/pull/24699.

  This is how they're stored in memory now:

  835212cd1d/src/wallet/wallet.h (L397-L399)

ACKs for top commit:
  achow101:
    ACK c497a198db
  jarolrod:
    ACK c497a198db

Tree-SHA512: e72559991688452ef254474d4235dc75fac655bce04909c3a0eece907360f4c6f57707db9b4373a4bd2271b23c57e863684c33e0728adf48e477c5499cdfdad7
2023-02-03 19:03:46 +00:00
John Moffett
b8032293e6 Remove use of snprintf and simplify
One test case uses snprintf to convert an
int to a string. Change it to use ToString
(which uses a locale-independent version of
std::to_string). Also remove unnecessary
parts of StringContentsSerializer.
2023-02-03 12:35:54 -05:00
Antoine Poinsot
6699d850e4
doc: release notes for #27037 2023-02-03 18:18:39 +01:00
Antoine Poinsot
dfc9acbf01
rpc: decode Miniscript descriptor when possible in decodescript
The descriptor inference logic would previously always use a dummy
signing provider and would never analyze the witness script of a P2WSH
scriptPubKey.

Note even a valid Miniscript might not always be decodable from Script
without more contextual information (for instance the key preimage for a
pk_h).
2023-02-03 18:15:42 +01:00
MarcoFalke
aaa55971f6
Merge bitcoin/bitcoin#26875: Tests: Fill out dust limit unit test for known types except bare multisig
b093f5619f Fill out dust limit unit test for known types except bare multisig (Greg Sanders)

Pull request description:

  Having the constants checked explicitly in a single spot helps with possible regressions and also useful for documentation.

  In addition, add a check for undefined v1 witness programs.

ACKs for top commit:
  theStack:
    Code-review ACK b093f5619f
  MarcoFalke:
    review ACK b093f5619f  🥉

Tree-SHA512: 1421f75471739d29b9ef59b0a925b6b07e4e9af92822dbe56eedfb590be9a00fb0c34312146c7c1b5211906461ed00bfa2eb53c88595c6e5a27694b2dc21df38
2023-02-03 13:57:08 +01:00
Martin Leitner-Ankerl
82f895d7b5 Update nanobench to version v4.3.10
Nothing has changed that would affect Bitcoin's usage of nanobench. Here is a detailed list of the changes
* Plenty of clang-tidy updates
* documentation updates
* faster Rng::shuffle
* Enable perf counters on older kernels
* Raise default minimum epoch time to 1ms (doesn't effect bitcoin's usage)
* Add support for custom information per benchmark
2023-02-03 07:08:28 +01:00
fanquake
7753efcbcf
Merge bitcoin/bitcoin#27004: test: Use std::unique_ptr over manual delete in coins_tests
fab9f7d1bd test: Use std::unique_ptr over manual delete in coins_tests (MarcoFalke)

Pull request description:

  Makes the code smaller and easier to read

ACKs for top commit:
  stickies-v:
    ACK fab9f7d1bd
  john-moffett:
    ACK fab9f7d1bd

Tree-SHA512: 30d2d2097906e61fdef47a52fc6a0c5ce2417bc41c3c82dafc1b216c655f31dabf9c1c13759575a696f61bbdfdba3f442be032d5e5145b7a54fae2a927824621
2023-02-02 16:53:51 +00:00
fanquake
c2028f98ae
Merge bitcoin/bitcoin#27012: ci: Print iwyu patch in git diff format
fa6986a66b ci: Print iwyu patch in git diff format (MarcoFalke)

Pull request description:

  Seems more dev friendly to also have a patch to copy-paste

ACKs for top commit:
  hebasto:
    ACK fa6986a66b, tested on Ubuntu 22.04 locally.
  fanquake:
    ACK fa6986a66b - did not test but example CI output looks ok.
  stickies-v:
    utACK fa6986a66b

Tree-SHA512: 7cfd8584bf12e03c28af23f4712c6bcafd648d87ddb92788b9cd35455b2db49f4bd4aef8ad4711f75c7f11ad2bb2492c2eb6044007086c20e36016575c060603
2023-02-02 15:48:20 +00:00
MarcoFalke
b3ef329199
Merge bitcoin/bitcoin#26976: ci: Cache package manager install step
fa486de212 ci: Cache package manager install step (MarcoFalke)

Pull request description:

  Use the local podman or docker image cache to skip the slow `apt` step

ACKs for top commit:
  jamesob:
    ACK fa486de212 ([`jamesob/ackr/26976.1.MarcoFalke.ci_cache_package_manager`](https://github.com/jamesob/bitcoin/tree/ackr/26976.1.MarcoFalke.ci_cache_package_manager))

Tree-SHA512: 3495346c6c862b63296d2691cc492bf52a0a99ee7fae798887c792609904546013eba788045cd508a5f669f2c52e3479c122c18a5275c87af38237a1b5c9da17
2023-02-02 16:09:23 +01:00
Hennadii Stepanov
ea41abade4
Merge bitcoin-core/gui#695: Fix misleading RPC console wallet message
576f7b8614 Fix misleading RPC console wallet message (John Moffett)

Pull request description:

  ## Misleading message from RPCConsole window ##

  In certain circumstances, the GUI console will display the message 'Executing command without any wallet' when it is, in fact, using the currently loaded wallet. For instance:

  ![scr3](https://user-images.githubusercontent.com/116917595/211404066-d49a6cbf-d3c3-4e89-8720-3583c6acf521.gif)

  In RPC calls, if no wallet is explicitly selected and there is exactly one wallet loaded, the [default](39363a4b94/src/wallet/rpc/util.cpp (L71-L93)) is to act on that loaded wallet.

  The GUI console acts that way in reality, but sometimes erroneously reports that it's not acting on any particular wallet. The root issue is due to the logic that prevents changing the selected wallet if the RPCConsole is visible:

  39363a4b94/src/qt/rpcconsole.cpp (L783-L786)

  This PR removes that unnecessary logic. This does have some ramifications. Prior to this PR, if a user opened the console window without any wallets loaded, then opened two or more wallets, the RPC console would select "None" of the wallets and any wallet-specific RPCs would fail. However, the behavior was different if the user hadn't had the console window open. In that case, if they opened the RPC Console window _after_ loading at least the first wallet, it would select the first-loaded wallet. This context-dependent behavior is (IMO) undesirable, and this PR changes it to be consistent.

ACKs for top commit:
  hebasto:
    ACK 576f7b8614, tested on Ubuntu 22.04 (Qt 5.15.3).

Tree-SHA512: 627da186025ba4f4e8df7fdd1b10363f923c4ecc50f023bbf2aece6e2593da65c45147c933effaca9040f813a6e46f034fc2d1ee2fb0f401000a3a6221a0e36e
2023-02-02 12:18:36 +00:00
Hennadii Stepanov
526f67a5ca
Merge bitcoin-core/gui#704: Correctly limit overview transaction list
08209c039f Correctly limit overview transaction list (John Moffett)

Pull request description:

  Fixes #703

  The way the main overview page limits the number of transactions displayed (currently 5) is not an appropriate use of Qt. Our subclassed transaction sort/filter proxy model returns a maximum of `5` in `rowCount()`. However, the model itself actually may hold significantly more. While this has _worked_, it breaks the contract of `rowCount()`.

  If `bitcoin-qt` is run with a DEBUG build of Qt, it'll result in an assert-crash in certain relatively common situations (see #703 for details). Instead of artificially limiting the `rowCount()` in the subclassed filter, we can hide/unhide the rows in the displaying `QListView` upon any changes in the sorted proxy filter.

  I loaded a wallet with 20,000 transactions and did not notice any performance differences between master and this branch.

  For reference, this is the list I'm referring to:

  <img width="934" alt="image" src="https://user-images.githubusercontent.com/116917595/214947304-3f289380-3510-487b-80e8-d19428cf2f0f.png">

ACKs for top commit:
  Sjors:
    tACK 08209c039f
  hebasto:
    ACK 08209c039f, tested on Ubuntu 22.04.

Tree-SHA512: c2a7b1a2a6e6ff30694830d7c722274c4c47494a81ce9ef25f8e5587c24871b02343969f4437507693d4fd40ba7a212702b159cf54b3357d8d76c02bc8245113
2023-02-02 11:45:26 +00:00
fanquake
21138fe377
Merge bitcoin/bitcoin#26992: refactor: Remove unused CDataStream SerializeMany constructor
fa47b28dfc refactor: Remove unused CDataStream SerializeMany constructor (MarcoFalke)

Pull request description:

  Seems odd to have an unused method. Moreover, the function is fragile and dangerous, because one could have a `std::vector vec_a` and type `CDataStream{vec_a, 0, 0}.size()` and `CDataStream{0, 0, vec_a}.size()`, assuming they are the same thing, when in fact they are not. (The first takes over the memory as is, the second serializes the vector).

  So my suggestion would be to remove the unused method and introduce a new method when this functionality is needed. For example: `static DataStream FromMany(Args&&... args)`.

ACKs for top commit:
  stickies-v:
    ACK fa47b28dfc

Tree-SHA512: 9593a034b997e33a0794f779f76f02425b1097b218cf8cb1facb7f874fa69da328ce567a79138015baeebe004ae7d103dda4f64f83e8ad375b6dae6b66d3d950
2023-02-02 10:47:37 +00:00
fanquake
9dc50a5a07
Merge bitcoin/bitcoin#27005: util: Use steady clock for logging timer
fad7af700e Use steady clock for logging timer (MarcoFalke)

Pull request description:

  The logging timer has many issues:

  * The underlying clock is mockable, meaning that benchmarks are useless when mocktime was set at the beginning or end of the benchmark.
  * The underlying clock is not monotonic, meaning that benchmarks are useless when the system time was changed during the benchmark.

  Fix all issues in this patch.

ACKs for top commit:
  stickies-v:
    Approach ACK fad7af700e
  john-moffett:
    ACK fad7af700e

Tree-SHA512: bec8da0f338ed4611e1807937575e1b2afda25139d88015b1c29fa7d13946fbfbc4ee589b576c0508d505df5e5fafafcbc07d63ce4bab4b01475260d9d5d2107
2023-02-02 10:30:29 +00:00
MarcoFalke
102645280b
Merge bitcoin/bitcoin#27013: ci: avoid using -Werror for older compilers
71383f2fad ci: avoid using -Werror for older compilers (fanquake)

Pull request description:

  Don't enable `-Werror` (in the CI) for compilers at least older than our current release compiler (GCC 10). It provides little-to-no value, other than turning compiler bugs & false positives into build failures, and we aren't going to mutate perfectly fine/working code, for the sake of avoid a warning that shouldn't even exist.

  I also do not see the point of playing whack-a-mole and turning off various warnings/trying to further work around the broken compiler, just to acheive warningless builds for the sake of warningless builds.

  One anecdote from ["How SQLite Is Tested"](https://www.sqlite.org/testing.html):
  > Static analysis has found a few bugs in SQLite, but those are the
  > exceptions. More bugs have been introduced into SQLite while trying
  > to get it to compile without warnings than have been found by static
  > analysis.

ACKs for top commit:
  hebasto:
    ACK 71383f2fad
  jarolrod:
    ACK 71383f2fad

Tree-SHA512: 20ed3dcf54fb17a7d9f0d8ca68c0ad2ee8f171f8bd61673a428f3123ab322c24cd9833f65915489bc8cebeffc37fd683a30e9669684b219960e69ddc7adae5bd
2023-02-02 10:40:40 +01:00
Andrew Chow
fdd363ebd9
Merge bitcoin/bitcoin#26910: wallet: migrate wallet, exit early if no legacy data exist
6d31900e52 wallet: migrate wallet, exit early if no legacy data exist (furszy)

Pull request description:

  The process first creates a backup file then return an error,
  without removing the recently created file, when notices that
  the db is already running sqlite.

ACKs for top commit:
  john-moffett:
    ACK 6d31900e52
  achow101:
    ACK 6d31900e52
  ishaanam:
    crACK 6d31900e52

Tree-SHA512: 9fb52e80de96e129487ab91bef13647bc4570a782003b1e37940e2a00ca26283fd24ad39bdb63a984ae0a56140b518fd0d74aa2fc59ab04405b2c179b7d3c54a
2023-02-01 17:14:13 -05:00
fanquake
2d5acc901d
Merge bitcoin/bitcoin#27015: p2p: 26847 fixups (AddrMan totals)
dc70c1eb08 addrman: Use std::nullopt instead of {} (Martin Zumsande)
59cc66abb9 test: Remove AddrMan unit test that fails consistency checks (Martin Zumsande)

Pull request description:

  Two fixups for #26847:
  * Now that `AddrMan::Size()` performs internal consistency tests (it didn't before), we can't call it in the `load_addrman_corrupted` unit tests, where we deal with an artificially corrupted `AddrMan`. This would fail the test when using `-checkaddrman=1` (leading to spurious CI fails). Therefore remove the tests assertion, which is not particularly helpful anyway (in production we abort init when peers.dat is corrupted instead of querying AddrMan in its corrupted state).
   (See https://github.com/bitcoin/bitcoin/pull/26847#issuecomment-1411458339)
  * Use `std::nullopt` instead of `{}` for default args (suggested in https://github.com/bitcoin/bitcoin/pull/26847#discussion_r1090643603)

ACKs for top commit:
  MarcoFalke:
    lgtm ACK dc70c1eb08

Tree-SHA512: dd8a988e23d71a66d3dd30560bb653c9ad17db6915abfa5f722818b0ab18921051ec9223bfbc75d967df8bcd204dfe473d680bf68e8a8e4e4998fbb91dc973c5
2023-02-01 15:56:48 +00:00
fanquake
550e6bd227
Merge bitcoin/bitcoin#26935: refactor: Fix clang-tidy readability-const-return-type violations
fa451d4b60 Fix clang-tidy readability-const-return-type violations (MarcoFalke)

Pull request description:

  This comes up during review, so instead of wasting review cycles on this, just enforce it via CI

ACKs for top commit:
  stickies-v:
    utACK fa451d4b6
  hebasto:
    ACK fa451d4b60.

Tree-SHA512: 144a85612f00ec43f7ea1fdaa11901ca981a9f0465a8849745712d741b201b9c3307118172ee0b8efd12bebf25bc6f32a6e2c908495e371f9ada0a917994f44e
2023-02-01 15:53:35 +00:00
fanquake
71383f2fad
ci: avoid using -Werror for older compilers
Don't enable `-Werror` (in the CI) for compilers at least older than
our current release compiler (GCC 10). It provides little-to-no value,
other than turning compiler bugs & false positives into build failures,
and we aren't going to mutate perfectly fine/working code, for the sake
of avoid a warning that shouldn't even exist.

I also do not see the point of playing whack-a-mole and turning off various
warnings/trying to further work around the broken compiler, just to
acheive warningless builds for the sake of warningless builds.

One anecdote from "How SQLite Is Tested":
> Static analysis has found a few bugs in SQLite, but those are the
> exceptions. More bugs have been introduced into SQLite while trying
> to get it to compile without warnings than have been found by static
> analysis.

https://www.sqlite.org/testing.html.
2023-02-01 15:22:24 +00:00
Martin Zumsande
dc70c1eb08 addrman: Use std::nullopt instead of {} 2023-02-01 10:18:08 -05:00
Martin Zumsande
59cc66abb9 test: Remove AddrMan unit test that fails consistency checks
Now that Size() performs internal consistency checks,
it will rightfully fail (and assert) when dealing with
a corrupted AddrMan. Therefore remove this check.
2023-02-01 10:14:20 -05:00
MarcoFalke
8fc3bcf93d
Merge bitcoin/bitcoin#27010: refactor: use Hash helpers for double-SHA256 calculations
87f11ef47f refactor: use `Hash` helper for double-SHA256 calculations (Sebastian Falbesoner)

Pull request description:

  We have two helper templates `Hash(const T& in1)` and `Hash(const T& in1, const T& in2)` available for calculating the double-SHA256 hash of one object or two concatenated objects, respectively:

  b5868f4b1f/src/hash.h (L74-L89)

  This PR uses them in order to increase readability and simplify the code. As in #15294 (which inspired this PR, doing the same for RIPEMD160), the helper is not utilized in validation.cpp and  script/interpreter.cpp to avoid touching consensus-relevant code.

ACKs for top commit:
  john-moffett:
    ACK 87f11ef47f
  stickies-v:
    ACK 87f11ef47f
  MarcoFalke:
    review ACK 87f11ef47f  😬

Tree-SHA512: 11d7e3d00c89685107784010fbffb33ccafb4d1b6a76c4dceb937b29bb234ef4d54581b16bd0737c8d2994a90cf4fe10a9738c7cc5b6d085c6a819f06176dab9
2023-02-01 15:56:30 +01:00
MarcoFalke
fa6986a66b
ci: Print iwyu patch in git diff format 2023-02-01 14:11:48 +01:00