Commit Graph

45243 Commits

Author SHA1 Message Date
Hennadii Stepanov
800b7cc42c cmake: Add missed SSE41_CXXFLAGS 2025-05-20 11:14:17 +01:00
Hennadii Stepanov
028476e71f cmake: Remove ENABLE_ARM_SHANI from bitcoin-build-config.h
`ENABLE_ARM_SHANI` is already conditionally defined for the
`bitcoin_crypto` target, so defining it in `bitcoin-build-config.h` is
redundant.
2025-05-20 11:14:17 +01:00
Hennadii Stepanov
1e900528d2 cmake: Remove ENABLE_X86_SHANI from bitcoin-build-config.h
`ENABLE_X86_SHANI` is already conditionally defined for the
`bitcoin_crypto` target, so defining it in `bitcoin-build-config.h` is
redundant.
2025-05-20 11:12:56 +01:00
Hennadii Stepanov
8689628e2e cmake: Remove ENABLE_AVX2 from bitcoin-build-config.h
`ENABLE_AVX2` is already conditionally defined for the `bitcoin_crypto`
target, so defining it in `bitcoin-build-config.h` is redundant.
2025-05-20 11:12:56 +01:00
Hennadii Stepanov
a8e2342dca cmake: Remove ENABLE_SSE41 from bitcoin-build-config.h
`ENABLE_SSE41` is already conditionally defined for the `bitcoin_crypto`
target, so defining it in `bitcoin-build-config.h` is redundant.
2025-05-20 11:12:49 +01:00
MarcoFalke
fa76b378e4 rpc: Round verificationprogress to exactly 1 for a recent tip
This requires a new lock annotation, but all relevant callers already
held the lock.
2025-05-20 11:17:29 +02:00
MarcoFalke
faf6304bdf test: Use mockable time in GuessVerificationProgress
Also add a test.
2025-05-20 11:16:35 +02:00
fanquake
c7c3bfadfc doc: add & amend copyright headers 2025-05-20 09:43:21 +01:00
fanquake
f667000c83 contrib: remove outdated entries from copyright_header.py 2025-05-20 09:30:41 +01:00
fanquake
0817f2d6cf doc: update MIT license URL 2025-05-20 09:30:41 +01:00
fanquake
6854497b47 contrib: remove GPL-3+ from debian/copyright
This is unused.
2025-05-20 09:30:41 +01:00
merge-script
af65fd1a33 Merge bitcoin/bitcoin#32560: ci: Move DEBUG=1 to centos task
fa58d6cdab ci: Move DEBUG=1 to centos task (MarcoFalke)

Pull request description:

  The glibcxx debug mode has many bugs in prior gcc releases:

  * https://github.com/bitcoin/bitcoin/issues/32524#issuecomment-2890411766
  * https://github.com/bitcoin/bitcoin/issues/31436#issuecomment-2530717875
  * ...

  Instead of working around all of them, just use the existing `ci_native_centos` task with gcc-14 to have it enabled. This also follows the logic of other sanitizers (tsan, asan, ubsan, msan, valgrind, ...) to generally prefer the latest version of the sanitizer for the latests features and bugfixes.

  Fixes #32524.

  Also, while touching the `ci_native_previous_releases`, increase g0 to g2, so that it is easier for developers to use gdb inside the CI without having to re-compile

ACKs for top commit:
  hebasto:
    ACK fa58d6cdab.
  fanquake:
    ACK fa58d6cdab

Tree-SHA512: 26f151887bc39e88353b4ba1f91e913b830d24eac258b7caa0027aa592595150d5e713ededa3ed15a1b84165a94b14b0bfe3eb2fb7314d261d972b63ce01af43
2025-05-20 09:29:56 +01:00
merge-script
548f6b8cde Merge bitcoin/bitcoin#32562: doc: remove // for ... comments
7193245cd6 doc: remove For ... comments (fanquake)
1b9cdc933f net: drop win32 ifdef (fanquake)
19ba499b1f init: cerrno is used on all platforms (fanquake)

Pull request description:

  We don't add or maintain these, and they are of little value, as
  well as having the effect of polluting diffs, if changed.

  They are also wrong, i.e `DEFAULT_SCRIPTCHECK_THREADS` is not in
  `validation.h`.

ACKs for top commit:
  stickies-v:
    re-ACK 7193245cd6
  fjahr:
    ACK 7193245cd6
  willcl-ark:
    reACK 7193245cd6

Tree-SHA512: 6b5f83cd1df699356e1cbb78949f8d456b13ce288f0064138118cfb45b4c77e2d1945babe91598dffe9823ab07dfae36f4c3b61c586cf98baf16890bdf322b08
2025-05-20 09:28:46 +01:00
merge-script
7c87a0e3fb Merge bitcoin/bitcoin#32477: lint: Check for missing trailing newline
fa9198af55 lint: Check for missing trailing newline (MarcoFalke)
fa2b2aa27c lint: Add archived notes to default excludes (MarcoFalke)

Pull request description:

  A missing trailing newline is harmless, but a bit problematic:

  * `git` shows a warning by default
  * After another line is appended, the diff will be verbose and `git blame` will be wrong for the "untouched" line.

  Fix the problems by just requiring what is already the default, see also 663a9cabf8/.editorconfig (L9) and 663a9cabf8/test/lint/test_runner/src/main.rs (L327)

ACKs for top commit:
  l0rinc:
    utACK fa9198af55
  fanquake:
    ACK fa9198af55

Tree-SHA512: d144eebdeee68fc3404aa4a66ecd5c130f907ed4b869bd300f6e9ed74d125561d1f4cdd6dd20d9e969471a7d007399f928f072d1c1f626275ca31f32bc23fdbc
2025-05-20 09:25:09 +01:00
MarcoFalke
faf55fc80b doc: Remove ParseInt mentions in documentation
In the dev notes, remove the whole section, because:

* ParseDouble was removed in commit
  fa9d72a794
* The locale-dependent atoi is already checked by
  test/lint/lint-locale-dependence.py

Co-authored-by: Fabian Jahr <fjahr@protonmail.com>
2025-05-20 06:50:50 +02:00
Ava Chow
785e1407b0 wallet: Use util::Error throughout AddWalletDescriptor
32023 changed AddWalletDescriptor to return util::Error, but did not
change all of the failure cases to do so. This may result in some
callers continuing when there was actually an error. Unify all of the
failure cases to use util::Error so that all callers handle
AddWalletDescriptor errors in the same way.

The encapsulated return type is changed from ScriptPubKeyMan* to
std::reference_wrapper<DescriptorScriptPubKeyMan>. This avoids having a
value that can be interpreted as a bool, and also removes the need to
constantly dynamic_cast the returned value. The only kind of
ScriptPubKeyMan that can come out of AddWalletDescriptor is a
DescriptorScriptPubKeyMan anyways.
2025-05-19 18:09:56 -07:00
Cory Fields
1a37507895 validation: use a lock for CCheckQueueControl
Uses an RAII lock for the exact same behavior as the old critical sections.

Co-authored-by: Ryan Ofsky <ryan@ofsky.org>
2025-05-19 22:06:48 +00:00
Cory Fields
c3b0e6c7f4 validation: make CCheckQueueControl's CCheckQueue non-optional
This simplifies the construction logic and will allow the constructor and
destructor to lock and unlock uncondiationally.
2025-05-19 22:06:48 +00:00
Cory Fields
4c8c90b556 validation: only create a CCheckQueueControl if it's actually going to be used
This will allow CCheckQueueControl to require a CCheckQueue.
2025-05-19 22:06:48 +00:00
Cory Fields
11fed833b3 threading: add LOCK_ARGS macro
This is useful for initializing locks in a constructor.
2025-05-19 21:59:43 +00:00
Ryan Ofsky
33f8f8ae4c Merge bitcoin/bitcoin#30221: wallet: Ensure best block matches wallet scan state
30a94b1ab9 test, wallet: Remove concurrent writes test (Ava Chow)
b44b7c03fe wallet: Write best block record on unload (Ava Chow)
876a2585a8 wallet: Remove unnecessary database Close step on shutdown (Ava Chow)
98a1a5275c wallet: Remove chainStateFlushed (Ava Chow)
7fd3e1cf0c wallet, bench: Write a bestblock record in WalletMigration (Ava Chow)
6d3a8b195a wallet: Replace chainStateFlushed in loading with SetLastBlockProcessed (Ava Chow)
7bacabb204 wallet: Update best block record after block dis/connect (Ava Chow)

Pull request description:

  Implements the idea discussed in https://github.com/bitcoin/bitcoin/pull/29652#issuecomment-2010579484

  Currently, `m_last_block_processed` and `m_last_block_processed_height` are not guaranteed to match the block locator stored in the wallet, nor do either of those fields actually represent the last block that the wallet is synced up to. This is confusing and unintuitive.

  This PR changes those last block fields to be updated whenever the wallet makes a change to the db for new transaction state found in new blocks. Whenever a block is received that contains a transaction relevant to the wallet, the last block locator will now be written to disk. Furthermore, every block disconnection will now write an updated locator.

  To ensure that the locator is relatively recent and loading rescans are fairly quick in the event of unplanned shutdown, it is also now written every 144 blocks (~1 day). Additionally it is now written when the wallet is unloaded so that it is accurate when the wallet is loaded again.

  Lastly, the `chainstateFlushed` notification in the wallet is changed to be a no-op. The best block locator record is no longer written when `chainstateFlushed` is received from the node since it should already be mostly up to date.

ACKs for top commit:
  rkrux:
    ACK 30a94b1ab9
  mzumsande:
    Code Review ACK 30a94b1ab9
  ryanofsky:
    Code review ACK 30a94b1ab9. Only changes since last review are using WriteBestBlock method more places and updating comments.

Tree-SHA512: 46117541f8aaf13dde57430e813b4bbbd5e146e2632769675803c8e65a82f149a7cc6026489a127d32684b90124bd2b7c28216dbcfa6a47447300e8f3814e029
2025-05-19 15:50:51 -04:00
Hennadii Stepanov
7054d24f11 Merge bitcoin-core/gui#875: Use WitnessV0KeyHash in TestAddAddressesToSendBook
fa982f1425 Use WitnessV0KeyHash in TestAddAddressesToSendBook (MarcoFalke)

Pull request description:

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

  This fixes a bug introduced in commit fafee85358, which changed the type of the dummy address from `WitnessV0KeyHash` to `PKHash`. It was expected that this is fine, given that this is just a dummy address. However, the base58 characters can include the substring "io", leading to test failures later on.

  Fix it by just using `WitnessV0KeyHash` again.

  For reference, a passing test could look like:

  ```
  Model contains 2 rows and 2 columns.
  --- Model Data ---
  Row 0 : "io - new A\tmxgkqJWAwfUwbgzZUsWrG1stKWV6fDn8YH"
  Row 1 : "io - new B\tmhsxP2yrYDQiEncT8HzKxQSFSFJmUsudsP"
  ------------------
  ```

  A failing test could look like:

  ```
  Model contains 3 rows and 2 columns.
  --- Model Data ---
  Row 0 : "already here (s)\tmyDFZSKDQdPMMoSQgzkDtq2yioo8DA8qCX"
  Row 1 : "io - new A\tmsAqQKjMrbxYRDhGXBBJ3yUEQxj5Bf5Njz"
  Row 2 : "io - new B\tmtALQiit8dw33kznVfHDgE38ohfgz2Pchc"
  ------------------
  FAIL!  : AddressBookTests::addressBookTests() Compared values are not the same
     Actual   (table_view->model()->rowCount()): 3
     Expected (2)                              : 2
     Loc: [qt/test/addressbooktests.cpp(219)]
  ```

ACKs for top commit:
  achow101:
    ACK fa982f1425
  hebasto:
    ACK fa982f1425, I have reviewed the code along with the related changes from https://github.com/bitcoin/bitcoin/pull/32511.

Tree-SHA512: f55d7fe4193a0706e1a3ca1a2c0fbf2f04dc5b177699add00013ec56d64218ac85b80dad6e99f9fde26f4c9fca79f99e68ded057c5862364064404ac06b77176
2025-05-19 20:02:40 +01:00
Ryan Ofsky
4272966d02 Merge bitcoin/bitcoin#32423: rpc: Undeprecate rpcuser/rpcpassword, store all credentials hashed in memory
e49a7274a2 rpc: Avoid join-split roundtrip for user:pass for auth credentials (Vasil Dimov)
98ff38a6f1 rpc: Perform HTTP user:pass split once in `RPCAuthorized` (laanwj)
879a17bcb1 rpc: Store all credentials hashed in memory (laanwj)
4ab9bedee9 rpc: Undeprecate rpcuser/rpcpassword, change message to security warning (laanwj)

Pull request description:

  This PR does two things:

  ### Undeprecate rpcuser/rpcpassword, change message to security warning

  Back in 2015, in https://github.com/bitcoin/bitcoin/pull/7044, we added configuration option `rpcauth` for multiple RPC users. At the same time the old settings for single-user configuration `rpcuser` and `rpcpassword` were "soon" to be deprecated.

  The main reason for this deprecation is that while `rpcpassword` stores the password in plain text, `rpcauth` stores a hash, so it doesn't appear in the configuration in plain text.

  As the options are still in active use, actually removing them is expected to be a hassle to many, and it's not clear that is worth it. As for the security risk, in many kinds of setups (no wallet, containerized, single-user-single-application, local-only, etc) it is an unlikely point of escalation.

  In the end, it is good to encourage secure practices, but it is the responsibility of the user. Log a clear warning but remove the deprecation notice (this is also the only place where the options appear as deprecated, they were never marked as such in the -help output).

  <hr>

  ### Store all credentials hashed in memory

  This gets rid of the special-casing of `strRPCUserColonPass` by hashing cookies as well as manually provided `-rpcuser`/`-rpcpassword` with a random salt before storing them.

  Also take the opportunity to modernize the surrounding code a bit. There should be no end-user visible differences in behavior.

  <hr>

  Closes #29240.

ACKs for top commit:
  1440000bytes:
    utACK e49a7274a2
  janb84:
    reACK e49a7274a2
  vasild:
    ACK e49a7274a2

Tree-SHA512: 7162848ada4545bc07b5843d1ab6fb7e31fb26de8d6385464b7c166491cd122eac2ec5e70887c414fc136600482df8277dc0cc0541d7b7cf62c4f72e25bb6145
2025-05-19 12:41:56 -04:00
fanquake
7193245cd6 doc: remove For ... comments
We don't add or maintain these, and they are of little value, as
well as having the effect of polluting diffs.

They are also wrong, i.e DEFAULT_SCRIPTCHECK_THREADS is not in
validation.h.
2025-05-19 16:40:33 +01:00
MarcoFalke
3333282933 refactor: Remove unused Parse(U)Int* 2025-05-19 17:16:13 +02:00
fanquake
1b9cdc933f net: drop win32 ifdef 2025-05-19 13:45:04 +01:00
fanquake
19ba499b1f init: cerrno is used on all platforms 2025-05-19 13:45:04 +01:00
MarcoFalke
fa982f1425 Use WitnessV0KeyHash in TestAddAddressesToSendBook 2025-05-19 14:26:40 +02:00
MarcoFalke
fa58d6cdab ci: Move DEBUG=1 to centos task 2025-05-19 13:59:19 +02:00
Hennadii Stepanov
ff1ee102c4 Merge bitcoin/bitcoin#32561: doc: Adjust stale MSVC bug url
fa330a5e38 doc: Adjust stale MSVC bug url (MarcoFalke)

Pull request description:

  The old url is stale, so use the current one. See https://github.com/bitcoin/bitcoin/pull/32552#issuecomment-2889188342

ACKs for top commit:
  hebasto:
    ACK fa330a5e38.

Tree-SHA512: eb7813edb85f4bac06807bf2a35caf106a0faeffcbd0a4732c57edac07db00171f720888dbb7c35fae3fd515408ea7cb8e5dcbd3cf393caec23904cb800b8907
2025-05-19 11:56:47 +01:00
MarcoFalke
fa330a5e38 doc: Adjust stale MSVC bug url 2025-05-19 12:30:56 +02:00
merge-script
88791fb97b Merge bitcoin/bitcoin#32544: scripted-diff: test: remove 'descriptors=True' argument for createwallet calls
86de8c1668 scripted-diff: test: remove 'descriptors=True' argument for `createwallet` calls (Sebastian Falbesoner)

Pull request description:

  Descriptor wallets are already created by default [since v23.0](7710a31f0c/doc/release-notes/release-notes-23.0.md (L171)), but since the recent legacy wallet removal the `descriptors` parameter *must* be True for the `createwallet` RPC (see commit 9f04e02ffa), i.e. still passing it wouldn't contain any information for test readers anymore. So simply drop them in the functional tests in order to reduce code bloat. The only exception is calls to older versions, which happens in `wallet_backwards_compatibility.py` and is explicitly excluded in the scripted diff.

ACKs for top commit:
  Sjors:
    ACK 86de8c1668
  maflcko:
    lgtm ACK 86de8c1668

Tree-SHA512: 1acfae27bd960aeef9e1cf6e3f042752164a4d6869773c42df4c22c03dde0922993a3220fa14d52e75a0ff1f48c5194932b74a21427efbd496b0aaad7a2eafb2
2025-05-19 10:29:38 +01:00
Sjors Provoost
e8661aac75 wallet: drop watch-only things from interface 2025-05-19 10:11:18 +02:00
Sjors Provoost
e99188e7da qt: drop unused watch-only functionality
The watch-only functionality in the GUI was only used for legacy wallets.
Watch-only descriptor wallets do not use this.

The only visible changes of this commit are:
- dropped "Spendable:" label from the overview tab
- column width cache is reset
2025-05-19 10:11:18 +02:00
Sjors Provoost
6ee32aaaca test: signet tool genpsbt and solvepsbt commands
Co-authored-by: Anthony Towns <aj@erisian.com.au>
2025-05-19 09:45:37 +02:00
Sjors Provoost
0a99d99fe4 signet: miner skips PSBT step for OP_TRUE 2025-05-19 09:45:35 +02:00
Sjors Provoost
cdfb70e5a6 signet: split decode_psbt miner helper 2025-05-19 09:40:41 +02:00
Ava Chow
4b2cd0b41f test: check that creating a wallet does not log version info 2025-05-18 13:02:19 -07:00
Ava Chow
39a483c8e9 test: Check that the correct versions are logged on wallet load 2025-05-18 13:02:19 -07:00
Ava Chow
359ecd3704 walletdb: Log the wallet version after it has been read from disk
Logging the wallet version before anything has been read from disk results
in the wrong version being logged.

Also split the last client version logging as it may not always be
present to be logged.
2025-05-18 11:59:08 -07:00
Sebastian Falbesoner
86de8c1668 scripted-diff: test: remove 'descriptors=True' argument for createwallet calls
Descriptor wallets are already created by default since v23.0, but
since the recent legacy wallet removal this parameter *must* be True
(see commit 9f04e02ffa), i.e. still
passing it wouldn't contain any information for test readers
anymore. So simply drop them in the functional tests in order to
reduce code bloat.

-BEGIN VERIFY SCRIPT-
sed -i 's/, descriptors=True//g' $(git ls-files -- 'test/functional' ':(exclude)test/functional/wallet_backwards_compatibility.py')
sed -i '/descriptors=True,/d' ./test/functional/mempool_persist.py
-END VERIFY SCRIPT-
2025-05-17 18:14:24 +02:00
merge-script
7710a31f0c Merge bitcoin/bitcoin#32452: test: Remove legacy wallet RPC overloads
b104d44227 test: Remove RPCOverloadWrapper (Ava Chow)
4d32c19516 test: Replace importpubkey (Ava Chow)
fe838dd391 test: Replace usage of addmultisigaddress (Ava Chow)
d314207779 test: Replace usage of importaddress (Ava Chow)
fcc457573f test: Replace importprivkey with wallet_importprivkey (Ava Chow)
94c87bbbd0 test: Remove unnecessary importprivkey from wallet_createwallet (Ava Chow)

Pull request description:

  `RPCOverloadWrapper` implemented overloads for legacy wallet only RPCs so that the same function call could be used within tests for both legacy wallets and descriptor wallets. With legacy wallets now removed, there is no need to continue to have these overloads.

  For `importaddress`, `addmultisigaddress`, and `importpubkey`, the uses of these are converted to `importdescriptors`.

  For `importprivkey`, a new helper function `wallet_imporprivkey` is introduced that does what the overload did. This is mainly to reduce verbosity as `importprivkey` was more widely used throughout the tests.

  Some tests that used these RPCs are now also no longer relevant and have been removed.

ACKs for top commit:
  Sjors:
    ACK b104d44227
  pablomartin4btc:
    cr ACK b104d44227
  rkrux:
    ACK b104d44227
  w0xlt:
    ACK b104d44227

Tree-SHA512: ded2f73829e2ce28466d4a9738eb382783ad990daee5d1859dbc4d354e6f8eec0c483ed5ecb1287fe0dd24ac332065b733a30d71b126b841bd7cd49e9a094b6d
2025-05-17 10:19:35 +01:00
merge-script
b81e5076aa Merge bitcoin/bitcoin#32514: scripted-diff: Remove unused leading newline in RPC docs
fa1f10a49e doc: Fix minor typos in rpc help (MarcoFalke)
fae840e94b rpc: Reject beginning newline in RPC docs (MarcoFalke)
fa414eda08 scripted-diff: Remove unused leading newline in RPC docs (MarcoFalke)

Pull request description:

  It is harmless, but newlines in the beginning read a bit odd ("nReturns"). So just require them to not be present.

  The diff is large, but a trivial scripted-diff.

ACKs for top commit:
  fanquake:
    ACK fa1f10a49e
  w0xlt:
    ACK fa1f10a49e

Tree-SHA512: 5d2f9632f42ec1c02814d050f223941f436e5b0df426d7d6eb93fdd0ff118d57185af07b271dd73af63735dd17231125826c0c9ce0aad36bc8829c5b050a628c
2025-05-17 10:10:35 +01:00
Hennadii Stepanov
3023d7e6ad Merge bitcoin/bitcoin#32534: Update leveldb subtree to latest upstream
7015052eba build: remove Wsuggest-override suppression from leveldb build (fanquake)
e2c84b896f Squashed 'src/leveldb/' changes from 4188247086..113db4962b (fanquake)

Pull request description:

  Pulls in
  * https://github.com/bitcoin-core/leveldb-subtree/pull/51

  Remove the related warning suppression.

ACKs for top commit:
  l0rinc:
    utACK 7015052eba
  hebasto:
    ACK 7015052eba, I've updated the `leveldb` subtree locally and got zero diff with this branch.

Tree-SHA512: 1ac7c8ecc9025086b429e12c22fc25f654eaf68fc9500b95341fb635cea12e7f80d69298cff120e8557a4f2f5809956a3b158cdb4db745cfa605c0df6f346423
2025-05-17 09:42:01 +01:00
MarcoFalke
fa84e6c36c bitcoin-tx: Reject + sign in MutateTxDel* 2025-05-17 09:36:25 +02:00
MarcoFalke
face2519fa bitcoin-tx: Reject + sign in vout parsing 2025-05-17 09:36:15 +02:00
MarcoFalke
fa8acaf0b9 bitcoin-tx: Reject + sign in replaceable parsing 2025-05-17 09:35:11 +02:00
MarcoFalke
faff25a558 bitcoin-tx: Reject + sign in locktime 2025-05-17 09:34:59 +02:00
MarcoFalke
dddd9e5fe3 bitcoin-tx: Reject + sign in nversion parsing
It would be confusing to specify the sign for an unsigned value here, so
reject it.
2025-05-17 09:34:02 +02:00
MarcoFalke
fab06ac037 rest: Use SAFE_CHARS_URI in SanitizeString error msg
When dealing with URI parts, it seems more consistent to use
corresponding SAFE_CHARS_URI mode in error messages.

Co-Authored-By: stickies-v <stickies-v@protonmail.com>
2025-05-17 08:59:19 +02:00