elements/src/wallet
W. J. van der Laan bce58bbb3d
Merge bitcoin/bitcoin#22929: wallet: Automatically add receiving destinations to the address book
3d71d16d1e test: listtranscations with externally generated addresses (S3RK)
d04566415e Add to spends only transcations from me (S3RK)
9f3a622b1c Automatically add labels to detected receiving addresses (S3RK)
c1b99c088c Return used destinations from ScriptPubKeyMan::MarkUnusedAddresses (S3RK)
03840c2064 Add CWallet::IsInternalScriptPubKeyMan (S3RK)
456e350926 wallet: resolve ambiguity of two ScriptPubKey managers providing same script (S3RK)

Pull request description:

  This PR fixes certain use-cases when **send-to-self** transactions are missing from `listtransactions` output.

  1. When a receiving address is generated externally to the wallet
  (e.g. same wallet running on two nodes, or by 3rd party from xpub)
  2. When restoring backup with lost metadata, but keypool gap is not exceeded yet

  When the block is connected or tx added to mempool we already mark used keys. This PR extends this logic to determine whether the destination is a receiving one and if yes add it to the address book with empty label.

  Works both for legacy and descriptors wallets.
  - For legacy it uses the internal flag from the keypool entry. Caveat: because we don't know which script type would be used we add all possible destinations for such keys.
  - For descriptor wallets it uses internal flag for the script pub key manager. Caveat: it only works for active descriptors.

  fixes #19856
  fixes #20293

ACKs for top commit:
  laanwj:
    Code review ACK 3d71d16d1e

Tree-SHA512: 03fafd5548ead0c4ffe9ebcc9eb2849f1d2fa7270fda4166419b86877d4e57dcf04460e465fbb9c90b42031f3c05d1b83f1b67a9f82c2a42980825ed1e7b52e6
2021-12-02 19:37:33 +01:00
..
rpc MOVEONLY: Move utility functions from rpcwallet to wallet/rpc/util 2021-12-01 19:22:38 +13:00
test Merge bitcoin/bitcoin#22929: wallet: Automatically add receiving destinations to the address book 2021-12-02 19:37:33 +01:00
bdb.cpp wallet: Use PACKAGE_NAME to mention our software 2021-10-20 21:09:14 +03:00
bdb.h wallet: Fixed Grammatical error in bdb.h 2021-11-09 12:41:37 +01:00
coincontrol.cpp refactor: Drop CCoinControl::SetNull 2021-04-18 21:10:47 +01:00
coincontrol.h External input fund support cleanups 2021-10-06 06:55:34 +08:00
coinselection.cpp Merge bitcoin/bitcoin#22951: consensus: move amount.h into consensus 2021-10-05 09:43:23 +02:00
coinselection.h Merge bitcoin/bitcoin#22951: consensus: move amount.h into consensus 2021-10-05 09:43:23 +02:00
context.cpp
context.h wallet: Call load handlers without cs_wallet locked 2021-11-22 09:42:36 +00:00
crypter.cpp refactor: Replace &foo[0] with foo.data() 2021-05-04 06:55:31 +02:00
crypter.h scripted-diff: Bump copyright headers 2020-12-31 09:45:41 +01:00
db.cpp refactor: get wallet path relative to wallet_dir 2021-10-29 09:36:32 -05:00
db.h refactor: post Optional<> removal cleanups 2021-03-17 14:56:20 +08:00
dump.cpp Remove gArgs from wallet.h and wallet.cpp 2021-11-09 11:27:06 +01:00
dump.h wallettool: Add createfromdump command 2020-12-16 12:33:06 -05:00
external_signer_scriptpubkeyman.cpp psbt: sign without finalizing 2021-09-28 19:13:42 -04:00
external_signer_scriptpubkeyman.h psbt: sign without finalizing 2021-09-28 19:13:42 -04:00
feebumper.cpp refactor: Detach wallet transaction methods (followup for move-only) 2021-09-01 02:22:58 -05:00
feebumper.h
fees.cpp scripted-diff: Bump copyright headers 2020-12-31 09:45:41 +01:00
fees.h [MOVEONLY] consensus: move amount.h into consensus 2021-09-30 07:41:57 +08:00
init.cpp Mention bech32m in -addresstype and -changetype help 2021-11-16 12:20:13 -05:00
interfaces.cpp refactor: Make CWalletTx sync state type-safe 2021-11-15 09:11:44 -05:00
ismine.h refactor: Use underlying type of isminetype for isminefilter 2021-11-25 14:56:30 +01:00
load.cpp refactor: Block unsafe fs::path std::string conversion calls 2021-10-05 11:10:47 -04:00
load.h refactor: remove ::vpwallets and related global variables 2021-08-17 04:05:15 -04:00
receive.cpp [MOVEONLY] consensus: move amount.h into consensus 2021-09-30 07:41:57 +08:00
receive.h [MOVEONLY] consensus: move amount.h into consensus 2021-09-30 07:41:57 +08:00
rpcdump.cpp Merge bitcoin/bitcoin#22929: wallet: Automatically add receiving destinations to the address book 2021-12-02 19:37:33 +01:00
rpcwallet.cpp Merge bitcoin/bitcoin#22929: wallet: Automatically add receiving destinations to the address book 2021-12-02 19:37:33 +01:00
rpcwallet.h MOVEONLY: Move utility functions from rpcwallet to wallet/rpc/util 2021-12-01 19:22:38 +13:00
salvage.cpp Remove gArgs from wallet.h and wallet.cpp 2021-11-09 11:27:06 +01:00
salvage.h wallettool: Have RecoverDatabaseFile return errors and warnings 2020-07-26 20:22:45 -04:00
scriptpubkeyman.cpp Merge bitcoin/bitcoin#22929: wallet: Automatically add receiving destinations to the address book 2021-12-02 19:37:33 +01:00
scriptpubkeyman.h Merge bitcoin/bitcoin#22929: wallet: Automatically add receiving destinations to the address book 2021-12-02 19:37:33 +01:00
spend.cpp External input fund support cleanups 2021-10-06 06:55:34 +08:00
spend.h Merge bitcoin/bitcoin#22951: consensus: move amount.h into consensus 2021-10-05 09:43:23 +02:00
sqlite.cpp wallet: Use PACKAGE_NAME to mention our software 2021-10-20 21:09:14 +03:00
sqlite.h doc: fix various typos 2021-01-04 12:31:31 +08:00
transaction.cpp refactor: Make CWalletTx sync state type-safe 2021-11-15 09:11:44 -05:00
transaction.h refactor: Make CWalletTx sync state type-safe 2021-11-15 09:11:44 -05:00
wallet.cpp Merge bitcoin/bitcoin#22929: wallet: Automatically add receiving destinations to the address book 2021-12-02 19:37:33 +01:00
wallet.h Merge bitcoin/bitcoin#22929: wallet: Automatically add receiving destinations to the address book 2021-12-02 19:37:33 +01:00
walletdb.cpp refactor: Make CWalletTx sync state type-safe 2021-11-15 09:11:44 -05:00
walletdb.h Merge bitcoin/bitcoin#22951: consensus: move amount.h into consensus 2021-10-05 09:43:23 +02:00
wallettool.cpp Merge bitcoin/bitcoin#23349: util: Use FEATURE_LATEST for wallets created with bitcoin-wallet 2021-11-16 15:32:18 +13:00
wallettool.h refactor: Move all command dependend checks to ExecuteWalletToolFunc 2021-01-21 19:30:34 +01:00
walletutil.cpp refactor: Block unsafe fs::path std::string conversion calls 2021-10-05 11:10:47 -04:00
walletutil.h wallet: Upgrade existing descriptor caches 2021-06-24 13:49:22 -04:00