perhaps simplify
0 {
1 AssertLockHeld(cs_wallet);
2 CTxDestination dst;
3- if (ExtractDestination(cout.scriptPubKey, dst)) {
4- if (IsMine(dst)) {
5- if (used && !GetDestData(dst, "address_used", nullptr)) {
6- AddDestData(batch, dst, "address_used", "p"); // p for "present", opposite of absent (null)
7- } else if (!used && GetDestData(dst, "address_used", nullptr)) {
8- EraseDestData(batch, dst, "address_used");
9- }
10+ if (ExtractDestination(cout.scriptPubKey, dst) && IsMine(dst)) {
11+ if (used && !GetDestData(dst, "address_used", nullptr)) {
12+ AddDestData(batch, dst, "address_used", "p"); // p for "present", opposite of absent (null)
13+ } else if (!used && GetDestData(dst, "address_used", nullptr)) {
14+ EraseDestData(batch, dst, "address_used");
15 }
16 }
17 }