GetTransaction should only use TxIndex if -txindex is set #15293

issue promag opened this issue on January 30, 2019
  1. promag commented at 3:22 PM on January 30, 2019: member

    Does it make sense to change the order and avoid locking cs_main or mempool.cs?

    Something like:

    bool GetTransaction(const uint256& hash, CTransactionRef& txOut, const Consensus::Params& consensusParams, uint256& hashBlock, const CBlockIndex* const block_index)
    {
        if (g_txindex) {
            return g_txindex->FindTx(hash, hashBlock, txOut);
        }
    
        LOCK(cs_main);
    
        ...
    

    I believe it would require to add some read-write mutex to TxIndex.

  2. MarcoFalke added the label Brainstorming on Jan 30, 2019
  3. MarcoFalke added the label Refactoring on Jan 30, 2019
  4. MarcoFalke added the label RPC/REST/ZMQ on Jan 30, 2019
  5. MarcoFalke commented at 10:29 AM on September 17, 2021: member

    @promag Is this still an issue?

  6. promag commented at 10:31 AM on September 17, 2021: member

    Done in #22383, thanks.

  7. promag closed this on Sep 17, 2021

  8. DrahtBot locked this on Oct 30, 2022

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-13 15:15 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me