diff options
author | MarcoFalke <falke.marco@gmail.com> | 2020-07-26 09:59:11 +0200 |
---|---|---|
committer | MarcoFalke <falke.marco@gmail.com> | 2020-07-26 16:44:07 +0200 |
commit | fa5979d12f8c65754e36cdddb9d032ab81fecc3a (patch) | |
tree | a54fffd712e30582f707323f269da5204cc304ff /src/validation.h | |
parent | fa1f7f28cbc48675514a01c4ca773f1ba8ea836b (diff) |
rpc: Avoid useless mempool query in gettxoutproof
Diffstat (limited to 'src/validation.h')
-rw-r--r-- | src/validation.h | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/validation.h b/src/validation.h index acadf151c5..2dd83a5c86 100644 --- a/src/validation.h +++ b/src/validation.h @@ -164,8 +164,19 @@ bool LoadGenesisBlock(const CChainParams& chainparams); void UnloadBlockIndex(); /** Run an instance of the script checking thread */ void ThreadScriptCheck(int worker_num); -/** Retrieve a transaction (from memory pool, or from disk, if possible) */ -bool GetTransaction(const uint256& hash, CTransactionRef& tx, const Consensus::Params& params, uint256& hashBlock, const CBlockIndex* const blockIndex = nullptr); +/** + * Return transaction from the block at block_index. + * If block_index is not provided, fall back to mempool. + * If mempool is not provided or the tx couldn't be found in mempool, fall back to g_txindex. + * + * @param[in] block_index The block to read from disk, or nullptr + * @param[in] mempool If block_index is not provided, look in the mempool, if provided + * @param[in] hash The txid + * @param[in] consensusParams The params + * @param[out] hashBlock The hash of block_index, if the tx was found via block_index + * @returns The tx if found, otherwise nullptr + */ +CTransactionRef GetTransaction(const CBlockIndex* const block_index, const CTxMemPool* const mempool, const uint256& hash, const Consensus::Params& consensusParams, uint256& hashBlock); /** * Find the best known block, and make it the tip of the block chain * |