You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
a5986e8 refactor: Remove CAddressBookData::destdata (Ryan Ofsky)
5938ad0 wallet: Add DatabaseBatch::ErasePrefix method (Ryan Ofsky)
Pull request description:
This is cleanup that doesn't change external behavior. Benefits of the cleanup are:
- Removes awkward `StringMap` intermediate representation for wallet address metadata.
- Simplifies `CWallet`, deals with used address and received request serialization in `walletdb.cpp` instead of higher level wallet code
- Adds test coverage and documentation
This PR doesn't change externally observable behavior. Internally, the only change in behavior is that `EraseDestData` deletes rows directly from the database because they are no longer stored in memory. This is more direct and efficient because it uses a single lookup and scan instead of multiple lookups.
Motivation for this cleanup is making changes like bitcoin#18550, bitcoin#18192, bitcoin#13756 easier to reason about and less likely to result in unintended behavior and bugs
---
This PR is a rebased copy of bitcoin#18608. For some reason that PR is locked and couldn't be reopened or commented on.
This PR is an alternative to bitcoin#27215 with differences described in bitcoin#27215 (review)
ACKs for top commit:
achow101:
ACK a5986e8
furszy:
Code ACK a5986e8
Tree-SHA512: 6bd3e402f1f60263fbd433760bdc29d04175ddaf8307207c4a67d59f6cffa732e176ba57886e02926f7a1615dce0ed9cda36c8cbc6430aa8e5b56934c23f3fe7
// If we want to delete receiving addresses, we need to take care that DestData "used" (and possibly newer DestData) gets preserved (and the "deleted" address transformed into a change entry instead of actually being deleted)
2294
-
// NOTE: This isn't a problem for sending addresses because they never have any DestData yet!
2295
-
// When adding new DestData, it should be considered here whether to retain or delete it (or move it?).
2294
+
// If we want to delete receiving addresses, we should avoid calling EraseAddressData because it will delete the previously_spent value. Could instead just erase the label so it becomes a change address, and keep the data.
2295
+
// NOTE: This isn't a problem for sending addresses because they don't have any data that needs to be kept.
2296
+
// When adding new address data, it should be considered here whether to retain or delete it.
2296
2297
if (IsMine(address)) {
2297
2298
WalletLogPrintf("%s called with IsMine address, NOT SUPPORTED. Please report this bug! %s\n", __func__, PACKAGE_BUGREPORT);
0 commit comments