Report instantlock: true for transactions locked via ChainLocks (#2877)

* Report `instantlock: true` for transactions locked via ChainLocks

Also introduce `instantlock_internal` to show the actual lock state.

* Always show instantlock_internal
This commit is contained in:
UdjinM6 2019-04-25 18:38:26 +03:00 committed by GitHub
parent 5cfceab860
commit 19a9e2f4cc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 3 deletions

View File

@ -25,4 +25,4 @@ When a wallet InstantSend transaction is successfully locked a shell command pro
#### RPC
Details pertaining to an observed "Transaction Lock" can also be retrieved through RPC. There is a boolean field named `instantlock` which indicates whether a given transaction is locked via InstantSend. This field is present in the output of some wallet RPC commands e.g. `listsinceblock`, `gettransaction` etc. as well as in the output of some mempool RPC commands e.g. `getmempoolentry` and a couple of others like `getrawmempool` (for `verbose=true` only).
Details pertaining to an observed "Transaction Lock" can also be retrieved through RPC. There is a boolean field named `instantlock` which indicates whether a given transaction is locked via InstantSend. This field is present in the output of some wallet RPC commands e.g. `listsinceblock`, `gettransaction` etc. as well as in the output of some mempool RPC commands e.g. `getmempoolentry` and a couple of others like `getrawmempool` (for `verbose=true` only). For blockchain based RPC commands `instantlock` will also say `true` if this transaction was locked via LLMQ based ChainLocks (for backwards compatibility reasons).

View File

@ -201,7 +201,8 @@ void TxToJSON(const CTransaction& tx, const uint256 hashBlock, UniValue& entry)
}
bool fLocked = instantsend.IsLockedInstantSendTransaction(txid);
bool fLLMQLocked = llmq::quorumInstantSendManager->IsLocked(txid);
entry.push_back(Pair("instantlock", fLocked || fLLMQLocked));
entry.push_back(Pair("instantlock", fLocked || fLLMQLocked || chainLock));
entry.push_back(Pair("instantlock_internal", fLocked || fLLMQLocked));
entry.push_back(Pair("chainlock", chainLock));
}
@ -269,6 +270,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"
" \"instantlock_internal\" : true|false, (bool) Current internal transaction lock state\n"
" \"chainlock\" : true|false, (bool) The state of the corresponding block chainlock\n"
"}\n"

View File

@ -72,7 +72,8 @@ void WalletTxToJSON(const CWalletTx& wtx, UniValue& entry)
chainlock = llmq::chainLocksHandler->HasChainLock(mapBlockIndex[wtx.hashBlock]->nHeight, wtx.hashBlock);
}
entry.push_back(Pair("confirmations", confirms));
entry.push_back(Pair("instantlock", fLocked || fLLMQLocked));
entry.push_back(Pair("instantlock", fLocked || fLLMQLocked || chainlock));
entry.push_back(Pair("instantlock_internal", fLocked || fLLMQLocked));
entry.push_back(Pair("chainlock", chainlock));
if (wtx.IsCoinBase())
entry.push_back(Pair("generated", true));
@ -1575,6 +1576,7 @@ UniValue listtransactions(const JSONRPCRequest& request)
" 'receive' category of transactions. Negative confirmations indicate the\n"
" transation conflicts with the block chain\n"
" \"instantlock\" : true|false, (bool) Current transaction lock state. Available for 'send' and 'receive' category of transactions.\n"
" \"instantlock_internal\" : true|false, (bool) Current internal transaction lock state. Available for 'send' and 'receive' category of transactions.\n"
" \"chainlock\" : true|false, (bool) The state of the corresponding block chainlock\n"
" \"trusted\": xxx, (bool) Whether we consider the outputs of this unconfirmed transaction safe to spend.\n"
" \"blockhash\": \"hashvalue\", (string) The block hash containing the transaction. Available for 'send' and 'receive'\n"
@ -1779,6 +1781,7 @@ UniValue listsinceblock(const JSONRPCRequest& request)
" \"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"
" \"instantlock\" : true|false, (bool) Current transaction lock state. Available for 'send' and 'receive' category of transactions.\n"
" \"instantlock_internal\" : true|false, (bool) Current internal transaction lock state. Available for 'send' and 'receive' category of transactions.\n"
" \"chainlock\" : true|false, (bool) The state of the corresponding block chainlock\n"
" \"blockhash\": \"hashvalue\", (string) The block hash containing the transaction. Available for 'send' and 'receive' category of transactions.\n"
" \"blockindex\": n, (numeric) The index of the transaction in the block that includes it. Available for 'send' and 'receive' category of transactions.\n"
@ -1880,6 +1883,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"
" \"instantlock_internal\" : true|false, (bool) Current internal 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"