mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-01-20 15:19:07 +01:00
refactor/doc: Add blockman param to GetTransaction doc comment and reorder out param
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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");
|
||||
}
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user