src/MicroCore.cpp
/**
     * Returns tx hash in a given block which
     * contains given output's public key
     */
Returns tx hash in a given block which
contains given output's public key
Returns tx hash in a given block which contains given output ' s public key
bool
    MicroCore::get_tx_hash_from_output_pubkey(const public_key& output_pubkey,
                                              const uint64_t& block_height,
                                              crypto::hash& tx_hash,
                                              cryptonote::transaction& tx_found)
    {
        tx_hash = null_hash;
        block blk;
        if (!get_block_by_height(block_height, blk))
        {
            cerr << "Cant get block of height: " << block_height << endl;
            return false;
        }
        list<transaction> txs {blk.miner_tx};
        list<crypto::hash> missed_txs;
        if (!m_blockchain_storage.get_transactions(blk.tx_hashes, txs, missed_txs))
        {
            cerr << "Cant find transcations in block: " << block_height << endl;
            return false;
        }
        if (!missed_txs.empty())
        {
            cerr << "Transactions not found in blk: " << block_height << endl;
            for (const crypto::hash& h : missed_txs)
            {
                cerr << " - tx hash: " << h << endl;
            }
            return false;
        }
        for (const transaction& tx : txs)
        {
            tx_out found_out;
            size_t output_index;
            if (find_output_in_tx(tx, output_pubkey, found_out, output_index))
            {
                tx_hash = get_transaction_hash(tx);
                tx_found = tx;
                return true;
            }
        }
        return false;
    }
bool MicroCore :: get_tx_hash_from_output_pubkey ( const public_key & output_pubkey , const uint64_t & block_height , crypto :: hash & tx_hash , cryptonote :: transaction & tx_found ) { tx_hash = null_hash ; block blk ; if ( ! get_block_by_height ( block_height , blk ) ) { cerr << " " << block_height << endl ; return false ; } list < transaction > txs { blk . miner_tx } ; list < crypto :: hash > missed_txs ; if ( ! m_blockchain_storage . get_transactions ( blk . tx_hashes , txs , missed_txs ) ) { cerr << " " << block_height << endl ; return false ; } if ( ! missed_txs . empty ( ) ) { cerr << " " << block_height << endl ; for ( const crypto :: hash & h : missed_txs ) { cerr << " " << h << endl ; } return false ; } for ( const transaction & tx : txs ) { tx_out found_out ; size_t output_index ; if ( find_output_in_tx ( tx , output_pubkey , found_out , output_index ) ) { tx_hash = get_transaction_hash ( tx ) ; tx_found = tx ; return true ; } } return false ; }
Returns tx hash in a given block which
 contains given output's public key
Returns tx hash in a given block which contains given output ' s public key
// get block of given height // get all transactions in the block found // initialize the first list with transaction for solving // the block i.e. coinbase. // search outputs in each transactions // until output with pubkey of interest is found // we dont need here output_index // we found the desired public key