Fixed IX confirmation bug for gettransaction

IX confirmations now show up correctly via the RPC interface immediately after IX confirms they are double-spend proof:

gettransaction 64c04e06ac058e572cefb5d98728dba21401cb8826f9688cbaf4270adfc6afb2

{
    "amount" : 0.00000000,
    "fee" : -0.01000000,
    "confirmations" : 5,
    "bcconfirmations" : 0,
    "txid" : "64c04e06ac058e572cefb5d98728dba21401cb8826f9688cbaf4270adfc6afb2",
    "walletconflicts" : [
}

... a moment later ...

gettransaction 64c04e06ac058e572cefb5d98728dba21401cb8826f9688cbaf4270adfc6afb2

{
    "amount" : 0.00000000,
    "fee" : -0.01000000,
    "confirmations" : 6,
    "bcconfirmations" : 1,
    "blockhash" : "00000000000f850e60431a5a88fba1cd8d3868477056f65493664e2d39c1837c",
    "blockindex" : 2,
    "blocktime" : 1443290068,
    "txid" : "64c04e06ac058e572cefb5d98728dba21401cb8826f9688cbaf4270adfc6afb2",
    "walletconflicts" : [
    ],
}
This commit is contained in:
Evan Duffield 2015-09-26 10:55:46 -07:00 committed by Holger Schinzel
parent f173a8634f
commit ac3a0123b7

View File

@ -48,7 +48,7 @@ void EnsureWalletIsUnlocked()
void WalletTxToJSON(const CWalletTx& wtx, Object& entry) void WalletTxToJSON(const CWalletTx& wtx, Object& entry)
{ {
int confirms = wtx.GetDepthInMainChain(false); int confirms = wtx.GetDepthInMainChain(false);
int confirmsTotal = wtx.GetDepthInMainChain(); int confirmsTotal = GetIXConfirmations(wtx.GetHash()) + confirms;
entry.push_back(Pair("confirmations", confirmsTotal)); entry.push_back(Pair("confirmations", confirmsTotal));
entry.push_back(Pair("bcconfirmations", confirms)); entry.push_back(Pair("bcconfirmations", confirms));
if (wtx.IsCoinBase()) if (wtx.IsCoinBase())