mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-26 03:03:22 -03:00
Add block "confirmations" to getblock, mainly for identifying orphans
This commit is contained in:
parent
a2ea797593
commit
d4e09300f3
1 changed files with 3 additions and 0 deletions
|
@ -172,6 +172,9 @@ Object blockToJSON(const CBlock& block, const CBlockIndex* blockindex)
|
|||
{
|
||||
Object result;
|
||||
result.push_back(Pair("hash", block.GetHash().GetHex()));
|
||||
CMerkleTx txGen(block.vtx[0]);
|
||||
txGen.SetMerkleBranch(&block);
|
||||
result.push_back(Pair("confirmations", (int)txGen.GetDepthInMainChain()));
|
||||
result.push_back(Pair("size", (int)::GetSerializeSize(block, SER_NETWORK, PROTOCOL_VERSION)));
|
||||
result.push_back(Pair("height", blockindex->nHeight));
|
||||
result.push_back(Pair("version", block.nVersion));
|
||||
|
|
Loading…
Add table
Reference in a new issue