Skip to content

Commit

Permalink
Fixed IX confirmation bug for gettransaction
Browse files Browse the repository at this point in the history
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" : [
    ],
}
  • Loading branch information
Evan Duffield committed Sep 26, 2015
1 parent bda45f1 commit 71272d4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/rpcwallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ void EnsureWalletIsUnlocked()
void WalletTxToJSON(const CWalletTx& wtx, Object& entry)
{
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("bcconfirmations", confirms));
if (wtx.IsCoinBase())
Expand Down

2 comments on commit 71272d4

@UdjinM6
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can't find the issue with previous implementation... what was it?

@eduffield222
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Try sending yourself an IX with the old implementation, then run gettransaction on that hash. I was getting a segfault, I looked at it for a couple hours and couldn't find the cause, although it's reproducible.

Please sign in to comment.