Add info about ChainLocks to block and transaction RPCs
This commit is contained in:
parent
135829dc49
commit
3413ff917b
@ -26,6 +26,8 @@
|
|||||||
#include "evo/specialtx.h"
|
#include "evo/specialtx.h"
|
||||||
#include "evo/cbtx.h"
|
#include "evo/cbtx.h"
|
||||||
|
|
||||||
|
#include "llmq/quorums_chainlocks.h"
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
#include <univalue.h>
|
#include <univalue.h>
|
||||||
@ -109,6 +111,9 @@ UniValue blockheaderToJSON(const CBlockIndex* blockindex)
|
|||||||
CBlockIndex *pnext = chainActive.Next(blockindex);
|
CBlockIndex *pnext = chainActive.Next(blockindex);
|
||||||
if (pnext)
|
if (pnext)
|
||||||
result.push_back(Pair("nextblockhash", pnext->GetBlockHash().GetHex()));
|
result.push_back(Pair("nextblockhash", pnext->GetBlockHash().GetHex()));
|
||||||
|
|
||||||
|
result.push_back(Pair("chainlock", llmq::chainLocksHandler->HasChainLock(blockindex->nHeight, blockindex->GetBlockHash())));
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -159,6 +164,9 @@ UniValue blockToJSON(const CBlock& block, const CBlockIndex* blockindex, bool tx
|
|||||||
CBlockIndex *pnext = chainActive.Next(blockindex);
|
CBlockIndex *pnext = chainActive.Next(blockindex);
|
||||||
if (pnext)
|
if (pnext)
|
||||||
result.push_back(Pair("nextblockhash", pnext->GetBlockHash().GetHex()));
|
result.push_back(Pair("nextblockhash", pnext->GetBlockHash().GetHex()));
|
||||||
|
|
||||||
|
result.push_back(Pair("chainlock", llmq::chainLocksHandler->HasChainLock(blockindex->nHeight, blockindex->GetBlockHash())));
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,6 +32,8 @@
|
|||||||
#include "evo/specialtx.h"
|
#include "evo/specialtx.h"
|
||||||
#include "evo/providertx.h"
|
#include "evo/providertx.h"
|
||||||
#include "evo/cbtx.h"
|
#include "evo/cbtx.h"
|
||||||
|
|
||||||
|
#include "llmq/quorums_chainlocks.h"
|
||||||
#include "llmq/quorums_commitment.h"
|
#include "llmq/quorums_commitment.h"
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
@ -176,6 +178,7 @@ void TxToJSON(const CTransaction& tx, const uint256 hashBlock, UniValue& entry)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool chainLock = false;
|
||||||
if (!hashBlock.IsNull()) {
|
if (!hashBlock.IsNull()) {
|
||||||
entry.push_back(Pair("blockhash", hashBlock.GetHex()));
|
entry.push_back(Pair("blockhash", hashBlock.GetHex()));
|
||||||
BlockMap::iterator mi = mapBlockIndex.find(hashBlock);
|
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("confirmations", 1 + chainActive.Height() - pindex->nHeight));
|
||||||
entry.push_back(Pair("time", pindex->GetBlockTime()));
|
entry.push_back(Pair("time", pindex->GetBlockTime()));
|
||||||
entry.push_back(Pair("blocktime", pindex->GetBlockTime()));
|
entry.push_back(Pair("blocktime", pindex->GetBlockTime()));
|
||||||
|
|
||||||
|
chainLock = llmq::chainLocksHandler->HasChainLock(pindex->nHeight, pindex->GetBlockHash());
|
||||||
} else {
|
} else {
|
||||||
entry.push_back(Pair("height", -1));
|
entry.push_back(Pair("height", -1));
|
||||||
entry.push_back(Pair("confirmations", 0));
|
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);
|
bool fLocked = instantsend.IsLockedInstantSendTransaction(txid);
|
||||||
entry.push_back(Pair("instantlock", fLocked));
|
entry.push_back(Pair("instantlock", fLocked));
|
||||||
|
entry.push_back(Pair("chainlock", chainLock));
|
||||||
}
|
}
|
||||||
|
|
||||||
UniValue getrawtransaction(const JSONRPCRequest& request)
|
UniValue getrawtransaction(const JSONRPCRequest& request)
|
||||||
|
Loading…
Reference in New Issue
Block a user