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
..
2021-09-29 14:10:29 +02:00
2022-06-10 12:39:08 +01:00
2022-07-14 20:53:23 +02:00
2022-06-20 12:22:05 +01:00
2021-11-12 11:46:34 +01:00
2022-04-20 14:29:29 +01:00
2022-06-08 13:35:32 +02:00
2022-02-15 09:29:53 -05:00
2022-06-20 12:22:05 +01:00
2022-06-20 12:22:05 +01:00
2021-12-30 19:36:57 +02:00
2021-12-30 19:36:57 +02:00
2022-05-27 16:59:45 +02:00
2022-05-30 13:55:39 +02:00
2022-06-21 22:54:55 +07:00
2021-12-30 19:36:57 +02:00
2021-12-30 19:36:57 +02:00
2022-03-10 13:05:29 +01:00
2022-01-02 11:40:31 +01:00