Bugfix: Supress "address" key in transaction details, when the destination isn't recognized
Previously, it would pass corrupt/random through base58.
This commit is contained in:
parent
96ed682176
commit
cc6cfab38f
@ -953,6 +953,13 @@ Value listreceivedbyaccount(const Array& params, bool fHelp)
|
|||||||
return ListReceived(params, true);
|
return ListReceived(params, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void MaybePushAddress(Object & entry, const CTxDestination &dest)
|
||||||
|
{
|
||||||
|
CBitcoinAddress addr;
|
||||||
|
if (addr.Set(dest))
|
||||||
|
entry.push_back(Pair("address", addr.ToString()));
|
||||||
|
}
|
||||||
|
|
||||||
void ListTransactions(const CWalletTx& wtx, const string& strAccount, int nMinDepth, bool fLong, Array& ret)
|
void ListTransactions(const CWalletTx& wtx, const string& strAccount, int nMinDepth, bool fLong, Array& ret)
|
||||||
{
|
{
|
||||||
int64 nFee;
|
int64 nFee;
|
||||||
@ -971,7 +978,7 @@ void ListTransactions(const CWalletTx& wtx, const string& strAccount, int nMinDe
|
|||||||
{
|
{
|
||||||
Object entry;
|
Object entry;
|
||||||
entry.push_back(Pair("account", strSentAccount));
|
entry.push_back(Pair("account", strSentAccount));
|
||||||
entry.push_back(Pair("address", CBitcoinAddress(s.first).ToString()));
|
MaybePushAddress(entry, s.first);
|
||||||
entry.push_back(Pair("category", "send"));
|
entry.push_back(Pair("category", "send"));
|
||||||
entry.push_back(Pair("amount", ValueFromAmount(-s.second)));
|
entry.push_back(Pair("amount", ValueFromAmount(-s.second)));
|
||||||
entry.push_back(Pair("fee", ValueFromAmount(-nFee)));
|
entry.push_back(Pair("fee", ValueFromAmount(-nFee)));
|
||||||
@ -993,7 +1000,7 @@ void ListTransactions(const CWalletTx& wtx, const string& strAccount, int nMinDe
|
|||||||
{
|
{
|
||||||
Object entry;
|
Object entry;
|
||||||
entry.push_back(Pair("account", account));
|
entry.push_back(Pair("account", account));
|
||||||
entry.push_back(Pair("address", CBitcoinAddress(r.first).ToString()));
|
MaybePushAddress(entry, r.first);
|
||||||
if (wtx.IsCoinBase())
|
if (wtx.IsCoinBase())
|
||||||
{
|
{
|
||||||
if (wtx.GetDepthInMainChain() < 1)
|
if (wtx.GetDepthInMainChain() < 1)
|
||||||
|
Loading…
Reference in New Issue
Block a user