0
0
Fork 0
mirror of https://github.com/bitcoin/bitcoin.git synced 2025-03-06 14:19:59 -05:00
bitcoin-core/src/node
Ava Chow 85f96b01b7
Merge bitcoin/bitcoin#30909: wallet, assumeutxo: Don't Assume m_chain_tx_count, Improve wallet RPC errors
9d2d9f7ce2 rpc: Include assumeutxo as a failure reason of rescanblockchain (Fabian Jahr)
595edee169 test, assumeutxo: import descriptors during background sync (Alfonso Roman Zubeldia)
d73ae603d4 rpc: Improve importdescriptor RPC error messages (Fabian Jahr)
27f99b6d63 validation: Don't assume m_chain_tx_count in GuessVerificationProgress (Fabian Jahr)
42d5d53363 interfaces: Add helper function for wallet on pruning (Fabian Jahr)

Pull request description:

  A test that is added as part of #30455 uncovered this issue: The `GuessVerificationProgress` function is used during during descriptor import and relies on `m_chain_tx_count`. In #29370 an [`Assume` was added](0fd915ee6b) expecting the `m_chaint_tx_count` to be set. However, as the test uncovered, `GuessVerificationProgress` is called with background sync blocks that have `m_chaint_tx_count = 0` when they have not been downloaded and processed yet.

  The simple fix is to remove the `Assume`. Users should not be thrown off by the `Internal bug detected` error. The behavior of `importdescriptor` is kept consistent with the behavior for blocks missing due to pruning.

  The test by alfonsoromanz is cherry-picked here to show that the [CI errors](https://cirrus-ci.com/task/5110045812195328?logs=ci#L2535) should be fixed by this change.

  This PR also improves error messages returned by the `importdescriptors` and `rescanblockchain` RPCs. The error message now changes depending on the situation of the node, i.e. if pruning is happening or an assumutxo backgroundsync is active.

ACKs for top commit:
  achow101:
    ACK 9d2d9f7ce2
  mzumsande:
    Code Review ACK 9d2d9f7ce2
  furszy:
    Code review ACK 9d2d9f7ce2

Tree-SHA512: b841a9b371e5eb8eb3bfebca35645ff2fdded7a3e5e06308d46a33a51ca42cc4c258028c9958fbbb6cda9bb990e07ab8d8504dd9ec6705ef78afe0435912b365
2025-01-31 15:45:14 -05:00
..
abort.cpp
abort.h
blockmanager_args.cpp
blockmanager_args.h
blockstorage.cpp
blockstorage.h
caches.cpp
caches.h
chainstate.cpp
chainstate.h
chainstatemanager_args.cpp
chainstatemanager_args.h
coin.cpp
coin.h
coins_view_args.cpp
coins_view_args.h
connection_types.cpp
connection_types.h
context.cpp
context.h
database_args.cpp
database_args.h
eviction.cpp
eviction.h
interface_ui.cpp
interface_ui.h
interfaces.cpp Merge bitcoin/bitcoin#30909: wallet, assumeutxo: Don't Assume m_chain_tx_count, Improve wallet RPC errors 2025-01-31 15:45:14 -05:00
kernel_notifications.cpp
kernel_notifications.h
mempool_args.cpp
mempool_args.h
mempool_persist.cpp
mempool_persist.h
mempool_persist_args.cpp
mempool_persist_args.h
miner.cpp
miner.h
mini_miner.cpp
mini_miner.h
minisketchwrapper.cpp
minisketchwrapper.h
peerman_args.cpp
peerman_args.h
protocol_version.h
psbt.cpp
psbt.h
README.md
timeoffsets.cpp
timeoffsets.h
transaction.cpp
transaction.h
txdownloadman.h
txdownloadman_impl.cpp
txdownloadman_impl.h
txreconciliation.cpp
txreconciliation.h
types.h
utxo_snapshot.cpp
utxo_snapshot.h
warnings.cpp
warnings.h

src/node/

The src/node/ directory contains code that needs to access node state (state in CChain, CBlockIndex, CCoinsView, CTxMemPool, and similar classes).

Code in src/node/ is meant to be segregated from code in src/wallet/ and src/qt/, to ensure wallet and GUI code changes don't interfere with node operation, to allow wallet and GUI code to run in separate processes, and to perhaps eventually allow wallet and GUI code to be maintained in separate source repositories.

As a rule of thumb, code in one of the src/node/, src/wallet/, or src/qt/ directories should avoid calling code in the other directories directly, and only invoke it indirectly through the more limited src/interfaces/ classes.

This directory is at the moment sparsely populated. Eventually more substantial files like src/validation.cpp and src/txmempool.cpp might be moved there.