diff options
author | Ryan Ofsky <ryan@ofsky.org> | 2020-04-12 13:40:43 -0400 |
---|---|---|
committer | Ryan Ofsky <ryan@ofsky.org> | 2023-04-12 05:30:43 -0400 |
commit | a5986e82dd2b8f923d60f9e31760ef62b9010105 (patch) | |
tree | e8d7dba6b4c7f022542e3d2ddbea9c0619961f07 /src/wallet/walletdb.h | |
parent | 5938ad0bdb013953861c7cd15a95f00998a06f44 (diff) | |
download | bitcoin-a5986e82dd2b8f923d60f9e31760ef62b9010105.tar.xz |
refactor: Remove CAddressBookData::destdata
This is cleanup that doesn't change external behavior.
- Removes awkward `StringMap` intermediate representation
- Simplifies CWallet code, deals with used address and received request
serialization in walletdb.cpp
- Adds test coverage and documentation
- Reduces memory usage
This PR doesn't change externally observable behavior. Internally, only change
in behavior is that EraseDestData deletes directly from database because the
`StringMap` is gone. This is more direct and efficient because it uses a single
btree lookup and scan instead of multiple lookups
Motivation for this cleanup is making changes like #18550, #18192, #13756
easier to reason about and less likely to result in unintended behavior and
bugs
Co-authored-by: furszy <matiasfurszyfer@protonmail.com>
Diffstat (limited to 'src/wallet/walletdb.h')
-rw-r--r-- | src/wallet/walletdb.h | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/wallet/walletdb.h b/src/wallet/walletdb.h index c97356a71f..72086e950a 100644 --- a/src/wallet/walletdb.h +++ b/src/wallet/walletdb.h @@ -7,6 +7,7 @@ #define BITCOIN_WALLET_WALLETDB_H #include <script/sign.h> +#include <script/standard.h> #include <wallet/db.h> #include <wallet/walletutil.h> #include <key.h> @@ -264,10 +265,10 @@ public: bool WriteLockedUTXO(const COutPoint& output); bool EraseLockedUTXO(const COutPoint& output); - /// Write destination data key,value tuple to database - bool WriteDestData(const std::string &address, const std::string &key, const std::string &value); - /// Erase destination data tuple from wallet database - bool EraseDestData(const std::string &address, const std::string &key); + bool WriteAddressPreviouslySpent(const CTxDestination& dest, bool previously_spent); + bool WriteAddressReceiveRequest(const CTxDestination& dest, const std::string& id, const std::string& receive_request); + bool EraseAddressReceiveRequest(const CTxDestination& dest, const std::string& id); + bool EraseAddressData(const CTxDestination& dest); bool WriteActiveScriptPubKeyMan(uint8_t type, const uint256& id, bool internal); bool EraseActiveScriptPubKeyMan(uint8_t type, bool internal); |