rpc: Avoid useless mempool query in gettxoutproof

This commit is contained in:
MarcoFalke
2020-07-26 09:59:11 +02:00
parent fa1f7f28cb
commit fa5979d12f
4 changed files with 62 additions and 38 deletions

View File

@@ -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
*