0
0
Fork 0
mirror of https://github.com/bitcoin/bitcoin.git synced 2025-02-13 11:25:02 -05:00
bitcoin-bitcoin-core/src/wallet
furszy 77de5c693f
wallet: guard and alert about a wallet invalid state during chain sync
-Context:
If `AddToWallet` db write fails, the method returns a wtx nullptr without
removing the recently added transaction from the wallet's map.

-Problem:
When a db write error occurs, `AddToWalletIfInvolvingMe` return false even
when the tx is on the wallet's map already --> which makes `SyncTransaction`
skip the `MarkInputsDirty` call --> which leads to a wallet invalid state
where the inputs of this new transaction are not marked dirty, while the
transaction that spends them still exist on the in-memory wallet tx map.

Plus, as we only store arriving transaction inside `AddToWalletIfInvolvingMe`
when we synchronize/scan blocks from the chain and nowhere else, it makes sense
to treat the tx db write error as a runtime error to notify the user about the
problem. Otherwise, the user will lose all the not stored transactions after a
wallet shutdown (without be able to recover them automatically on the next
startup because the chain sync would be above the block where the txs arrived).
2022-07-18 11:29:27 -03:00
..
rpc refactor: Default options in walletcreatefundedpsbt to VOBJ instead of VNULL 2022-07-13 18:04:23 +02:00
test Merge bitcoin/bitcoin#25218: refactor: introduce generic 'Result' class and connect it to CreateTransaction and GetNewDestination 2022-07-12 13:56:48 +02:00
bdb.cpp wallet: don't read db every time that a new WalletBatch is created 2022-06-16 12:18:58 -03:00
bdb.h
coincontrol.cpp
coincontrol.h scripted-diff: rename fAllowOtherInputs -> m_allow_other_inputs 2022-06-19 20:32:51 -03:00
coinselection.cpp Revert "bnb: exit selection when best_waste is 0" 2022-06-28 17:27:06 -04:00
coinselection.h
context.cpp
context.h
crypter.cpp
crypter.h
db.cpp
db.h
dump.cpp
dump.h
external_signer_scriptpubkeyman.cpp
external_signer_scriptpubkeyman.h
feebumper.cpp send: refactor CreateTransaction flow to return a BResult<CTransactionRef> 2022-07-08 11:18:35 -03:00
feebumper.h
fees.cpp
fees.h
init.cpp scripted-diff: Avoid incompatibility with CMake AUTOUIC feature 2022-06-14 10:38:51 +02:00
interfaces.cpp refactor: Return BResult from restoreWallet 2022-07-12 19:20:01 +02:00
ismine.h
load.cpp
load.h
receive.cpp wallet: don't iter twice when getting the cached debit/credit amount 2022-07-05 15:43:09 +02:00
receive.h
salvage.cpp
salvage.h
scriptpubkeyman.cpp wallet: refactor GetNewDestination, use BResult 2022-07-08 11:18:35 -03:00
scriptpubkeyman.h wallet: refactor GetNewDestination, use BResult 2022-07-08 11:18:35 -03:00
spend.cpp Merge bitcoin/bitcoin#25218: refactor: introduce generic 'Result' class and connect it to CreateTransaction and GetNewDestination 2022-07-12 13:56:48 +02:00
spend.h Merge bitcoin/bitcoin#25218: refactor: introduce generic 'Result' class and connect it to CreateTransaction and GetNewDestination 2022-07-12 13:56:48 +02:00
sqlite.cpp
sqlite.h
transaction.cpp
transaction.h
wallet.cpp wallet: guard and alert about a wallet invalid state during chain sync 2022-07-18 11:29:27 -03:00
wallet.h wallet: guard and alert about a wallet invalid state during chain sync 2022-07-18 11:29:27 -03:00
walletdb.cpp Merge bitcoin/bitcoin#25383: wallet: don't read db every time that a new 'WalletBatch' is created 2022-06-30 18:38:20 +02:00
walletdb.h
wallettool.cpp
wallettool.h
walletutil.cpp
walletutil.h