Commit Graph

836 Commits

Author SHA1 Message Date
Luke Dashjr
962511f17b Merge 10615 via multiwallet_rpc-28+knots 2025-03-05 03:27:08 +00:00
Luke Dashjr
990ff83c56 Merge ionice_win 2025-03-05 03:27:08 +00:00
Luke Dashjr
67d111426a Match Windows I/O priority to other platforms: loading external block files and reading blocks raw 2025-03-05 17:28:03 +00:00
Luke Dashjr
ac2190c22a utilioprio: Add Windows support as ioprio_set_file_idle 2025-03-05 17:23:03 +00:00
Luke Dashjr
45fa891549 Merge branch 'ionice' into ionice_win 2025-03-05 17:21:08 +00:00
Luke Dashjr
20f5b5a056 Merge 9245 via ionice 2025-03-05 03:27:08 +00:00
Luke Dashjr
a219cacbf5 Merge 31845 via pruneduringinit-28+knots 2025-03-05 03:27:08 +00:00
Luke Dashjr
a31727f845 Merge 27770 via rpc_getblockfileinfo-28+knots 2025-03-05 03:27:08 +00:00
Luke Dashjr
99edcfd993 Merge 27600 via p2p_forceinbound-28+knots 2025-03-05 03:27:08 +00:00
Luke Dashjr
73691fbf13 Merge 22372 via multinotify 2025-03-05 03:27:08 +00:00
Luke Dashjr
d8114ff110 Merge 19463 via prune_locks 2025-03-05 03:27:08 +00:00
Luke Dashjr
add2386fdc Merge 30059 via dbfilesize_param 2025-03-05 03:27:08 +00:00
Luke Dashjr
ff1b8720f3 Merge 31674 via lock_blocksdir-28 2025-03-05 03:27:08 +00:00
Luke Dashjr
32bb226fa2 Merge 31376 via mining_curtime_avoid_timewarp-28 2025-03-05 03:27:08 +00:00
Luke Dashjr
878cbd9c54 Merge 31064 via init_coins_cache_pr31064-25 2025-03-05 03:27:08 +00:00
Luke Dashjr
6fb830e0d2 Merge fix_rpc_warnings_all-28 2025-03-05 03:27:08 +00:00
Luke Dashjr
17291246d0 Merge 29307 via AutoFile_error_check-28 2025-03-05 03:27:08 +00:00
Luke Dashjr
8e36b81928 Merge 28345 via fix_bytespersigop_checks-mini 2025-03-05 03:27:08 +00:00
Luke Dashjr
d40c122004 Merge g236 via gui_init_walleterror_cont 2025-03-05 03:27:08 +00:00
Luke Dashjr
8ccd0cdff8 Bugfix: Remove wallet restrictions on RPC calls via node interface (ie, GUI RPC console) 2025-02-21 16:30:03 +00:00
furszy
020f2ab028 RPC: introduce 'getblockfileinfo' RPC command
Simple command to retrieve information about a certain block file

Github-Pull: #27770
Rebased-From: 24bfe4e1a0
2025-02-21 16:20:53 +00:00
Luke Dashjr
29c039268c Add -pruneduringinit option to temporarily use another prune target during IBD 2025-02-12 22:42:47 +00:00
Luke Dashjr
ca56c7c9c4 Diff-minimise 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
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
Luke Dashjr
cd5fd154a9 Drop IO priority to idle while reading blocks for peer requests and startup verification 2024-11-21 20:55:44 +00:00
Matthew Zipkin
3544a26256 eviction: track one random unprotected node to evict if forced
Accomplished by adding a bool argument `force` to SelectNodeToEvict()

Github-Pull: #27600
Rebased-From: 0c0f2a2c3664d5ea81ee31230ddca40863dd76dd
2024-11-14 18:46:30 +00:00
TheCharlatan
e37bae9d03 init: Correct coins db cache size setting
The chainstate caches are currently re-balanced on startup
even in the non-assumeutxo case, leading to the database being
needlessly re-opened and its cache re-allocated.

Similar to `InitCoinsCache` and `m_coinstip_cache_size_bytes` the
`m_coinsdb_cache_size_bytes` should be set in `InitCoinsDB`.

Together with only conservatively setting the cache values when a
assumeutxo chainstate is present, this allows for skipping the cache
re-balance during initialization in the normal non-assumeutxo case.

Github-Pull: #31064
Rebased-From: 3a4a788ee0
2024-11-09 23:19:02 +00:00
Luke Dashjr
5302aa8ca6 Diff-minimise 2024-11-09 19:19:12 +00:00
Vasil Dimov
06105d8da8 util: explicitly close all AutoFiles that have been written
There is no way to report a close error from `AutoFile` destructor.
Such an error could be serious if the file has been written to because
it may mean the file is now corrupted (same as if write fails).

So, change all users of `AutoFile` that use it to write data to
explicitly close the file and handle a possible error.

Github-Pull: #29307
Rebased-From: dba783538683cfc6af209c640c2d019648493f31
2024-11-09 19:18:20 +00:00
Pieter Wuille
ff95cb31da
streams: remove AutoFile::Get() entirely
Co-Authored-By: David Gumberg <davidzgumberg@gmail.com>

Github-Pull: bitcoin/bitcoin#30884
Rebased-From: a240e150e8
2024-09-16 23:10:17 -04:00
Pieter Wuille
8229e98116
streams: cache file position within AutoFile
Github-Pull: bitcoin/bitcoin#30884
Rebased-From: e624a9bef1
2024-09-16 23:10:14 -04:00
Luke Dashjr
6337da5696 RPC: blockchain: Add listprunelocks and setprunelock methods 2024-09-03 04:29:47 +00:00
Luke Dashjr
ee8bcadb84 Support for persisting prune locks in blocks/index db 2024-09-03 04:29:43 +00:00
Luke Dashjr
55fc577c9a Add internal interfaces for prune locks
Including desc member of PruneLockInfo for a human-readable description
2024-09-03 01:31:45 +00:00
Luke Dashjr
1ebacb60f8 blockstorage: Add height_last to PruneLockInfo 2024-09-03 01:31:45 +00:00
Luke Dashjr
64de1480d3 Move prune lock checking into BlockManager 2024-09-03 01:31:45 +00:00
Luke Dashjr
e4e4a81317 Bugfix: RPC: Return all warnings in get{blockchain,mining,network}info (even in deprecated String mode) 2024-09-02 20:10:40 +00:00
Luke Dashjr
1cee5b1ac7 node: Refactor BroadcastTransaction to accept a CFeeRate maximum 2024-08-30 19:39:21 +00:00
Ava Chow
78567b052d
Merge bitcoin/bitcoin#30697: Bugfix: Ensure Atomicity in Wallet Settings Updates from Chain Interface
1b41d45d46 wallet: bugfix: ensure atomicity in settings updates (ismaelsadeeq)

Pull request description:

  This PR fixes #30620.

  As outlined in the issue, creating two wallets with `load_on_startup=true` simultaneously results in only one wallet being added to the startup file.

  The current issue arises because the wallet settings update process involves:
  1. Obtaining the settings value while acquiring the settings lock.
  2. Modifying the settings value.
  3. Overwriting the settings value while acquiring the settings lock again.

  This sequence is not thread-safe. Different threads could modify the same base value simultaneously, overwriting data from other workers without realizing it.

  The PR attempts to  fix this by modifying the chain interface's `updateRwSetting` method to accept a function that will be called with the settings reference. This function will either update or delete the setting and return an enum indicating whether the settings need to be overwritten in this or not.

  Additionally, this PR introduces two new methods to the chain interface:
  - `overwriteRwSetting`: This method replaces the setting with a new value.
  Used in `VerifyWallets`
  - `deleteRwSettings`: This method completely erases a specified setting.
  This method is currently used only in `overwriteRwSetting`.

  These changes ensure that updates are race-free across all clients.

ACKs for top commit:
  achow101:
    ACK 1b41d45d46
  furszy:
    self-code-ACK 1b41d45d46

Tree-SHA512: 50cda612b782aeb5e03e2cf63cc44779a013de1c535b883b57af4de22f24b0de80b4edecbcda235413baec0a12bdf0e5750fb6731c9e67d32e742d8c63f08c13
2024-08-27 12:29:20 -04:00
ismaelsadeeq
1b41d45d46
wallet: bugfix: ensure atomicity in settings updates
- Settings updates were not thread-safe, as they were executed in
  three separate steps:

  1) Obtain settings value while acquiring the settings lock.
  2) Modify settings value.
  3) Overwrite settings value while acquiring the settings lock.

  This approach allowed concurrent threads to modify the same base value
  simultaneously, leading to data loss. When this occurred, the final
  settings state would only reflect the changes from the last thread
  that completed the operation, overwriting updates from other threads.

  Fix this by making the settings update operation atomic.

- Add test coverage for this behavior.

Co-authored-by: furszy <matiasfurszyfer@protonmail.com>
2024-08-26 13:41:56 +01:00
Sjors Provoost
59ff17e5af
miner: adjust clock to timewarp rule 2024-08-20 18:51:37 +02:00
Matt Whitlock
138f867156
add missing #include <cstdint> for GCC 15 2024-08-12 11:15:11 +01:00
Ava Chow
9a696397e7
Merge bitcoin/bitcoin#30598: assumeutxo: Drop block height from metadata
00618e8745 assumeutxo: Drop block height from metadata (Fabian Jahr)

Pull request description:

  Fixes https://github.com/bitcoin/bitcoin/issues/30514 which has more context and shows how the issue can be reproduced. Since the value in question is removed, there is no test to add to reproduce anything.

  This is an alternative approach to #30516 with much of the [code being suggested there](https://github.com/bitcoin/bitcoin/pull/30516#discussion_r1689146902).

ACKs for top commit:
  maflcko:
    re-ACK 00618e8745 🎌
  achow101:
    ACK 00618e8745
  theStack:
    Code-review ACK 00618e8745
  ismaelsadeeq:
    Re-ACK 00618e8745
  mzumsande:
    ACK 00618e8745

Tree-SHA512: db9575247bae838ad7742a27a216faaf55bb11e022f9afdd05752bb09bbf9614717d0ad64304ff5722a16bf41d8dea888af544e4ae26dcaa528c1add0269a4a8
2024-08-09 16:20:00 -04:00
merge-script
24ced52744
Merge bitcoin/bitcoin#28687: C++20 std::views::reverse
2925bd537c refactor: use c++20 std::views::reverse instead of reverse_iterator.h (stickies-v)

Pull request description:

  C++20 introduces [`std::ranges::views::reverse`](https://en.cppreference.com/w/cpp/ranges/reverse_view), which allows us to drop our own `reverse_iterator.h` implementation and also makes it easier to chain views (even though I think we currently don't use this).

ACKs for top commit:
  achow101:
    ACK 2925bd537c
  maflcko:
    ACK 2925bd537c 🎷

Tree-SHA512: 567666ec44af5d1beb7a271836bcc89c4c577abc77f522fcc18bc6d4de516ae9b0df766d0bfa6dd217569e6878331c2aee1d9815620860375e3510dad7fed476
2024-08-09 09:51:19 +01:00
Fabian Jahr
00618e8745
assumeutxo: Drop block height from metadata
The Snapshot format version is updated to 2 to indicate this change.

Co-authored-by: MarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz>
2024-08-08 23:55:06 +02:00
glozow
0f68a05c08
Merge bitcoin/bitcoin#30194: refactor: use recommended type hiding on multi_index types
a3cb309e7c refactor: use recommended type hiding on multi_index types (Cory Fields)

Pull request description:

  Recommended by boost docs:
  https://www.boost.org/doc/libs/1_85_0/libs/multi_index/doc/compiler_specifics.html#type_hiding

  This significantly reduces the size of the symbol name lengths that end up in the binaries as well as in compiler warnings/errors. Otherwise there should be no functional change.

  Example before:

  > 0000000000000000 W unsigned long boost::multi_index::detail::hashed_index<mempoolentry_txid, SaltedTxidHasher, std::equal_to<uint256>, boost::multi_index::detail::nth_layer<1, CTxMemPoolEntry, boost::multi_index::indexed_by<boost::multi_index::hashed_unique<mempoolentry_txid, SaltedTxidHasher, mpl_::na, mpl_::na>, boost::multi_index::hashed_unique<boost::multi_index::tag<index_by_wtxid, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na>, mempoolentry_wtxid, SaltedTxidHasher, mpl_::na>, boost::multi_index::ordered_non_unique<boost::multi_index::tag<descendant_score, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na>, boost::multi_index::identity<CTxMemPoolEntry>, CompareTxMemPoolEntryByDescendantScore>, boost::multi_index::ordered_non_unique<boost::multi_index::tag<entry_time, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na>, boost::multi_index::identity<CTxMemPoolEntry>, CompareTxMemPoolEntryByEntryTime>, boost::multi_index::ordered_non_unique<boost::multi_index::tag<ancestor_score, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na>, boost::multi_index::identity<CTxMemPoolEntry>, CompareTxMemPoolEntryByAncestorFee>, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na>, std::allocator<CTxMemPoolEntry> >, boost::mpl::vector0<mpl_::na>, boost::multi_index::detail::hashed_unique_tag>::count<uint256, SaltedTxidHasher, std::equal_to<uint256> >(uint256 const&, SaltedTxidHasher const&, std::equal_to<uint256> const&, mpl_::bool_<false>) const

  After:

  > 0000000000000000 W unsigned long boost::multi_index::detail::hashed_index<mempoolentry_txid, SaltedTxidHasher, std::equal_to<uint256>, boost::multi_index::detail::nth_layer<1, CTxMemPoolEntry, CTxMemPool::CTxMemPoolEntry_Indicies, std::allocator<CTxMemPoolEntry> >, boost::mpl::vector0<mpl_::na>, boost::multi_index::detail::hashed_unique_tag>::count<uint256, SaltedTxidHasher, std::equal_to<uint256> >(uint256 const&, SaltedTxidHasher const&, std::equal_to<uint256> const&, mpl_::bool_<false>) const

ACKs for top commit:
  glozow:
    ACK a3cb309e7c, TIL, makes sense to me
  TheCharlatan:
    ACK a3cb309e7c
  fanquake:
    ACK a3cb309e7c

Tree-SHA512: f6bb3d133daec126cf064ed6fe4457f457c0cfdbea28778c8ff426be7b41b271ada2d790c6b4129ca22156182c99aaf287e3aa9fb6b076ee55946da40e06e5d8
2024-08-07 20:00:28 +01:00
glozow
676abd1af7
Merge bitcoin/bitcoin#30594: docs: doc update for mempoolfullrbf default + log deprecation
1f93e3c360 add deprecation warning for mempoolfullrbf (glozow)
4400c979a3 [doc] update documentation for new mempoolfullrbf default (glozow)

Pull request description:

  Followup to #30493. Update bips.md and policy/*.md to reflect new default rules around signaling requirements in RBF.
  Also, log a warning when `-mempoolfullrbf=0` that this config option is deprecated and will be removed in a future release.

ACKs for top commit:
  petertodd:
    ACK 1f93e3c360
  instagibbs:
    ACK 1f93e3c360
  tdb3:
    ACK 1f93e3c360

Tree-SHA512: f60a9524f15cfaa4c10c40b6f62b787d3f9865aac48ca883def30efac4f8a118f1359532f1b209ea34e201f0b1c92398abc8bc1e439e6b60910cc7f75c51e9ae
2024-08-07 14:52:16 +01:00