Fix broken ExtractAddress (refactored, made callers check for addresses in keystore if they care)

This commit is contained in:
Gavin Andresen
2011-12-22 15:51:44 -05:00
parent ce336fdc21
commit 2e17ac83c6
7 changed files with 20 additions and 18 deletions

View File

@@ -394,7 +394,7 @@ bool CWallet::IsChange(const CTxOut& txout) const
// a better way of identifying which outputs are 'the send' and which are
// 'the change' will need to be implemented (maybe extend CWalletTx to remember
// which output, if any, was change).
if (ExtractAddress(txout.scriptPubKey, this, address))
if (ExtractAddress(txout.scriptPubKey, address) && HaveKey(address))
CRITICAL_BLOCK(cs_wallet)
if (!mapAddressBook.count(address))
return true;
@@ -475,7 +475,7 @@ void CWalletTx::GetAmounts(int64& nGeneratedImmature, int64& nGeneratedMature, l
{
CBitcoinAddress address;
vector<unsigned char> vchPubKey;
if (!ExtractAddress(txout.scriptPubKey, NULL, address))
if (!ExtractAddress(txout.scriptPubKey, address))
{
printf("CWalletTx::GetAmounts: Unknown transaction type found, txid %s\n",
this->GetHash().ToString().c_str());