Add "chainlock" field to more rpcs (#2743)

This commit is contained in:
UdjinM6 2019-03-06 10:00:47 +03:00 committed by Alexander Block
parent 8dd9349224
commit b5466e20a9
2 changed files with 8 additions and 0 deletions

View File

@ -267,6 +267,7 @@ UniValue getrawtransaction(const JSONRPCRequest& request)
" \"time\" : ttt, (numeric) The transaction time in seconds since epoch (Jan 1 1970 GMT)\n"
" \"blocktime\" : ttt (numeric) The block time in seconds since epoch (Jan 1 1970 GMT)\n"
" \"instantlock\" : true|false, (bool) Current transaction lock state\n"
" \"chainlock\" : true|false, (bool) The state of the corresponding block chainlock\n"
"}\n"
"\nExamples:\n"

View File

@ -22,6 +22,8 @@
#include "keepass.h"
#include "privatesend-client.h"
#include "llmq/quorums_chainlocks.h"
#include <stdint.h>
#include <boost/assign/list_of.hpp>
@ -62,8 +64,10 @@ void WalletTxToJSON(const CWalletTx& wtx, UniValue& entry)
{
int confirms = wtx.GetDepthInMainChain();
bool fLocked = instantsend.IsLockedInstantSendTransaction(wtx.GetHash());
bool chainlock = llmq::chainLocksHandler->HasChainLock(wtx.nIndex, wtx.hashBlock);
entry.push_back(Pair("confirmations", confirms));
entry.push_back(Pair("instantlock", fLocked));
entry.push_back(Pair("chainlock", chainlock));
if (wtx.IsCoinBase())
entry.push_back(Pair("generated", true));
if (confirms > 0)
@ -1552,6 +1556,7 @@ UniValue listtransactions(const JSONRPCRequest& request)
" \"fee\": x.xxx, (numeric) The amount of the fee in " + CURRENCY_UNIT + ". This is negative and only available for the \n"
" 'send' category of transactions.\n"
" \"instantlock\" : true|false, (bool) Current transaction lock state. Available for 'send' and 'receive' category of transactions.\n"
" \"chainlock\" : true|false, (bool) The state of the corresponding block chainlock\n"
" \"confirmations\": n, (numeric) The number of blockchain confirmations for the transaction. Available for 'send' and \n"
" 'receive' category of transactions. Negative confirmations indicate the\n"
" transation conflicts with the block chain\n"
@ -1756,6 +1761,7 @@ UniValue listsinceblock(const JSONRPCRequest& request)
" \"vout\" : n, (numeric) the vout value\n"
" \"fee\": x.xxx, (numeric) The amount of the fee in " + CURRENCY_UNIT + ". This is negative and only available for the 'send' category of transactions.\n"
" \"instantlock\" : true|false, (bool) Current transaction lock state. Available for 'send' and 'receive' category of transactions.\n"
" \"chainlock\" : true|false, (bool) The state of the corresponding block chainlock\n"
" \"confirmations\" : n, (numeric) The number of blockchain confirmations for the transaction. Available for 'send' and 'receive' category of transactions.\n"
" When it's < 0, it means the transaction conflicted that many blocks ago.\n"
" \"blockhash\": \"hashvalue\", (string) The block hash containing the transaction. Available for 'send' and 'receive' category of transactions.\n"
@ -1858,6 +1864,7 @@ UniValue gettransaction(const JSONRPCRequest& request)
" \"fee\": x.xxx, (numeric) The amount of the fee in " + CURRENCY_UNIT + ". This is negative and only available for the \n"
" 'send' category of transactions.\n"
" \"instantlock\" : true|false, (bool) Current transaction lock state\n"
" \"chainlock\" : true|false, (bool) The state of the corresponding block chainlock\n"
" \"confirmations\" : n, (numeric) The number of blockchain confirmations\n"
" \"blockhash\" : \"hash\", (string) The block hash\n"
" \"blockindex\" : xx, (numeric) The index of the transaction in the block that includes it\n"