diff options
author | Gavin Andresen <gavinandresen@gmail.com> | 2014-02-14 14:40:32 -0500 |
---|---|---|
committer | Gavin Andresen <gavinandresen@gmail.com> | 2014-02-14 14:40:32 -0500 |
commit | 05d3ded072d782036c31c1d773c0441b87de843e (patch) | |
tree | 1dcdec2f37f61415aa5d1b71da101e0cfbd035fd /src/rpcwallet.cpp | |
parent | e051e65c219cc72a2bba768f3d5e043ad055b48e (diff) | |
parent | 9a3d936fc2e98b1e8234bf27e09cf7bc22811bee (diff) |
Merge pull request #3669 from gavinandresen/dead_txns
Handle "conflicted" transactions properly
Diffstat (limited to 'src/rpcwallet.cpp')
-rw-r--r-- | src/rpcwallet.cpp | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/rpcwallet.cpp b/src/rpcwallet.cpp index bcbae06682..2b49762d4a 100644 --- a/src/rpcwallet.cpp +++ b/src/rpcwallet.cpp @@ -45,7 +45,7 @@ void WalletTxToJSON(const CWalletTx& wtx, Object& entry) entry.push_back(Pair("confirmations", confirms)); if (wtx.IsCoinBase()) entry.push_back(Pair("generated", true)); - if (confirms) + if (confirms > 0) { entry.push_back(Pair("blockhash", wtx.hashBlock.GetHex())); entry.push_back(Pair("blockindex", wtx.nIndex)); @@ -1109,7 +1109,10 @@ void ListTransactions(const CWalletTx& wtx, const string& strAccount, int nMinDe Object entry; entry.push_back(Pair("account", strSentAccount)); MaybePushAddress(entry, s.first); - entry.push_back(Pair("category", "send")); + if (wtx.GetDepthInMainChain() < 0) + entry.push_back(Pair("category", "conflicted")); + else + entry.push_back(Pair("category", "send")); entry.push_back(Pair("amount", ValueFromAmount(-s.second))); entry.push_back(Pair("fee", ValueFromAmount(-nFee))); if (fLong) @@ -1141,7 +1144,12 @@ void ListTransactions(const CWalletTx& wtx, const string& strAccount, int nMinDe entry.push_back(Pair("category", "generate")); } else - entry.push_back(Pair("category", "receive")); + { + if (wtx.GetDepthInMainChain() < 0) + entry.push_back(Pair("category", "conflicted")); + else + entry.push_back(Pair("category", "receive")); + } entry.push_back(Pair("amount", ValueFromAmount(r.second))); if (fLong) WalletTxToJSON(wtx, entry); |