bitcoin/src/wallet/test
W. J. van der Laan cf24152596
Merge bitcoin/bitcoin#21206: refactor: Make CWalletTx sync state type-safe
d8ee8f3cd3 refactor: Make CWalletTx sync state type-safe (Russell Yanofsky)

Pull request description:

  Current `CWalletTx` state representation makes it possible to set inconsistent states that won't be handled correctly by wallet sync code or serialized & deserialized back into the same form.

  For example, it is possible to call `setConflicted` without setting a conflicting block hash, or `setConfirmed` with no transaction index. And it's possible update individual `m_confirm` and `fInMempool` data fields without setting an overall consistent state that can be serialized and handled correctly.

  Fix this without changing behavior by using `std::variant`, instead of an enum and collection of fields, to represent sync state, so state tracking code is safer and more legible.

  This is a first step to fixing state tracking bugs https://github.com/bitcoin-core/bitcoin-devwiki/wiki/Wallet-Transaction-Conflict-Tracking, by adding an extra margin of safety that can prevent new bugs from being introduced as existing bugs are fixed.

ACKs for top commit:
  laanwj:
    re-ACK d8ee8f3cd3
  jonatack:
    Code review ACK d8ee8f3cd3

Tree-SHA512: b9f15e9d99dbdbdd3ef7a76764e11f66949f50e6227e284126f209e4cb106af6d55e9a9e8c7d4aa216ddc92c6d5acc6f4aa4746f209bbd77f03831b51a2841c3
2021-11-25 19:41:53 +01:00
..
fuzz Create a tr() descriptor bech32m DescriptorScriptPubKeyMan by default 2021-11-16 12:20:13 -05:00
coinselector_tests.cpp refactor: Make CWalletTx sync state type-safe 2021-11-15 09:11:44 -05:00
db_tests.cpp refactor: Block unsafe fs::path std::string conversion calls 2021-10-05 11:10:47 -04:00
init_test_fixture.cpp refactor: Block unsafe fs::path std::string conversion calls 2021-10-05 11:10:47 -04:00
init_test_fixture.h scripted-diff: Bump copyright headers 2020-12-31 09:45:41 +01:00
init_tests.cpp refactor: Block unsafe fs::path std::string conversion calls 2021-10-05 11:10:47 -04:00
ismine_tests.cpp Remove gArgs from wallet.h and wallet.cpp 2021-11-09 11:27:06 +01:00
psbt_wallet_tests.cpp refactor: Make CWalletTx sync state type-safe 2021-11-15 09:11:44 -05:00
scriptpubkeyman_tests.cpp Remove gArgs from wallet.h and wallet.cpp 2021-11-09 11:27:06 +01:00
spend_tests.cpp Remove gArgs from wallet.h and wallet.cpp 2021-11-09 11:27:06 +01:00
util.cpp Remove gArgs from wallet.h and wallet.cpp 2021-11-09 11:27:06 +01:00
util.h Remove gArgs from wallet.h and wallet.cpp 2021-11-09 11:27:06 +01:00
wallet_crypto_tests.cpp scripted-diff: Bump copyright headers 2020-12-31 09:45:41 +01:00
wallet_test_fixture.cpp Remove gArgs from wallet.h and wallet.cpp 2021-11-09 11:27:06 +01:00
wallet_test_fixture.h test: Fix segfault in the psbt_wallet_tests/psbt_updater_test 2021-10-31 13:48:00 +02:00
wallet_tests.cpp refactor: Make CWalletTx sync state type-safe 2021-11-15 09:11:44 -05:00
wallet_transaction_tests.cpp refactor: Make CWalletTx sync state type-safe 2021-11-15 09:11:44 -05:00
walletdb_tests.cpp scripted-diff: Bump copyright headers 2020-12-31 09:45:41 +01:00