mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-13 11:25:02 -05:00
![]() -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). |
||
---|---|---|
.. | ||
rpc | ||
test | ||
bdb.cpp | ||
bdb.h | ||
coincontrol.cpp | ||
coincontrol.h | ||
coinselection.cpp | ||
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 | ||
feebumper.h | ||
fees.cpp | ||
fees.h | ||
init.cpp | ||
interfaces.cpp | ||
ismine.h | ||
load.cpp | ||
load.h | ||
receive.cpp | ||
receive.h | ||
salvage.cpp | ||
salvage.h | ||
scriptpubkeyman.cpp | ||
scriptpubkeyman.h | ||
spend.cpp | ||
spend.h | ||
sqlite.cpp | ||
sqlite.h | ||
transaction.cpp | ||
transaction.h | ||
wallet.cpp | ||
wallet.h | ||
walletdb.cpp | ||
walletdb.h | ||
wallettool.cpp | ||
wallettool.h | ||
walletutil.cpp | ||
walletutil.h |