Commit Graph

42637 Commits

Author SHA1 Message Date
Sjors Provoost
d8a448249a wallet: add IsTxAssumed() to WalletTxStatus
Determine if a given transaction belongs to a block that is assumed to be valid pending background validation.

Add this information to WalletTxStatus.

Github-Pull: #28616
Rebased-From: a6c53bb24436ecc1ae717b032c0cccdd704044eb
2025-02-08 18:40:02 +00:00
Sjors Provoost
2904c57bc4 wallet: track background validation height
Github-Pull: #28616
Rebased-From: 3f3dbb60d190e76074ec2da7b303d68f89fe28ee
2025-02-08 18:39:55 +00:00
Luke Dashjr
ca56c7c9c4 Diff-minimise 2025-01-25 16:04:47 +00:00
Cory Fields
145dd295d9 tests: add a test for the new blocksdir lock
Github-Pull: #31674
Rebased-From: 2656a5658c
2025-01-25 16:04:47 +00:00
Cory Fields
fac2c9e1a5 init: lock blocksdir in addition to datadir
This guards against 2 processes running with separate datadirs but the same
blocksdir.

It's not likely to happen currently, but may be more relevant in the future
with applications using the kernel.

Note that the kernel does not currently do any dir locking, but it should.

Github-Pull: #31674
Rebased-From: bdc0a68e67
2025-01-25 16:04:47 +00:00
Cory Fields
68e55e2818 refactor: introduce a more general LockDirectories for init
No functional change. This is in preparation for adding additional directory
locks on startup.

Github-Pull: #31674
Rebased-From: cabb2e5c24
2025-01-25 16:04:47 +00:00
Cory Fields
2e7f96e42f init: allow a new xor key to be written if the blocksdir is newly created
A subsequent commit will add a .lock file to this dir at startup, meaning that
the blocksdir is never empty by the time the xor key is being read/written.

Ignore all hidden files when determining if this is the first run.

Github-Pull: #31674
Rebased-From: 1db331ba76
2025-01-25 16:04:46 +00:00
Hennadii Stepanov
b8bf1154e9 depends: Override default build type for libevent
The `libevent` package defaults to the "Release" build type, which
overrides our per-build-type optimization flags with `-O3`.

To prevent this behavior, set `CMAKE_BUILD_TYPE` to "None", consistent
with how other packages are handled.

Github-Pull: #31661
Rebased-From: d44626a9c2
2025-01-23 15:58:00 +00:00
Lőrinc
aa56eaaa78 coins: bump default LevelDB write batch size to 64 MiB
The UTXO set has grown significantly, and flushing it from memory to LevelDB often takes over 20 minutes after a successful IBD with large dbcache values.
The final UTXO set is written to disk in batches, which LevelDB sorts into SST files.
By increasing the default batch size, we can reduce overhead from repeated compaction cycles, minimize constant overhead per batch, and achieve more sequential writes.

Experiments with different batch sizes (loaded via assumeutxo at block 840k, then measuring final flush time) show that 64 MiB batches significantly reduce flush time without notably increasing memory usage:

| dbbatchsize | flush_sum (ms) |
|-------------|----------------|
| 8 MiB       | ~240,000       |
| 16 MiB      | ~220,000       |
| 32 MiB      | ~200,000       |
| *64 MiB*    | *~150,000*     |
| 128 MiB     | ~156,000       |
| 256 MiB     | ~166,000       |
| 512 MiB     | ~186,000       |
| 1 GiB       | ~186,000       |

Checking the impact of a `-reindex-chainstate` with `-stopatheight=878000` and `-dbcache=30000` gives:
16 << 20
```
2025-01-12T07:31:05Z Flushed fee estimates to fee_estimates.dat.
2025-01-12T07:31:05Z [warning] Flushing large (26 GiB) UTXO set to disk, it may take several minutes
2025-01-12T07:53:51Z Shutdown: done
```
Flush time: 22 minutes and 46 seconds

64 >> 20
```
2025-01-12T18:30:00Z Flushed fee estimates to fee_estimates.dat.
2025-01-12T18:30:00Z [warning] Flushing large (26 GiB) UTXO set to disk, it may take several minutes
2025-01-12T18:44:43Z Shutdown: done
```
Flush time: ~14 minutes 43 seconds.

Github-Pull: #31645
Rebased-From: d249a353be58868d41d2a7c57357038ffd779eba
2025-01-15 01:26:31 +00:00
Lőrinc
496dfda7a4 refactor: Fix remaining clang-tidy performance-unnecessary-copy-initialization errors
Github-Pull: #31364
Rebased-From: 3305972f7b
2025-01-15 01:13:30 +00:00
fanquake
5ffa1f9f80 depends: Qt 5.15.15
Github-Pull: #30774
Rebased-From: acf8b52a59565617d89cd9b0006ba54c0a1f448d
2025-01-15 00:31:58 +00:00
MarcoFalke
cdf2241a8e refactor: Avoid UB in SHA3_256::Write
It is UB to apply a distance to a pointer or iterator further than the
end itself, even if the distance is (partially) revoked later on.

Fix the issue by advancing the data pointer at most to the end.

Github-Pull: #31655
Rebased-From: fabeca3458
2025-01-14 23:40:17 +00:00
Ava Chow
f0abe90263 gui, psbt: Use SIGHASH_DEFAULT when signing PSBTs
SIGHASH_DEFAULT should be used to indicate SIGHASH_DEFAULT for taproot
inputs, and SIGHASH_ALL for all other input types. This avoids adding an
unnecessary byte to the end of all Taproot signatures added to PSBTs
signed in the GUI.

Github-Pull: gui#850
Rebased-From: 3e97ff9c5e
2025-01-14 23:16:25 +00:00
Hennadii Stepanov
90789a1e01 build, test: Build db_tests.cpp regardless of USE_BDB
While some tests are specific to BDB, `db_tests` as a whole are not
limited to BDB.

Github-Pull: #31617
Rebased-From: fd2d96d908
2025-01-14 21:07:03 +00:00
fanquake
cb9a4640ec guix: disable timezone tools & profiling in glibc
Removes `var/profiles/x86_64-linux-gnu/sbin/zdump`.

Profiling is disabled by default, but make that explicit.

Github-Pull: #31529
Rebased-From: b8710201fb
2025-01-14 04:26:09 +00:00
fanquake
1252d33cf0 guix: bump glibc 2.31 to 7b27c450c34563a28e634cccb399cd415e71ebfe
An additional commit has been backported to the 2.31 branch:
https://sourceware.org/git/?p=glibc.git;a=shortlog;h=refs/heads/release/2.31/master.

Github-Pull: #31529
Rebased-From: 23b8a424fb
2025-01-14 04:26:09 +00:00
Luke Dashjr
a2badef7e4 GUI: Always show pruning explanation to avoid checkbox jumping around 2025-01-14 00:04:56 +00:00
Luke Dashjr
4c97d2af60 Minimise and keep somewhat compatible 2025-01-13 21:27:00 +00:00
0xb10c
f93f0c9396 tracing: Rename the MIN macro to _TRACEPOINT_TEST_MIN in log_raw_p2p_msgs
Inspired by: 00c1dbd26d (#31419)
2025-01-09 06:43:05 +00:00
MarcoFalke
9fd37323ba doc: Fix incorrect send RPC docs
Github-Pull: #31416
Rebased-From: fad83e759a
2025-01-09 06:29:52 +00:00
MarcoFalke
d834bfda34 Remove wallet::ParseISO8601DateTime, use ParseISO8601DateTime instead
Github-Pull: #31391
Rebased-From: faf70cc994
2025-01-09 04:11:43 +00:00
MarcoFalke
ab569e97b7 util: Implement ParseISO8601DateTime based on C++20
Github-Pull: #31391
Rebased-From: 2222aecd5f
2025-01-09 04:11:42 +00:00
MarcoFalke
88c7842f35 test: Add missing node.setmocktime(self.mocktime) to p2p_ibd_stalling.py
This was forgotten by myself in commit fa5b58ea01

Github-Pull: #31383
Rebased-From: faa16ed4b9
2025-01-08 23:01:15 +00:00
Luke Dashjr
6deee076a9 Diff-minimise 2025-01-08 22:09:09 +00:00
Antoine Poinsot
f6b4f22808 miner: never create a template which exploits the timewarp bug
Github-Pull: #31376
Rebased-From: 733fa0b0a1
2025-01-08 22:09:09 +00:00
furszy
84719e6f55 wallet: fix crash during watch-only wallet migration
The crash occurs because we assume the cached scripts
structure will not be empty, but it can be empty when
the legacy wallet contained only watch-only and
solvable but not spendable scripts

Github-Pull: #31374
Rebased-From: 932cd1e92b
2025-01-08 21:46:56 +00:00
Sebastian Falbesoner
16d60e56de test: avoid internet traffic in rpc_net.py
Can be tested by running

```
$ sudo tcpdump -i eth0 host 11.22.33.44
```

and verifying that no packets appear in the tcpdump output.

Co-authored-by: Vasil Dimov <vd@FreeBSD.org>

Github-Pull: #31343
Rebased-From: 988721d37a
2025-01-08 20:13:57 +00:00
Michael Little
2f7f2fae63 further RPC example corrections
Github-Pull: #31275
Rebased-From: 1f3f5c049b4080ecaf30604fd22d65aa0fc4af45
2025-01-08 20:03:20 +00:00
Michael Little
599a0811ac corrected lockunspent rpc quoting
Github-Pull: #31275
Rebased-From: 70ae8ca8b7435a38416c4eb469b3cdad6fb87b4f
2025-01-08 20:03:19 +00:00
Hodlinator
e1b776466d test: Add tests for directories in place of config files
Github-Pull: #31212
Rebased-From: 95a0104f2e
2025-01-08 18:48:13 +00:00
Hodlinator
866ba19192 args: Catch directories in place of config files
Previously passing a directory path as -conf would lead to an ifstream being opened for it, and would not trigger any errors.

Github-Pull: #31212
Rebased-From: e85abe92c7
2025-01-08 18:48:13 +00:00
Hodlinator
6b837312c6 test: Add tests for -noconf
Github-Pull: #31212
Rebased-From: e4b6b1822c
2025-01-08 18:48:13 +00:00
Hodlinator
088e9845f0 args: Properly support -noconf
-noconf would previously lead to an ifstream "successfully" being opened to the ".bitcoin"-directory (not a file). (Guards against the general case of directories as configs are added in grandchild commit to this one).

Other users of AbsPathForConfigVal() in combination with negated args have been updated earlier in this PR ("args: Support -nopid" and "args: Support -norpccookiefile...").

Github-Pull: #31212
Rebased-From: 483f0dacc4
2025-01-08 18:48:13 +00:00
Hodlinator
41970350d4 test refactor: feature_config_args.py - Stop nodes at the end of tests, not at the beginning
This ensures we don't needlessly start the node, and reduces implicit dependencies between test functions.

test_seed_peers() - Move assert calling RPC to verify correct chain after our own function actually started the node.

Github-Pull: #31212
Rebased-From: 312ec64cc0
2025-01-08 18:48:13 +00:00
Hodlinator
56c374dfad test: -norpccookiefile
Both bitcoind and bitcoin-cli.

Github-Pull: #31212
Rebased-From: 7402658bc2
2025-01-08 18:48:13 +00:00
Hodlinator
88ae15bb58 args: Support -norpccookiefile for bitcoind and bitcoin-cli
Replaces belt & suspenders check for initialization in RPCAuthorized() with not allowing empty passwords further down.

Github-Pull: #31212
Rebased-From: 39cbd4f37c
2025-01-08 18:48:13 +00:00
Hodlinator
0b3f7453b6 logs: Use correct path and more appropriate macros in cookie-related code
filepath_tmp -> filepath in last message.

More material changes to nearby code in next commit.

Github-Pull: #31212
Rebased-From: e82ad88452
2025-01-08 18:48:13 +00:00
Hodlinator
9b90eea2a1 test: Harden testing of cookie file existence
Github-Pull: #31212
Rebased-From: 6e28c76907
2025-01-08 18:48:13 +00:00
Hodlinator
a613155808 test: combine_logs.py - Output debug.log paths on error
Github-Pull: #31212
Rebased-From: 75bacabb55
2025-01-08 18:48:13 +00:00
Hodlinator
c850b5be46 args: Support -nopid
Github-Pull: #31212
Rebased-From: bffd92f00f
2025-01-08 18:48:13 +00:00
Hodlinator
397cc860ed scripted-diff: Avoid printing version information for -noversion
-BEGIN VERIFY SCRIPT-
sed -i --regexp-extended 's/\b(gArgs|args)\.IsArgSet\("-version"\)/\1.GetBoolArg("-version", false)/g' $(git grep -l '-version')
-END VERIFY SCRIPT-

Github-Pull: #31212
Rebased-From: 6ff9662760
2025-01-08 18:48:13 +00:00
Hodlinator
bb42993a30 doc args: Document narrow scope of -color
Github-Pull: #31212
Rebased-From: e8a2054edc
2025-01-08 18:48:12 +00:00
TheCharlatan
b4973b60b2 interpreter: Use the same type for SignatureHash in the definition
This was missed during the original PR switching the nHashType argument
to int32_t in SignatureHash in bc52cda1f3.

The problem was discovered after running into a linker error when
attempting to link this code as a static library using the header as a
declaration with a riscv32 bare metal toolchain. The compiler would
error with:

/opt/riscv-ilp32/lib/gcc/riscv32-unknown-elf/13.2.0/../../../../riscv32-unknown-elf/bin/ld: build_kernel_riscv/src/libbitcoin_consensus.a(interpreter.cpp.o): in function `GenericTransactionSignatureChecker<CTransaction>::CheckECDSASignature(std::vector<unsigned char, std::allocator<unsigned char> > const&, std::vector<unsigned char, std::allocator<unsigned char> > const&, CScript const&, SigVersion) const':
/home/user/bitcoin/build_kernel_riscv/./script/interpreter.cpp:2043:(.text._ZNK34GenericTransactionSignatureCheckerI12CTransactionE19CheckECDSASignatureERKSt6vectorIhSaIhEES6_RK7CScript10SigVersion[_ZNK34GenericTransactionSignatureCheckerI12CTransactionE19CheckECDSASignatureERKSt6vectorIhSaIhEES6_RK7CScript10SigVersion]+0xee): undefined reference to `uint256 SignatureHash<CTransaction>(CScript const&, CTransaction const&, unsigned int, int, long long const&, SigVersion, PrecomputedTransactionData const*)'

Github-Pull: #31365
Rebased-From: c288c790cd
2025-01-08 15:27:21 +00:00
Luke Dashjr
ff198b5ce5 run_command: Enable close_fds option to avoid lingering fds 2025-01-08 15:08:06 +00:00
Luke Dashjr
0cb1dc0be9 cpp-subprocess: Iterate through /proc/self/fd for close_fds option 2025-01-08 15:08:06 +00:00
MarcoFalke
81b6de569e test: Avoid logging error when logging error
Github-Pull: #31408
Rebased-From: cccca8a77f (minimised)
2025-01-08 14:19:17 +00:00
Ava Chow
32efe85043
Merge bitcoin/bitcoin#31594: [28.x] 28.1 backports and final changes
36314b8da2 doc: Update 28.1 release notes (MarcoFalke)
58910279dc doc: generate 28.1 manpages (Ava Chow)
6a68ef9bfb build: bump to 28.1 (Ava Chow)
5b368f88a9 depends: Fix CXXFLAGS on NetBSD (Hennadii Stepanov)
05cd448e33 test: generateblocks called by multiple threads (MarcoFalke)
621c634b7f rpc: Extend scope of validation mutex in generateblock (MarcoFalke)

Pull request description:

  Backports:

  - #31502
  - #31563

ACKs for top commit:
  glozow:
    reACK 36314b8da2
  achow101:
    ACK 36314b8da2

Tree-SHA512: c7a624b4c166f4322011d98d1ca814ae98eaf5fd2481a507cd65a50216f1abbb91f8643508ce81f64f8b10fa2210db1722254c343253f2a950b9c64667735e9b
2025-01-07 13:32:56 -05:00
MarcoFalke
36314b8da2 doc: Update 28.1 release notes 2025-01-06 11:04:28 +01:00
Ava Chow
58910279dc doc: generate 28.1 manpages 2025-01-02 20:53:02 +01:00
Ava Chow
6a68ef9bfb build: bump to 28.1 2025-01-02 20:53:02 +01:00