|
|
|
@ -236,8 +236,6 @@ std::string COutput::ToString() const
|
|
|
|
|
return strprintf("COutput(%s, %d, %d) [%s]", tx->GetHash().ToString(), i, nDepth, FormatMoney(tx->tx->vout[i].nValue));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
std::vector<CKeyID> GetAffectedKeys(const CScript& spk, const SigningProvider& provider);
|
|
|
|
|
|
|
|
|
|
const CWalletTx* CWallet::GetWalletTx(const uint256& hash) const
|
|
|
|
|
{
|
|
|
|
|
LOCK(cs_wallet);
|
|
|
|
@ -876,17 +874,8 @@ bool CWallet::AddToWalletIfInvolvingMe(const CTransactionRef& ptx, CWalletTx::St
|
|
|
|
|
|
|
|
|
|
// loop though all outputs
|
|
|
|
|
for (const CTxOut& txout: tx.vout) {
|
|
|
|
|
// extract addresses and check if they match with an unused keypool key
|
|
|
|
|
for (const auto& keyid : GetAffectedKeys(txout.scriptPubKey, *m_spk_man)) {
|
|
|
|
|
std::map<CKeyID, int64_t>::const_iterator mi = m_spk_man->m_pool_key_to_index.find(keyid);
|
|
|
|
|
if (mi != m_spk_man->m_pool_key_to_index.end()) {
|
|
|
|
|
WalletLogPrintf("%s: Detected a used keypool key, mark all keypool key up to this key as used\n", __func__);
|
|
|
|
|
MarkReserveKeysAsUsed(mi->second);
|
|
|
|
|
|
|
|
|
|
if (!m_spk_man->TopUp()) {
|
|
|
|
|
WalletLogPrintf("%s: Topping up keypool failed (locked wallet)\n", __func__);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (auto spk_man = m_spk_man.get()) {
|
|
|
|
|
spk_man->MarkUnusedAddresses(txout.scriptPubKey);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|