Commit graph

40176 commits

Author SHA1 Message Date
fanquake
d0a9e339a9
Merge bitcoin/bitcoin#29469: doc: document preference for list-initialization
eb5d78c649 doc: document preference for list-initialization (Andrew Toth)

Pull request description:

  Variable initialization is very complex in C++. There seems to be some consensus that when in doubt, use list-initialization.

  https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Res-list
  https://www.learncpp.com/cpp-tutorial/variable-assignment-and-initialization/

ACKs for top commit:
  maflcko:
    ACK eb5d78c649

Tree-SHA512: 80d52b062d9e3a0115242779b11385ab583b4c71b27725f63b0a8f82174c04718a57f55a7c1a6df76b405102b175c66abb479589caf363e5d12784e78ad04a93
2024-02-26 10:56:16 +00:00
fanquake
edefcd51f7
Merge bitcoin/bitcoin#29470: test: Add option to skip python unit tests
5f240ab2e8 test: Add option to skip unit tests for the test runner (Martin Zumsande)

Pull request description:

  In the python `test_runner`, it's possible to disable specific functional tests (or just enable a few specific ones), but the unit tests for the python test framework cannot be skipped.
  Add this option (`--skipunit` or `-u`), it would save some time for devs not interested in running those every time.

ACKs for top commit:
  fjahr:
    re-ACK 5f240ab2e8
  tdb3:
    Code review and tested ACK 5f240ab2e8
  stratospher:
    tested ACK 5f240ab.

Tree-SHA512: f7c9cfefc18a6510e24ca4601309b40fdf4180a4c5fe592be9cf7607be6541784b283c46c8d6e60740ff3eba83025dd5d0db36e55bf8bad1404b38120859e113
2024-02-26 10:54:56 +00:00
fanquake
eaede27655
Merge bitcoin/bitcoin#29408: lint: Check for missing bitcoin-config.h includes
fa58ae74ea refactor: Add missing include for USE_BDB, USE_SQLITE to bench/wallet_ismine.cpp (MarcoFalke)
fa31908ea8 lint: Check for missing or redundant bitcoin-config.h includes (MarcoFalke)
fa63b0e351 lint: Make lint error easier to spot in output (MarcoFalke)
fa770fd368 doc: Add missing RUST_BACKTRACE=1 (MarcoFalke)
fa10051267 lint: Add get_subtrees() helper (MarcoFalke)

Pull request description:

  Missing `bitcoin-config.h` includes are problematic, because the build could silently pass, but produce an unintended result. For example, a slower fallback algorithm could be picked, even though `bitcoin-config.h` indicates that a faster feature is available and should be used.

  As the build succeeds silently, this problem is not possible to detect with iwyu.

  Thus, fix this by using a linter based on grepping the source code.

ACKs for top commit:
  theuni:
    Weak ACK fa58ae74ea.
  TheCharlatan:
    ACK fa58ae74ea
  hebasto:
    ACK fa58ae74ea, tested on Ubuntu 23.10 -- it catches bugs properly. I didn't review rust code changes.

Tree-SHA512: cf4346f81ea5b8c215da6004cb2403d1aaf569589613c305d8ba00329b82b3841da94fe1a69815ce15f2edecbef9b031758ec9b6433564976190e3cf91ec8181
2024-02-26 10:32:28 +00:00
fanquake
bd1c66f3a8
Merge bitcoin/bitcoin#29461: ci: avoid running git diff after patching
84388c942c ci: avoid running git diff after patching (Ryan Ofsky)

Pull request description:

  Drop `git diff` command so it is easier to run CI locally if git checkout is a worktree. Currently it fails because the directory is not recognized as a git repository.

  The `git diff` command was added recently in #28359 commit fa07ac48d8 and can be avoided just by teeing the patch to stdout

ACKs for top commit:
  maflcko:
    lgtm ACK 84388c942c
  TheCharlatan:
    ACK 84388c942c

Tree-SHA512: 089c8ff62f9c56a1df06686e72420a9a54a079d2ef9eaf7c9cfcd97cb5cce50c8c169890e599ef875aaf1ee426f590851b1f19d6c9e386671460ee6507d8d872
2024-02-26 10:25:58 +00:00
Martin Zumsande
5f240ab2e8 test: Add option to skip unit tests for the test runner 2024-02-23 17:12:40 -05:00
Andrew Toth
eb5d78c649
doc: document preference for list-initialization 2024-02-23 13:19:19 -05:00
Ava Chow
1ac627c485
Merge bitcoin/bitcoin#29462: [fuzz] Avoid partial negative result
9dae3b970a [fuzz] Avoid partial negative result (Murch)

Pull request description:

  May address the problem reported by maflcko in https://github.com/bitcoin/bitcoin/pull/27877#pullrequestreview-1890304914.

  For some values, `MAX_MONEY - max_spendable - max_output_groups` could result in a partial negative value. By putting the addition of `group_pos.size()` first, all partial results in this line will be strictly positive.

  I opened this as a draft, since I was unable to reproduce the issue, so I’m waiting for confirmation whether this in fact mitigates the problem.

ACKs for top commit:
  maflcko:
    ACK 9dae3b970a
  sipa:
    utACK 9dae3b970a
  achow101:
    ACK 9dae3b970a
  brunoerg:
    crACK 9dae3b970a

Tree-SHA512: 744b4706268d8dfd77538b99492ecf3cf77d229095f9bcd416a412131336830e2f134f2b2846c79abd3d193426f97c1f71eeaf68b16ab00e76318d57ee3673c7
2024-02-22 08:59:30 -05:00
Murch
9dae3b970a [fuzz] Avoid partial negative result 2024-02-21 15:49:05 -05:00
Ava Chow
88b1229c13
Merge bitcoin/bitcoin#29400: test: Fix SegwitV0SignatureMsg nLockTime signedness
fab15723b0 test: Fix SegwitV0SignatureMsg nLockTime signedness (MarcoFalke)

Pull request description:

  It is unsigned in Bitcoin Core, so the tests should match it:

  5b8990a1f3/src/script/interpreter.cpp (L1611)

  The bug was introduced when the code was written in 330b0f31ee.

  (Lowercase `i` means signed, see https://docs.python.org/3/library/struct.html#format-characters)

ACKs for top commit:
  epiccurious:
    Tested ACK fab15723b0.
  Eunovo:
    Tested ACK fab15723b0
  achow101:
    ACK fab15723b0

Tree-SHA512: 68cb8582f6af22e6abb2fc9d6770277501baa0f9873e2e8d47699e87096fc5d4b9de45fa07199757b6e945c99d4c4ea95f01478322f2c093ef95cf5e0c78522b
2024-02-21 13:16:51 -05:00
Ryan Ofsky
84388c942c ci: avoid running git diff after patching
Drop `git diff` command so it is easier to run CI locally if git checkout is a
worktree. Currently it fails because the directory is not recognized as a git
repository.

The `git diff` command was added recently in #28359 commit
fa07ac48d8 and can be avoided just by teeing the
patch to stdout
2024-02-21 11:16:56 -05:00
fanquake
2ac41ef15f
Merge bitcoin/bitcoin#29460: test: assert rpc error for addnode v2transport not enabled
345169a752 test: assert rpc error for addnode v2transport not enabled (kevkevin)

Pull request description:

  Added coverage for the `addnode` rpc when v2transport is not enabled,
  but is set as true when calling `addnode` rpc.

  I ran the following to check if this rpc error message
  was covered in the functional tests.
  `grep -nr "v2transport requested but not enabled" ./test/functional --binary-files=without-match`

  Adds test coverage to this line.
  https://github.com/bitcoin/bitcoin/blob/master/src/rpc/net.cpp#L339

ACKs for top commit:
  maflcko:
    lgtm ACK 345169a752
  brunoerg:
    utACK 345169a752
  BrandonOdiwuor:
    Code Review ACK 345169a752
  theStack:
    Code-review ACK 345169a752

Tree-SHA512: fb82409485efe25a1193b1dafca8ae694b397a301bb8bcb33c7572d21ff244ee45fbbd4364141e9421733873b343554a34614a59b1450ce0cac5c420203c3d35
2024-02-21 15:35:15 +00:00
fanquake
46d261631d
Merge bitcoin/bitcoin#29456: docs: ci multi-arch requires qemu
540282905d docs: ci multi-arch requires qemu (Max Edwards)

Pull request description:

  On a fresh Debian system qemu isn't installed and therefore the multi-architecture CI system doesn't run.

  This documentation notes that qemu is required and how to install it.

ACKs for top commit:
  maflcko:
    lgtm ACK 540282905d
  willcl-ark:
    utACK 540282905d

Tree-SHA512: 903c12cf7b16f2146b99a952577c5550d60faf65f9e72b9f4d9479b52228118ab46349e5130de5281b39da05d3bc0b4ae8a8165601e62ce145647a98ef197131
2024-02-21 14:52:36 +00:00
kevkevin
345169a752
test: assert rpc error for addnode v2transport not enabled
Added coverage for the addnode rpc when v2transport is not enabled but
is set as true when calling addnode rpc
2024-02-20 22:04:53 -06:00
MarcoFalke
fa58ae74ea
refactor: Add missing include for USE_BDB, USE_SQLITE to bench/wallet_ismine.cpp
It was included indirectly via src/wallet/test/util.h, however it is
better to include what you use.
2024-02-20 15:11:58 +01:00
MarcoFalke
fa31908ea8
lint: Check for missing or redundant bitcoin-config.h includes 2024-02-20 15:03:23 +01:00
MarcoFalke
fa63b0e351
lint: Make lint error easier to spot in output 2024-02-20 15:03:16 +01:00
MarcoFalke
fa770fd368
doc: Add missing RUST_BACKTRACE=1
This will print a backtrace when an internal code error happened.
2024-02-20 15:02:15 +01:00
MarcoFalke
fa10051267
lint: Add get_subtrees() helper
This is needed for a future change.
2024-02-20 15:02:12 +01:00
fanquake
45b2a91897
Merge bitcoin/bitcoin#29404: refactor: bitcoin-config.h includes cleanup
9d1dbbd4ce scripted-diff: Fix bitcoin_config_h includes (TheCharlatan)

Pull request description:

  As mentioned in https://github.com/bitcoin/bitcoin/pull/26924#issuecomment-1403449932 and https://github.com/bitcoin/bitcoin/pull/29263#issuecomment-1922334399, it is currently not safe to remove `bitcoin-config.h` includes from headers because some unrelated file might be depending on it.

  See also #26972 for discussion.

  Solve this by including the file directly everywhere it's required, regardless of whether or not it's already included by another header.

  There should be no functional change here, but it will allow us to safely remove includes from headers in the future.

  ~I'm afraid it's a bit tedious to reproduce these commits, but it's reasonably straightforward:~
  Edit: See note below

  ```bash
  # All commands executed from the src/ subdir.

  # Collect all tokens from bitcoin-config.h.in
  # Isolate the tokens and remove blank lines
  # Replace newlines with | and remove the last trailing one
  # Collect all files which use these tokens
  # Filter out subprojects (proper forwarding can be verified from Makefiles)
  # Filter out .rc files
  # Save to a text file
  git grep -E -l `grep undef config/bitcoin-config.h.in | cut -d" " -f2 | grep -v '^$' | tr '\n' '|' | sed 's/|$//'` | grep -v -e "^leveldb/" -e "^secp256k1/" -e "^crc32c/" -e "^minisketch/" -e "^Makefile" -e "\.rc$" > files-with-config-include.txt

  # Find all files from the above list which don't include bitcoin-config.h
  git grep -L -E "config/bitcoin-config.h" -- `cat files-with-config-include.txt`

  # Include them manually with the exception of some files in crypto:
  # crypto/sha256_arm_shani.cpp crypto/sha256_avx2.cpp crypto/sha256_sse41.cpp crypto/sha256_x86_shani.cpp
  # These are exceptions which don't use bitcoin-config.h, rather the Makefile.am adds these cppflags manually.

  # Commit changes. This should match the first commit of this PR.

  # Use the same search as above to find all files which DON'T use any config tokens
  git grep -E -L `grep undef config/bitcoin-config.h.in | cut -d" " -f2 | grep -v '^$' | tr '\n' '|' | sed 's/|$//'` | grep -v -e "^leveldb/" -e "^secp256k1/" -e "^crc32c/" -e "^minisketch/" -e "^Makefile" -e "\.rc$" > files-without-config-include.txt

  # Manually remove the includes and commit changes. This should match the second commit of this PR.
  ```

  Edit: I'll keep this old description for posterity, but the manual approach has been replaced with a scripted diff from TheCharlatan

ACKs for top commit:
  maflcko:
    ACK 9d1dbbd4ce 🚪
  TheCharlatan:
    ACK 9d1dbbd4ce
  hebasto:
    ACK 9d1dbbd4ce, I have reviewed the code and it looks OK.
  fanquake:
    ACK 9d1dbbd4ce

Tree-SHA512: f11ddc4ae6a887f96b954a6b77f310558ddb271088a3fda3edc833669c4251b7f392515224bbb8e5f67eb2c799b4ffed3b07d96454e82ec635c686d0df545872
2024-02-20 13:07:48 +00:00
Hennadii Stepanov
d301c99554
Merge bitcoin-core/gui#797: test: Recognize dialog object by name
4c9db9b587 qt, test: Recognize dialog object by name (Hennadii Stepanov)

Pull request description:

  Fixes https://github.com/bitcoin-core/gui/issues/796.

ACKs for top commit:
  furszy:
    Code ACK 4c9db9b587
  BrandonOdiwuor:
    ACK 4c9db9b587

Tree-SHA512: bd54a95d3ef77bce189c2ce279c6b3b4045bdc749e115045bfd7beda73be5a553e145eb331f454cb50374c5a9e98e73794d72d43aa1887dc42bcc585ca17d10c
2024-02-20 11:36:07 +00:00
Max Edwards
540282905d docs: ci multi-arch requires qemu 2024-02-20 10:55:33 +00:00
fanquake
bdddf364c9
Merge bitcoin/bitcoin#29441: ci: Avoid CI failures from temp env file reuse
fa91bf2559 ci: Skip git install if it is already installed (MarcoFalke)
c65fde4831 ci: vary /tmp/env (Sjors Provoost)

Pull request description:

  * Currently, running separate CI tasks at the same time may intermittently fail, because they race to read/write `/tmp/env`. Fix this by adding `$CONTAINER_NAME` to the file name.

  * Also, add `$USER`, while touching the line, to allow different users to run the same CI task at the same time.

  * Also, skip the git install if there is no need.

  Ref: https://github.com/bitcoin/bitcoin/pull/29274

ACKs for top commit:
  Sjors:
    ACK fa91bf2559
  BrandonOdiwuor:
    ACK fa91bf2559
  hebasto:
    ACK fa91bf2559.

Tree-SHA512: 9a8479255a2afb6618f9d0796488d9430ba95266b90ce39536a9817c1974ca4049beeaab5355a38b25171f76fc386dbec06b1919aaa079f08a5a0c0a146232c8
2024-02-20 10:21:44 +00:00
fanquake
b1a46b212f
Merge bitcoin/bitcoin#26008: wallet: cache IsMine scriptPubKeys to improve performance of descriptor wallets
e041ed9b75 wallet: Retrieve ID from loaded DescSPKM directly (Ava Chow)
39640dd34e wallet: Use scriptPubKeyCache in GetSolvingProvider (Ava Chow)
b410f68791 wallet: Use scriptPubKey cache in GetScriptPubKeyMans (Ava Chow)
edf4e73a16 wallet: Use scriptPubKey cache in IsMine (Ava Chow)
37232332bd wallet: Cache scriptPubKeys for all DescriptorSPKMs (Ava Chow)
99a0cddbc0 wallet: Introduce a callback called after TopUp completes (Ava Chow)
b276825932 bench: Add a benchmark for ismine (Ava Chow)

Pull request description:

  Wallets that have a ton of non-ranged descriptors (such as a migrated non-HD wallet) perform fairly poorly due to looping through all of the wallet's `ScriptPubKeyMan`s. This is done in various places, such as `IsMine`, and helper functions for fetching a `ScriptPubKeyMan` and a `SolvingProvider`. This also has a bit of a performance impact on standard descriptor wallets, although less noticeable due to the small number of SPKMs.

  As these functions are based on doing `IsMine` for each `ScriptPubKeyMan`, we can improve this performance by caching `IsMine` scriptPubKeys for all descriptors and use that to determine which `ScriptPubKeyMan` to actually use for those things. This cache is used exclusively and we no longer iterate the SPKMs.

  Also added a benchmark for `IsMine`.

ACKs for top commit:
  ryanofsky:
    Code review ACK e041ed9b75. Just suggested changes since last review
  josibake:
    ACK e041ed9b75
  furszy:
    Code review ACK e041ed9b

Tree-SHA512: 8e7081991a025e682e9dea838b4543b0d179832d1c47397fb9fe7a97fa01eb699c15a5d5a785634926844fc83a46e6ac07ef753119f39d84423220ef8a548894
2024-02-20 10:17:46 +00:00
Ava Chow
c265aad5b5
Merge bitcoin/bitcoin#29434: rpc: Fixed signed integer overflow for large feerates
dddd7be9bf doc: Clarify maxfeerate help (MarcoFalke)
fa2a4fdef7 rpc: Fixed signed integer overflow for large feerates (MarcoFalke)
fade94d11a rpc: Add ParseFeeRate helper (MarcoFalke)
fa0ff66109 rpc: Implement RPCHelpMan::ArgValue<> for UniValue (MarcoFalke)

Pull request description:

  Passing large BTC/kvB feerates to RPCs is problematic, because:

  * They are likely a typo. 1BTC/kvB (or larger) seems absurd.
  * They may cause signed integer overflow.
  * Anyone really wanting to pick such a large value can set `0` to disable the check.

  Fix all issues by rejecting anything more than 1BTC/kvB during parsing.

ACKs for top commit:
  brunoerg:
    crACK dddd7be9bf
  achow101:
    ACK dddd7be9bf
  vasild:
    ACK dddd7be9bf
  tdb3:
    Code review ACK and basic test ACK for dddd7be9bf.
  fjahr:
    utACK dddd7be9bf

Tree-SHA512: 5dcce1f0abe059dc6b2ff56787e11081d73a45b4ddd6dcc2c1ea13709ebc13af5e7265e84fffb97ef32027b56b81955672a67ed7702e8fa30c2e849d67727bac
2024-02-19 13:31:13 -05:00
glozow
ddf1d72cc2
Merge bitcoin/bitcoin#29452: doc: document that BIP324 on by default for v27.0
0d3e18bcd6 doc: document that BIP324 on by default for v27.0 (fanquake)

Pull request description:

  Addresses: https://github.com/bitcoin/bitcoin/pull/29347#issuecomment-1952335331.

ACKs for top commit:
  maflcko:
    lgtm ACK 0d3e18bcd6
  sipa:
    ACK 0d3e18bcd6
  theStack:
    ACK 0d3e18bcd6

Tree-SHA512: a2af6dbba2740e5cf9c51660059d39577f3744e2adf554222bbc2eac454a161c2e68111797a7cbe34943fe2a424f5fadbeeffcd6f7ae42e3333878875ac43424
2024-02-19 16:08:56 +00:00
fanquake
0d3e18bcd6
doc: document that BIP324 on by default for v27.0 2024-02-19 15:37:59 +00:00
Hennadii Stepanov
4c9db9b587
qt, test: Recognize dialog object by name 2024-02-19 13:53:47 +00:00
Ava Chow
e041ed9b75 wallet: Retrieve ID from loaded DescSPKM directly
Instead of iterating m_spk_managers a DescriptorSPKM has been loaded in
order to get it's ID to compare, have LoadDescriptorSPKM return a
reference to the loaded DescriptorSPKM so it can be queried directly.
2024-02-16 14:36:10 -05:00
Ava Chow
39640dd34e wallet: Use scriptPubKeyCache in GetSolvingProvider 2024-02-16 14:36:10 -05:00
Ava Chow
b410f68791 wallet: Use scriptPubKey cache in GetScriptPubKeyMans 2024-02-16 14:36:10 -05:00
Ava Chow
edf4e73a16 wallet: Use scriptPubKey cache in IsMine 2024-02-16 14:36:10 -05:00
Ava Chow
37232332bd wallet: Cache scriptPubKeys for all DescriptorSPKMs
Have CWallet maintain a cache of all known scriptPubKeys for its
DescriptorSPKMs in order to improve performance of the functions that
require searching for scriptPubKeys.
2024-02-16 14:36:09 -05:00
Ava Chow
99a0cddbc0 wallet: Introduce a callback called after TopUp completes
After TopUp completes, the wallet containing each SPKM will want to know
what new scriptPubKeys were generated. In order for all TopUp calls
(including ones internal the the SPKM), we use a callback function in
the WalletStorage interface.
2024-02-16 14:35:39 -05:00
Ava Chow
b276825932 bench: Add a benchmark for ismine 2024-02-16 14:35:33 -05:00
MarcoFalke
fa91bf2559
ci: Skip git install if it is already installed
This also avoids the sudo requirement for self-hosted CI runners.
2024-02-16 16:06:45 +01:00
fanquake
3cbc8cbc71
Merge bitcoin/bitcoin#28037: rpc: Drop migratewallet experimental warning
f1684bb88a rpc: mention that migratewallet can take a while (Andrew Chow)
9ecff997e1 rpc: Drop migratewallet experimental warning (Andrew Chow)

Pull request description:

  The migration process itself hasn't fundamentally changed since it was added, so I think it's reasonable to say that it is no longer experimental.

ACKs for top commit:
  maflcko:
    lgtm ACK f1684bb88a
  josibake:
    ACK f1684bb88a
  furszy:
    ACK f1684bb88a
  ryanofsky:
    Code review ACK f1684bb88a
  willcl-ark:
    ACK f1684bb88a

Tree-SHA512: 99b176cddbf3878c76bd4c80c030106200bf03139785e26dbae3341e1a675b623a13cd6dc7a0bb78344335bf859ae7548d97b2b58eb650c6e7b305d7cdc86e40
2024-02-16 12:28:05 +00:00
fanquake
dfff8ee02e
Merge bitcoin/bitcoin#29414: doc: Update translation process guide
3b0ec06d62 doc: Update translation_process.md (pablomartin4btc)

Pull request description:

  Updating Transifex broken link and setup Transifex config file with a token.

ACKs for top commit:
  hebasto:
    ACK 3b0ec06d62.
  hernanmarino:
    ACK 3b0ec06d62

Tree-SHA512: fc8e537a7d244e2e5983763ff7bd017a796359b2baf2119809c2fa051f43ba8a7bcbf5aef0687bc86c8badf5abc4b67cf2e0252f9e2ee14cafb50612dd51f3f7
2024-02-16 12:24:59 +00:00
MarcoFalke
dddd7be9bf
doc: Clarify maxfeerate help 2024-02-15 19:46:45 +01:00
MarcoFalke
fa2a4fdef7
rpc: Fixed signed integer overflow for large feerates 2024-02-15 10:56:01 +01:00
MarcoFalke
fade94d11a
rpc: Add ParseFeeRate helper 2024-02-15 10:55:47 +01:00
pablomartin4btc
3b0ec06d62 doc: Update translation_process.md
Updating Transifex broken link and remove Transifex config file
section as it has been outdated.
2024-02-14 21:39:39 -03:00
MarcoFalke
fa0ff66109
rpc: Implement RPCHelpMan::ArgValue<> for UniValue 2024-02-14 17:17:25 +01:00
Hennadii Stepanov
baed5edeb6
Merge bitcoin-core/gui#793: Update translation source file for v27.0 string freeze
3d1bb1a122 qt: Update translation source file for v27.0 string freeze (Hennadii Stepanov)

Pull request description:

  This PR updates the `src/qt/locale/bitcoin_en.xlf` translation source file according to the [Release schedule for 27.0](https://github.com/bitcoin/bitcoin/issues/29028).

  Note for reviewers: it is expected to get a zero diff after running `make -C src translate` locally.

ACKs for top commit:
  jarolrod:
    ACK 3d1bb1a122

Tree-SHA512: 9b6e5aa3aaabb918d0a6418559bc3eb14297abc48b99e8c6e6de770aa1478b8b28881f8965fd15fe23cf4aa377b88ba903e978c8b75681c4f11e428ca1588b96
2024-02-13 20:18:52 +00:00
TheCharlatan
9d1dbbd4ce scripted-diff: Fix bitcoin_config_h includes
-BEGIN VERIFY SCRIPT-

regex_string='^(?!//).*(AC_APPLE_UNIVERSAL_BUILD|BOOST_PROCESS_USE_STD_FS|CHAR_EQUALS_INT8|CLIENT_VERSION_BUILD|CLIENT_VERSION_IS_RELEASE|CLIENT_VERSION_MAJOR|CLIENT_VERSION_MINOR|COPYRIGHT_HOLDERS|COPYRIGHT_HOLDERS_FINAL|COPYRIGHT_HOLDERS_SUBSTITUTION|COPYRIGHT_YEAR|ENABLE_ARM_SHANI|ENABLE_AVX2|ENABLE_EXTERNAL_SIGNER|ENABLE_SSE41|ENABLE_TRACING|ENABLE_WALLET|ENABLE_X86_SHANI|ENABLE_ZMQ|HAVE_BOOST|HAVE_BUILTIN_CLZL|HAVE_BUILTIN_CLZLL|HAVE_BYTESWAP_H|HAVE_CLMUL|HAVE_CONSENSUS_LIB|HAVE_CXX20|HAVE_DECL_BE16TOH|HAVE_DECL_BE32TOH|HAVE_DECL_BE64TOH|HAVE_DECL_BSWAP_16|HAVE_DECL_BSWAP_32|HAVE_DECL_BSWAP_64|HAVE_DECL_FORK|HAVE_DECL_FREEIFADDRS|HAVE_DECL_GETIFADDRS|HAVE_DECL_HTOBE16|HAVE_DECL_HTOBE32|HAVE_DECL_HTOBE64|HAVE_DECL_HTOLE16|HAVE_DECL_HTOLE32|HAVE_DECL_HTOLE64|HAVE_DECL_LE16TOH|HAVE_DECL_LE32TOH|HAVE_DECL_LE64TOH|HAVE_DECL_PIPE2|HAVE_DECL_SETSID|HAVE_DECL_STRERROR_R|HAVE_DEFAULT_VISIBILITY_ATTRIBUTE|HAVE_DLFCN_H|HAVE_DLLEXPORT_ATTRIBUTE|HAVE_ENDIAN_H|HAVE_EVHTTP_CONNECTION_GET_PEER_CONST_CHAR|HAVE_FDATASYNC|HAVE_GETENTROPY_RAND|HAVE_GETRANDOM|HAVE_GMTIME_R|HAVE_INTTYPES_H|HAVE_LIBADVAPI32|HAVE_LIBCOMCTL32|HAVE_LIBCOMDLG32|HAVE_LIBGDI32|HAVE_LIBIPHLPAPI|HAVE_LIBKERNEL32|HAVE_LIBOLE32|HAVE_LIBOLEAUT32|HAVE_LIBSHELL32|HAVE_LIBSHLWAPI|HAVE_LIBUSER32|HAVE_LIBUUID|HAVE_LIBWINMM|HAVE_LIBWS2_32|HAVE_MALLOC_INFO|HAVE_MALLOPT_ARENA_MAX|HAVE_MINIUPNPC_MINIUPNPC_H|HAVE_MINIUPNPC_UPNPCOMMANDS_H|HAVE_MINIUPNPC_UPNPERRORS_H|HAVE_NATPMP_H|HAVE_O_CLOEXEC|HAVE_POSIX_FALLOCATE|HAVE_PTHREAD|HAVE_PTHREAD_PRIO_INHERIT|HAVE_STDINT_H|HAVE_STDIO_H|HAVE_STDLIB_H|HAVE_STRERROR_R|HAVE_STRINGS_H|HAVE_STRING_H|HAVE_STRONG_GETAUXVAL|HAVE_SYSCTL|HAVE_SYSCTL_ARND|HAVE_SYSTEM|HAVE_SYS_ENDIAN_H|HAVE_SYS_PRCTL_H|HAVE_SYS_RESOURCES_H|HAVE_SYS_SELECT_H|HAVE_SYS_STAT_H|HAVE_SYS_SYSCTL_H|HAVE_SYS_TYPES_H|HAVE_SYS_VMMETER_H|HAVE_THREAD_LOCAL|HAVE_TIMINGSAFE_BCMP|HAVE_UNISTD_H|HAVE_VM_VM_PARAM_H|LT_OBJDIR|PACKAGE_BUGREPORT|PACKAGE_NAME|PACKAGE_STRING|PACKAGE_TARNAME|PACKAGE_URL|PACKAGE_VERSION|PTHREAD_CREATE_JOINABLE|QT_QPA_PLATFORM_ANDROID|QT_QPA_PLATFORM_COCOA|QT_QPA_PLATFORM_MINIMAL|QT_QPA_PLATFORM_WINDOWS|QT_QPA_PLATFORM_XCB|QT_STATICPLUGIN|STDC_HEADERS|STRERROR_R_CHAR_P|USE_ASM|USE_BDB|USE_DBUS|USE_NATPMP|USE_QRCODE|USE_SQLITE|USE_UPNP|_FILE_OFFSET_BITS|_LARGE_FILES)'

exclusion_files=":(exclude)src/minisketch :(exclude)src/crc32c :(exclude)src/secp256k1 :(exclude)src/crypto/sha256_arm_shani.cpp :(exclude)src/crypto/sha256_avx2.cpp :(exclude)src/crypto/sha256_sse41.cpp :(exclude)src/crypto/sha256_x86_shani.cpp"

git grep --perl-regexp --files-with-matches "$regex_string" -- '*.cpp' $exclusion_files | xargs git grep -L "bitcoin-config.h" | while read -r file; do line_number=$(awk -v my_file="$file" '/\/\/ file COPYING or https?:\/\/www.opensource.org\/licenses\/mit-license.php\./ {line = NR} /^\/\// && NR == line + 1 {while(getline && /^\/\//) line = NR} END {print line+1}' "$file"); sed -i "${line_number}i\\\\n\#if defined(HAVE_CONFIG_H)\\n#include <config/bitcoin-config.h>\\n\#endif" "$file"; done;

git grep --perl-regexp --files-with-matches "$regex_string" -- '*.h' $exclusion_files | xargs git grep -L "bitcoin-config.h" | while read -r file; do sed -i "/#define.*_H/a \\\\n\#if defined(HAVE_CONFIG_H)\\n#include <config/bitcoin-config.h>\\n\#endif" "$file"; done;

for file in $(git grep --files-with-matches 'bitcoin-config.h' -- '*.cpp' '*.h' $exclusion_files); do if ! grep -q --perl-regexp "$regex_string" $file; then sed -i '/HAVE_CONFIG_H/{N;N;N;d;}' $file; fi; done;

-END VERIFY SCRIPT-

The first command creates a regular expression for matching all bitcoin-config.h symbols in the following form: ^(?!//).*(AC_APPLE_UNIVERSAL_BUILD|BOOST_PROCESS_USE_STD_FS|...|_LARGE_FILES). It was generated with:
./autogen.sh && printf '^(?!//).*(%s)' $(awk '/^#undef/ {print $2}' src/config/bitcoin-config.h.in | paste -sd "|" -)

The second command holds a list of files and directories that should not be processed. These include subtree directories as well as some crypto files that already get their symbols through the makefile.

The third command checks for missing bitcoin-config headers in .cpp files and adds the header if it is missing.

The fourth command checks for missing bitcoin-config headers in .h files and adds the header if it is missing.

The fifth command checks for unneeded bitcoin-config headers in sources files and removes the header if it is unneeded.
2024-02-13 20:10:44 +00:00
Ava Chow
128b4a8038
Merge bitcoin/bitcoin#29403: wallet: batch erase procedures and improve 'EraseRecords' performance
77331aa2a1 wallet: simplify EraseRecords by using 'ErasePrefix' (furszy)
33757814ce wallet: bdb batch 'ErasePrefix', do not create txn internally (furszy)
cf4d72a75e wallet: db, introduce 'RunWithinTxn()' helper function (furszy)

Pull request description:

  Seeks to optimize and simplify `WalletBatch::EraseRecords`. Currently, this process opens a cursor to iterate over the entire database, searching for records that match the type prefixes, to then call the `WalletBatch::Erase` function for each of the matching records.
  This PR rewrites this 40-line manual process into a single line; instead of performing all of those actions manually, we can simply utilize the `ErasePrefix()` functionality. The result is 06216b344dea6ad6c385fda0b37808ff9ae5273b.

  Moreover, it expands the test coverage for the `ErasePrefix` functionality and documents the db txn requirement for `BerkeleyBatch::ErasePrefix` .

ACKs for top commit:
  achow101:
    reACK 77331aa2a1
  josibake:
    code review ACK 77331aa2a1

Tree-SHA512: 9f78dda658677ff19b5979ba0efd11cf9fabf3d315feb79ed1160526f010fe843c41903fc18c0b092f78aa88bc874cf24edad8fc1ea6e96aabdc4fd1daf21ca5
2024-02-13 13:08:30 -05:00
fanquake
d7dabdbfcd
Merge bitcoin/bitcoin#29413: fuzz: increase length of string used for NetWhitelist{bind}Permissions::TryParse
864e2e9097 fuzz: increase length of string used for `NetWhitelist{bind}Permissions::TryParse` (brunoerg)

Pull request description:

  The string `s` represents the value from `-whitelist`/`-whitebind` (e.g. "bloom,forcerelay,noban@1.2.3.4:32") and it is used in `NetWhitelistPermissions::TryParse` and `NetWhitebindPermissions::TryParse`. However, a max length of 32 is not enough to cover a lot of cases. Even disconsidering the permissions, 32 would not be enough to cover a lot of addresses. This PR fixes it.

ACKs for top commit:
  maflcko:
    lgtm ACK 864e2e9097
  epiccurious:
    utACK 864e2e9097.
  vasild:
    ACK 864e2e9097

Tree-SHA512: 2b89031b9f2ea92d636f05fd167b1e5ac726742a7e7c1af8ddaeaf90236e659731aaa6b7c23f65ec16ce52ac1b9e68e7b16e23c59e355312d057e001976d172a
2024-02-13 11:47:10 -03:00
fanquake
f83565db45
Merge bitcoin/bitcoin#29394: test, assumeutxo: Add test to ensure failure when mempool not empty
8d20602e55 test, assumeutxo: Add test to ensure failure when mempool not empty (Hernan Marino)

Pull request description:

  Add a test to ensure that loadtxoutset fails when the node's mempool is not empty, as suggested by maflcko  here: https://github.com/bitcoin/bitcoin/pull/27596#discussion_r1344713537

ACKs for top commit:
  maflcko:
    re-ACK 8d20602e55
  BrandonOdiwuor:
    ACK 8d20602e55

Tree-SHA512: 97c9668c0f38897934bf0d326515d898d4e682ff219deba9d751b35125b5cf33d51c9df116a74117ecf0394f28995a3d0cae1266b1e5acb4365ff4f309ce3f6c
2024-02-13 10:04:24 -03:00
fanquake
37fdf5a492
Merge bitcoin/bitcoin#29424: v3 followups
6b161cb82a [test] second child of a v3 tx can be replaced individually (glozow)
5c998a696c [refactor] use MAX_PUBKEYS_PER_MULTISIG instead of magic numbers in test (glozow)
a9346421db [test] PackageV3Checks with inheritance violation in mempool ancestor (glozow)
63b62e123e [doc] fix docs and comments from v3 (glozow)

Pull request description:

  Addresses final comments from #28948:
  - thread at https://github.com/bitcoin/bitcoin/pull/28948#discussion_r1483245289, using 87fc7f0a8d with some modifications
  - https://github.com/bitcoin/bitcoin/pull/28948#discussion_r1483769698
  - https://github.com/bitcoin/bitcoin/pull/28948#discussion_r1483776227
  - https://github.com/bitcoin/bitcoin/pull/28948#discussion_r1484427635
  - https://github.com/bitcoin/bitcoin/pull/28948#discussion_r1484467280
  - https://github.com/bitcoin/bitcoin/pull/28948#discussion_r1484531064
  - https://github.com/bitcoin/bitcoin/pull/28948#discussion_r1484992098
  - https://github.com/bitcoin/bitcoin/pull/28948#discussion_r1484992336
  - https://github.com/bitcoin/bitcoin/pull/28948#discussion_r1484994642

ACKs for top commit:
  instagibbs:
    ACK 6b161cb82a
  sdaftuar:
    utACK 6b161cb82a

Tree-SHA512: 584fce7810f4d704ee6ab51fdc7d42bab342140cae3d076f89b5e1966dd1dd8293cb25b3121e41a4dcd65f9d4a735102b9ab2e90f98aa770b84e21f4d35d63d3
2024-02-13 09:54:22 -03:00
fanquake
3054416f62
Merge bitcoin/bitcoin#29425: test: fix intermittent failure in wallet_reorgrestore.py
44d11532f8 test: fix intermittent failure in wallet_reorgrestore.py (Martin Zumsande)

Pull request description:

  By adding a missing `sync_blocks` call.
  There was a race at `node2` between connecting the block produced by `node0`, and using `-generate` to create new blocks itself. In the failed run, block generation started before connecting the block, resulting in a final block height that was smaller by 1 than expected.
  See https://github.com/bitcoin/bitcoin/issues/29392#issuecomment-1939541603 for a more detailed analysis of the failed run.

  Can be reproduced by adding a sleep to [this spot](6ff0aa089c/src/validation.cpp (L4217))  in `ChainstateManager::ProcessNewBlock()`:
  ```
  if (util::ThreadGetInternalName() == "msghand") {
      std::this_thread::sleep_for(0.2s);
  }
  ```
  which fails for me on master and succeeds with the fix.

  Fixes #29392

ACKs for top commit:
  maflcko:
    lgtm ACK 44d11532f8

Tree-SHA512: c08699e5ae348d4c0626022b519449d052f511d3f44601bcd8dac836a130a3f67fca149532e1e3690367ebfdcbcdd32e527170d039209c1f599ce861136ae29f
2024-02-13 09:43:08 -03:00
Hennadii Stepanov
3d1bb1a122
qt: Update translation source file for v27.0 string freeze
The diff is produced by running `make -C src translate`.
2024-02-13 11:11:52 +00:00