Add info about ChainLocks to block and transaction RPCs

This commit is contained in:
Alexander Block 2019-01-22 14:21:06 +01:00
parent 135829dc49
commit 3413ff917b
2 changed files with 14 additions and 0 deletions

View File

@ -26,6 +26,8 @@
#include "evo/specialtx.h"
#include "evo/cbtx.h"
#include "llmq/quorums_chainlocks.h"
#include <stdint.h>
#include <univalue.h>
@ -109,6 +111,9 @@ UniValue blockheaderToJSON(const CBlockIndex* blockindex)
CBlockIndex *pnext = chainActive.Next(blockindex);
if (pnext)
result.push_back(Pair("nextblockhash", pnext->GetBlockHash().GetHex()));
result.push_back(Pair("chainlock", llmq::chainLocksHandler->HasChainLock(blockindex->nHeight, blockindex->GetBlockHash())));
return result;
}
@ -159,6 +164,9 @@ UniValue blockToJSON(const CBlock& block, const CBlockIndex* blockindex, bool tx
CBlockIndex *pnext = chainActive.Next(blockindex);
if (pnext)
result.push_back(Pair("nextblockhash", pnext->GetBlockHash().GetHex()));
result.push_back(Pair("chainlock", llmq::chainLocksHandler->HasChainLock(blockindex->nHeight, blockindex->GetBlockHash())));
return result;
}

View File

@ -32,6 +32,8 @@
#include "evo/specialtx.h"
#include "evo/providertx.h"
#include "evo/cbtx.h"
#include "llmq/quorums_chainlocks.h"
#include "llmq/quorums_commitment.h"
#include <stdint.h>
@ -176,6 +178,7 @@ void TxToJSON(const CTransaction& tx, const uint256 hashBlock, UniValue& entry)
}
}
bool chainLock = false;
if (!hashBlock.IsNull()) {
entry.push_back(Pair("blockhash", hashBlock.GetHex()));
BlockMap::iterator mi = mapBlockIndex.find(hashBlock);
@ -186,6 +189,8 @@ void TxToJSON(const CTransaction& tx, const uint256 hashBlock, UniValue& entry)
entry.push_back(Pair("confirmations", 1 + chainActive.Height() - pindex->nHeight));
entry.push_back(Pair("time", pindex->GetBlockTime()));
entry.push_back(Pair("blocktime", pindex->GetBlockTime()));
chainLock = llmq::chainLocksHandler->HasChainLock(pindex->nHeight, pindex->GetBlockHash());
} else {
entry.push_back(Pair("height", -1));
entry.push_back(Pair("confirmations", 0));
@ -194,6 +199,7 @@ void TxToJSON(const CTransaction& tx, const uint256 hashBlock, UniValue& entry)
}
bool fLocked = instantsend.IsLockedInstantSendTransaction(txid);
entry.push_back(Pair("instantlock", fLocked));
entry.push_back(Pair("chainlock", chainLock));
}
UniValue getrawtransaction(const JSONRPCRequest& request)