| 910 | } |
| 911 | |
| 912 | bool CWallet::IsSpentKey(const uint256& hash, unsigned int n) const |
| 913 | { |
| 914 | AssertLockHeld(cs_wallet); |
| 915 | const CWalletTx* srctx = GetWalletTx(hash); |
| 916 | if (srctx) { |
| 917 | assert(srctx->tx->vout.size() > n); |
| 918 | CTxDestination dest; |
| 919 | if (!ExtractDestination(srctx->tx->vout[n].scriptPubKey, dest)) { |
| 920 | return false; |
| 921 | } |
| 922 | if (IsAddressUsed(dest)) { |
| 923 | return true; |
| 924 | } |
| 925 | if (IsLegacy()) { |
| 926 | LegacyScriptPubKeyMan* spk_man = GetLegacyScriptPubKeyMan(); |
| 927 | assert(spk_man != nullptr); |
| 928 | for (const auto& keyid : GetAffectedKeys(srctx->tx->vout[n].scriptPubKey, *spk_man)) { |
| 929 | WitnessV0KeyHash wpkh_dest(keyid); |
| 930 | if (IsAddressUsed(wpkh_dest)) { |
| 931 | return true; |
| 932 | } |
| 933 | ScriptHash sh_wpkh_dest(GetScriptForDestination(wpkh_dest)); |
| 934 | if (IsAddressUsed(sh_wpkh_dest)) { |
| 935 | return true; |
| 936 | } |
| 937 | PKHash pkh_dest(keyid); |
| 938 | if (IsAddressUsed(pkh_dest)) { |
| 939 | return true; |
| 940 | } |
| 941 | } |
| 942 | } |
| 943 | } |
| 944 | return false; |
| 945 | } |
| 946 | |
| 947 | CWalletTx* CWallet::AddToWallet(CTransactionRef tx, const TxState& state, const UpdateWalletTxFn& update_wtx, bool fFlushOnClose, bool rescanning_old_block) |
| 948 | { |
no test coverage detected