aboutsummaryrefslogtreecommitdiff
path: root/src/bitcoinrpc.cpp
diff options
context:
space:
mode:
authorGavin Andresen <gavinandresen@gmail.com>2011-12-22 15:51:44 -0500
committerGavin Andresen <gavinandresen@gmail.com>2011-12-22 15:57:31 -0500
commit2e17ac83c65b65fe2037b8c8941c25e288905903 (patch)
tree143d73d45bae5e0046ac994a3432f4353d9c0382 /src/bitcoinrpc.cpp
parentce336fdc21c25c055ffef28fbe7c61164df7ca24 (diff)
downloadbitcoin-2e17ac83c65b65fe2037b8c8941c25e288905903.tar.xz
Fix broken ExtractAddress (refactored, made callers check for addresses in keystore if they care)
Diffstat (limited to 'src/bitcoinrpc.cpp')
-rw-r--r--src/bitcoinrpc.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/bitcoinrpc.cpp b/src/bitcoinrpc.cpp
index bed90d4f6c..c1e8ef7690 100644
--- a/src/bitcoinrpc.cpp
+++ b/src/bitcoinrpc.cpp
@@ -689,7 +689,7 @@ Value getreceivedbyaccount(const Array& params, bool fHelp)
BOOST_FOREACH(const CTxOut& txout, wtx.vout)
{
CBitcoinAddress address;
- if (ExtractAddress(txout.scriptPubKey, pwalletMain, address) && setAddress.count(address))
+ if (ExtractAddress(txout.scriptPubKey, address) && pwalletMain->HaveKey(address) && setAddress.count(address))
if (wtx.GetDepthInMainChain() >= nMinDepth)
nAmount += txout.nValue;
}
@@ -1033,6 +1033,7 @@ Value ListReceived(const Array& params, bool fByAccounts)
for (map<uint256, CWalletTx>::iterator it = pwalletMain->mapWallet.begin(); it != pwalletMain->mapWallet.end(); ++it)
{
const CWalletTx& wtx = (*it).second;
+
if (wtx.IsCoinBase() || !wtx.IsFinal())
continue;
@@ -1043,7 +1044,7 @@ Value ListReceived(const Array& params, bool fByAccounts)
BOOST_FOREACH(const CTxOut& txout, wtx.vout)
{
CBitcoinAddress address;
- if (!ExtractAddress(txout.scriptPubKey, pwalletMain, address) || !address.IsValid())
+ if (!ExtractAddress(txout.scriptPubKey, address) || !pwalletMain->HaveKey(address) || !address.IsValid())
continue;
tallyitem& item = mapTally[address];
@@ -1142,6 +1143,7 @@ void ListTransactions(const CWalletTx& wtx, const string& strAccount, int nMinDe
string strSentAccount;
list<pair<CBitcoinAddress, int64> > listReceived;
list<pair<CBitcoinAddress, int64> > listSent;
+
wtx.GetAmounts(nGeneratedImmature, nGeneratedMature, listReceived, listSent, nFee, strSentAccount);
bool fAllAccounts = (strAccount == string("*"));
@@ -1682,7 +1684,7 @@ Value validateaddress(const Array& params, bool fHelp)
std::vector<CBitcoinAddress> addresses;
txnouttype whichType;
int nRequired;
- ExtractAddresses(subscript, pwalletMain, whichType, addresses, nRequired);
+ ExtractAddresses(subscript, whichType, addresses, nRequired);
ret.push_back(Pair("script", GetTxnOutputType(whichType)));
Array a;
BOOST_FOREACH(const CBitcoinAddress& addr, addresses)