bitcoin/src/wallet
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
..
rpc Merge bitcoin/bitcoin#29404: refactor: bitcoin-config.h includes cleanup 2024-02-20 13:07:48 +00:00
test Merge bitcoin/bitcoin#29404: refactor: bitcoin-config.h includes cleanup 2024-02-20 13:07:48 +00:00
bdb.cpp wallet: bdb batch 'ErasePrefix', do not create txn internally 2024-02-12 16:05:15 -03:00
bdb.h wallet: bdb: include bdb header from our implementation files only 2023-07-07 14:14:20 +00:00
coincontrol.cpp wallet: Explicitly preserve scriptSig and scriptWitness in CreateTransaction 2023-12-08 17:12:19 -05:00
coincontrol.h wallet: Explicitly preserve scriptSig and scriptWitness in CreateTransaction 2023-12-08 17:12:19 -05:00
coinselection.cpp opt: Skip over barren combinations of tiny UTXOs 2024-02-09 11:03:18 +01:00
coinselection.h coinselection: Track whether CG completed 2024-02-09 10:50:10 +01:00
context.cpp scripted-diff: Bump copyright headers 2022-12-24 23:49:50 +00:00
context.h interfaces: Add schedulerMockForward method so mockscheduler RPC can work across processes 2023-10-20 10:30:16 -04:00
crypter.cpp refactor: Remove unused C-style casts 2023-07-24 15:32:00 +02:00
crypter.h scripted-diff: Bump copyright headers 2022-12-24 23:49:50 +00:00
db.cpp refactor: Fix bugprone-string-constructor warning 2023-10-30 14:59:17 +01:00
db.h wallet: remove unused 'accept_no_keys' arg from decryption process 2024-02-03 12:56:43 -03:00
dump.cpp wallettool: Don't create CWallet when dumping DB 2023-12-19 16:54:06 -05:00
dump.h wallettool: Don't create CWallet when dumping DB 2023-12-19 16:54:06 -05:00
external_signer_scriptpubkeyman.cpp wallet: batch external signer descriptor import 2023-11-21 23:07:00 -03:00
external_signer_scriptpubkeyman.h wallet: batch external signer descriptor import 2023-11-21 23:07:00 -03:00
feebumper.cpp test: wallet, fix change position out of range error 2023-12-12 15:20:38 -03:00
feebumper.h rpc: bumpfee, improve doc for 'reduce_output' arg 2023-09-26 20:17:02 -03:00
fees.cpp scripted-diff: Bump copyright headers 2022-12-24 23:49:50 +00:00
fees.h Add src/wallet/* code to wallet:: namespace 2022-01-06 22:14:16 -05:00
init.cpp scripted-diff: Fix bitcoin_config_h includes 2024-02-13 20:10:44 +00:00
interfaces.cpp wallet: use optional for change position as an optional in CreateTransaction 2023-12-08 17:12:19 -05:00
load.cpp interfaces: Add schedulerMockForward method so mockscheduler RPC can work across processes 2023-10-20 10:30:16 -04:00
load.h interfaces: Add schedulerMockForward method so mockscheduler RPC can work across processes 2023-10-20 10:30:16 -04:00
receive.cpp Use Txid in COutpoint 2023-11-21 13:15:44 +00:00
receive.h wallet: Add wallet/types.h for simple public enum and struct types 2023-04-11 15:52:25 -04:00
salvage.cpp tidy: modernize-use-emplace 2023-10-12 11:27:19 +02:00
salvage.h refactor: Move fs.* to util/fs.* 2023-03-23 12:55:18 +01:00
scriptpubkeyman.cpp Merge bitcoin/bitcoin#26008: wallet: cache IsMine scriptPubKeys to improve performance of descriptor wallets 2024-02-20 10:17:46 +00:00
scriptpubkeyman.h Merge bitcoin/bitcoin#26008: wallet: cache IsMine scriptPubKeys to improve performance of descriptor wallets 2024-02-20 10:17:46 +00:00
spend.cpp Merge bitcoin/bitcoin#27877: wallet: Add CoinGrinder coin selection algorithm 2024-02-09 16:38:13 -05:00
spend.h refactor: pass CRecipient to FundTransaction 2024-01-19 15:04:56 +01:00
sqlite.cpp Merge bitcoin/bitcoin#29404: refactor: bitcoin-config.h includes cleanup 2024-02-20 13:07:48 +00:00
sqlite.h sqlite: Ensure that only one SQLiteBatch is writing to db at a time 2024-02-06 12:24:36 -05:00
transaction.cpp wallet, refactor: Add CWalletTx::updateState function 2023-10-23 17:35:36 -04:00
transaction.h Use ParamsWrapper for witness serialization 2023-11-14 08:45:30 +10:00
types.h wallet: add AddressPurpose enum to replace string values 2023-04-11 15:52:25 -04:00
wallet.cpp Merge bitcoin/bitcoin#26008: wallet: cache IsMine scriptPubKeys to improve performance of descriptor wallets 2024-02-20 10:17:46 +00:00
wallet.h Merge bitcoin/bitcoin#26008: wallet: cache IsMine scriptPubKeys to improve performance of descriptor wallets 2024-02-20 10:17:46 +00:00
walletdb.cpp Merge bitcoin/bitcoin#29404: refactor: bitcoin-config.h includes cleanup 2024-02-20 13:07:48 +00:00
walletdb.h wallet: db, introduce 'RunWithinTxn()' helper function 2024-02-12 16:05:14 -03:00
wallettool.cpp wallettool: Don't create CWallet when dumping DB 2023-12-19 16:54:06 -05:00
wallettool.h Add src/wallet/* code to wallet:: namespace 2022-01-06 22:14:16 -05:00
walletutil.cpp move-only: Extract common/args and common/config.cpp from util/system 2023-04-19 10:48:30 +02:00
walletutil.h wallet: cache descriptor ID to avoid repeated descriptor string creation 2023-11-05 23:50:58 +01:00