diff --git a/doc/release-notes-5774.md b/doc/release-notes-5774.md new file mode 100644 index 0000000000..4ceafc25ff --- /dev/null +++ b/doc/release-notes-5774.md @@ -0,0 +1,4 @@ +RPC changes +----------- + +In `getspecialtxes` `instantlock` and `chainlock` fields were always `false`. They should show actual values now. diff --git a/src/rpc/blockchain.cpp b/src/rpc/blockchain.cpp index 0f3c3a2caa..2d6281c31b 100644 --- a/src/rpc/blockchain.cpp +++ b/src/rpc/blockchain.cpp @@ -2462,7 +2462,7 @@ static UniValue getspecialtxes(const JSONRPCRequest& request) CTxMemPool& mempool = EnsureMemPool(node); LLMQContext& llmq_ctx = EnsureLLMQContext(node); - uint256 hash(ParseHashV(request.params[0], "blockhash")); + uint256 blockhash(ParseHashV(request.params[0], "blockhash")); int nTxType = -1; if (!request.params[1].isNull()) { @@ -2491,7 +2491,7 @@ static UniValue getspecialtxes(const JSONRPCRequest& request) } } - const CBlockIndex* pblockindex = chainman.m_blockman.LookupBlockIndex(hash); + const CBlockIndex* pblockindex = chainman.m_blockman.LookupBlockIndex(blockhash); if (!pblockindex) { throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Block not found"); } @@ -2519,7 +2519,7 @@ static UniValue getspecialtxes(const JSONRPCRequest& request) case 2 : { UniValue objTx(UniValue::VOBJ); - TxToJSON(*tx, uint256(), mempool, chainman.ActiveChainstate(), *llmq_ctx.clhandler, *llmq_ctx.isman, objTx); + TxToJSON(*tx, blockhash, mempool, chainman.ActiveChainstate(), *llmq_ctx.clhandler, *llmq_ctx.isman, objTx); result.push_back(objTx); break; } diff --git a/test/functional/feature_llmq_chainlocks.py b/test/functional/feature_llmq_chainlocks.py index 93959bc154..f4981a61d0 100755 --- a/test/functional/feature_llmq_chainlocks.py +++ b/test/functional/feature_llmq_chainlocks.py @@ -40,8 +40,13 @@ class LLMQChainLocksTest(DashTestFramework): self.test_coinbase_best_cl(self.nodes[0], expected_cl_in_cb=False) # v20 is active, no quorums, no CLs - null CL in CbTx - self.nodes[0].generate(1) + nocl_block_hash = self.nodes[0].generate(1)[0] self.test_coinbase_best_cl(self.nodes[0], expected_cl_in_cb=True, expected_null_cl=True) + cbtx = self.nodes[0].getspecialtxes(nocl_block_hash, 5, 1, 0, 2)[0] + assert_equal(cbtx["instantlock"], False) + assert_equal(cbtx["instantlock_internal"], False) + assert_equal(cbtx["chainlock"], False) + self.nodes[0].sporkupdate("SPORK_17_QUORUM_DKG_ENABLED", 0) self.wait_for_sporks_same() @@ -55,6 +60,12 @@ class LLMQChainLocksTest(DashTestFramework): self.wait_for_chainlocked_block_all_nodes(self.nodes[0].getbestblockhash()) self.test_coinbase_best_cl(self.nodes[0]) + # ChainLock locks all the blocks below it so nocl_block_hash should be locked too + cbtx = self.nodes[0].getspecialtxes(nocl_block_hash, 5, 1, 0, 2)[0] + assert_equal(cbtx["instantlock"], True) + assert_equal(cbtx["instantlock_internal"], False) + assert_equal(cbtx["chainlock"], True) + self.log.info("Mine many blocks, wait for chainlock") self.nodes[0].generate(20) # We need more time here due to 20 blocks being generated at once