bitcoin/src/wallet
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
..
test Merge bitcoin/bitcoin#21206: refactor: Make CWalletTx sync state type-safe 2021-11-25 19:41:53 +01:00
bdb.cpp wallet: Use PACKAGE_NAME to mention our software 2021-10-20 21:09:14 +03:00
bdb.h wallet: Fixed Grammatical error in bdb.h 2021-11-09 12:41:37 +01:00
coincontrol.cpp refactor: Drop CCoinControl::SetNull 2021-04-18 21:10:47 +01:00
coincontrol.h External input fund support cleanups 2021-10-06 06:55:34 +08:00
coinselection.cpp Merge bitcoin/bitcoin#22951: consensus: move amount.h into consensus 2021-10-05 09:43:23 +02:00
coinselection.h Merge bitcoin/bitcoin#22951: consensus: move amount.h into consensus 2021-10-05 09:43:23 +02:00
context.cpp Remove g_rpc_chain global 2020-05-28 02:13:19 -04:00
context.h refactor: remove ::vpwallets and related global variables 2021-08-17 04:05:15 -04:00
crypter.cpp refactor: Replace &foo[0] with foo.data() 2021-05-04 06:55:31 +02:00
crypter.h scripted-diff: Bump copyright headers 2020-12-31 09:45:41 +01:00
db.cpp refactor: get wallet path relative to wallet_dir 2021-10-29 09:36:32 -05:00
db.h refactor: post Optional<> removal cleanups 2021-03-17 14:56:20 +08:00
dump.cpp Remove gArgs from wallet.h and wallet.cpp 2021-11-09 11:27:06 +01:00
dump.h wallettool: Add createfromdump command 2020-12-16 12:33:06 -05:00
external_signer_scriptpubkeyman.cpp Merge bitcoin/bitcoin#21365: Basic Taproot signing support for descriptor wallets 2021-06-18 09:12:44 +12:00
external_signer_scriptpubkeyman.h refactor: remove m_internal from DescriptorSPKman 2021-06-30 08:37:50 +02:00
feebumper.cpp refactor: Detach wallet transaction methods (followup for move-only) 2021-09-01 02:22:58 -05:00
feebumper.h wallet: Avoid translating RPC errors when creating txs 2020-05-01 07:39:06 -04:00
fees.cpp scripted-diff: Bump copyright headers 2020-12-31 09:45:41 +01:00
fees.h [MOVEONLY] consensus: move amount.h into consensus 2021-09-30 07:41:57 +08:00
init.cpp Mention bech32m in -addresstype and -changetype help 2021-11-16 12:20:13 -05:00
interfaces.cpp refactor: Make CWalletTx sync state type-safe 2021-11-15 09:11:44 -05:00
ismine.h doc: Add developer documentation to isminetype 2021-01-19 19:04:45 +08:00
load.cpp refactor: Block unsafe fs::path std::string conversion calls 2021-10-05 11:10:47 -04:00
load.h refactor: remove ::vpwallets and related global variables 2021-08-17 04:05:15 -04:00
receive.cpp [MOVEONLY] consensus: move amount.h into consensus 2021-09-30 07:41:57 +08:00
receive.h [MOVEONLY] consensus: move amount.h into consensus 2021-09-30 07:41:57 +08:00
rpcdump.cpp Merge bitcoin/bitcoin#21206: refactor: Make CWalletTx sync state type-safe 2021-11-25 19:41:53 +01:00
rpcwallet.cpp Merge bitcoin/bitcoin#21206: refactor: Make CWalletTx sync state type-safe 2021-11-25 19:41:53 +01:00
rpcwallet.h doc: Fix typos in endif header comments 2021-11-16 09:56:45 +01:00
salvage.cpp Remove gArgs from wallet.h and wallet.cpp 2021-11-09 11:27:06 +01:00
salvage.h wallettool: Have RecoverDatabaseFile return errors and warnings 2020-07-26 20:22:45 -04:00
scriptpubkeyman.cpp Merge bitcoin/bitcoin#22364: wallet: Make a tr() descriptor by default 2021-11-22 10:01:17 +01:00
scriptpubkeyman.h wallet, refactor: Make GetOldestKeyPoolTime return type std::optional 2021-11-03 10:35:47 +02:00
spend.cpp External input fund support cleanups 2021-10-06 06:55:34 +08:00
spend.h Merge bitcoin/bitcoin#22951: consensus: move amount.h into consensus 2021-10-05 09:43:23 +02:00
sqlite.cpp wallet: Use PACKAGE_NAME to mention our software 2021-10-20 21:09:14 +03:00
sqlite.h doc: fix various typos 2021-01-04 12:31:31 +08:00
transaction.cpp refactor: Make CWalletTx sync state type-safe 2021-11-15 09:11:44 -05:00
transaction.h refactor: Make CWalletTx sync state type-safe 2021-11-15 09:11:44 -05:00
wallet.cpp Merge bitcoin/bitcoin#21206: refactor: Make CWalletTx sync state type-safe 2021-11-25 19:41:53 +01:00
wallet.h Merge bitcoin/bitcoin#21206: refactor: Make CWalletTx sync state type-safe 2021-11-25 19:41:53 +01:00
walletdb.cpp refactor: Make CWalletTx sync state type-safe 2021-11-15 09:11:44 -05:00
walletdb.h Merge bitcoin/bitcoin#22951: consensus: move amount.h into consensus 2021-10-05 09:43:23 +02:00
wallettool.cpp Merge bitcoin/bitcoin#23349: util: Use FEATURE_LATEST for wallets created with bitcoin-wallet 2021-11-16 15:32:18 +13:00
wallettool.h refactor: Move all command dependend checks to ExecuteWalletToolFunc 2021-01-21 19:30:34 +01:00
walletutil.cpp refactor: Block unsafe fs::path std::string conversion calls 2021-10-05 11:10:47 -04:00
walletutil.h wallet: Upgrade existing descriptor caches 2021-06-24 13:49:22 -04:00