refactor/doc: Add blockman param to `GetTransaction` doc comment and reorder out param
What changed, and why it matters
This commit is a pure code cleanup: it reorders the arguments of an internal helper function called GetTransaction so that an input parameter (blockman) comes before an output parameter (hashBlock), and updates the documentation comment to mention blockman. All callers are updated to match the new order. There is no change to what the function does or to any security-sensitive behavior.
No security action needed; this is a routine refactor.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The change is a refactor/doc update only. It moves the const BlockManager& blockman parameter before the uint256& hashBlock out parameter in GetTransaction’s signature and updates all call sites (rest.cpp, rpc/rawtransaction.cpp, rpc/txoutproof.cpp) accordingly. It also adds a @param[in] blockman Doxygen line. No logic, access control, validation, or resource handling changes are present.
Changed components
src/node/transaction.cppsrc/node/transaction.hsrc/rest.cppsrc/rpc/rawtransaction.cppsrc/rpc/txoutproof.cppInspect captured patch +6 / −5
diff --git a/src/node/transaction.cpp b/src/node/transaction.cpp
index 7bb92872..99e502fb 100644
--- a/src/node/transaction.cpp
+++ b/src/node/transaction.cpp
@@ -123,7 +123,7 @@ TransactionError BroadcastTransaction(NodeContext& node, const CTransactionRef t
return TransactionError::OK;
}
-CTransactionRef GetTransaction(const CBlockIndex* const block_index, const CTxMemPool* const mempool, const Txid& hash, uint256& hashBlock, const BlockManager& blockman)
+CTransactionRef GetTransaction(const CBlockIndex* const block_index, const CTxMemPool* const mempool, const Txid& hash, const BlockManager& blockman, uint256& hashBlock)
{
if (mempool && !block_index) {
CTransactionRef ptx = mempool->get(hash);
diff --git a/src/node/transaction.h b/src/node/transaction.h
index 2a411581..77f599a3 100644
--- a/src/node/transaction.h
+++ b/src/node/transaction.h
@@ -60,10 +60,11 @@ static const CAmount DEFAULT_MAX_BURN_AMOUNT{0};
* @param[in] block_index The block to read from disk, or nullptr
* @param[in] mempool If provided, check mempool for tx
* @param[in] hash The txid
+ * @param[in] blockman Used to access and read blocks from disk
* @param[out] hashBlock The block hash, if the tx was found via -txindex or block_index
* @returns The tx if found, otherwise nullptr
*/
-CTransactionRef GetTransaction(const CBlockIndex* const block_index, const CTxMemPool* const mempool, const Txid& hash, uint256& hashBlock, const BlockManager& blockman);
+CTransactionRef GetTransaction(const CBlockIndex* const block_index, const CTxMemPool* const mempool, const Txid& hash, const BlockManager& blockman, uint256& hashBlock);
} // namespace node
#endif // BITCOIN_NODE_TRANSACTION_H
diff --git a/src/rest.cpp b/src/rest.cpp
index 7750bdc8..eb4e52f1 100644
--- a/src/rest.cpp
+++ b/src/rest.cpp
@@ -829,7 +829,7 @@ static bool rest_tx(const std::any& context, HTTPRequest* req, const std::string
const NodeContext* const node = GetNodeContext(context, req);
if (!node) return false;
uint256 hashBlock = uint256();
- const CTransactionRef tx{GetTransaction(/*block_index=*/nullptr, node->mempool.get(), *hash, hashBlock, node->chainman->m_blockman)};
+ const CTransactionRef tx{GetTransaction(/*block_index=*/nullptr, node->mempool.get(), *hash, node->chainman->m_blockman, hashBlock)};
if (!tx) {
return RESTERR(req, HTTP_NOT_FOUND, hashStr + " not found");
}
diff --git a/src/rpc/rawtransaction.cpp b/src/rpc/rawtransaction.cpp
index 1a8edc59..5e03a4d5 100644
--- a/src/rpc/rawtransaction.cpp
+++ b/src/rpc/rawtransaction.cpp
@@ -351,7 +351,7 @@ static RPCHelpMan getrawtransaction()
}
uint256 hash_block;
- const CTransactionRef tx = GetTransaction(blockindex, node.mempool.get(), txid, hash_block, chainman.m_blockman);
+ const CTransactionRef tx = GetTransaction(blockindex, node.mempool.get(), txid, chainman.m_blockman, hash_block);
if (!tx) {
std::string errmsg;
if (blockindex) {
diff --git a/src/rpc/txoutproof.cpp b/src/rpc/txoutproof.cpp
index 2d98053d..24cb8599 100644
--- a/src/rpc/txoutproof.cpp
+++ b/src/rpc/txoutproof.cpp
@@ -86,7 +86,7 @@ static RPCHelpMan gettxoutproof()
}
if (pblockindex == nullptr) {
- const CTransactionRef tx = GetTransaction(/*block_index=*/nullptr, /*mempool=*/nullptr, *setTxids.begin(), hashBlock, chainman.m_blockman);
+ const CTransactionRef tx = GetTransaction(/*block_index=*/nullptr, /*mempool=*/nullptr, *setTxids.begin(), chainman.m_blockman, hashBlock);
if (!tx || hashBlock.IsNull()) {
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Transaction not yet in block");
}
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.