diff options
author | Fabian Jahr <fjahr@protonmail.com> | 2019-12-31 19:55:18 +0100 |
---|---|---|
committer | Fabian Jahr <fjahr@protonmail.com> | 2020-01-13 13:40:06 +0100 |
commit | 6fc554f591d8ea1681b8bb25aa12da8d4f023f66 (patch) | |
tree | 2ab3afcf7114c8bab9630dd255685958123c4dd6 /src/wallet/wallet.h | |
parent | 6196e930018181301b5972842ae384ea4288ff34 (diff) |
wallet: Reset reused transactions cache
If a destination is reused we mark the cache of the other transactions going to that destination dirty so they are not accidentally reported as trusted when the cache is hit.
Diffstat (limited to 'src/wallet/wallet.h')
-rw-r--r-- | src/wallet/wallet.h | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/wallet/wallet.h b/src/wallet/wallet.h index c86367dc0f..5811f598ae 100644 --- a/src/wallet/wallet.h +++ b/src/wallet/wallet.h @@ -803,7 +803,7 @@ public: // Whether this or any known UTXO with the same single key has been spent. bool IsUsedDestination(const uint256& hash, unsigned int n) const EXCLUSIVE_LOCKS_REQUIRED(cs_wallet); - void SetUsedDestinationState(WalletBatch& batch, const uint256& hash, unsigned int n, bool used) EXCLUSIVE_LOCKS_REQUIRED(cs_wallet); + void SetUsedDestinationState(WalletBatch& batch, const uint256& hash, unsigned int n, bool used, std::set<CTxDestination>& tx_destinations) EXCLUSIVE_LOCKS_REQUIRED(cs_wallet); std::vector<OutputGroup> GroupOutputs(const std::vector<COutput>& outputs, bool single_coin) const; @@ -963,6 +963,12 @@ public: std::set<CTxDestination> GetLabelAddresses(const std::string& label) const; + /** + * Marks all outputs in each one of the destinations dirty, so their cache is + * reset and does not return outdated information. + */ + void MarkDestinationsDirty(const std::set<CTxDestination>& destinations) EXCLUSIVE_LOCKS_REQUIRED(cs_wallet); + bool GetNewDestination(const OutputType type, const std::string label, CTxDestination& dest, std::string& error); bool GetNewChangeDestination(const OutputType type, CTxDestination& dest, std::string& error); |