bool leveldb_validate_block::transaction_exists(const hash_digest& tx_hash)
{
    leveldb_tx_info tx;
    if (!common_->get_transaction(tx, tx_hash, true, false))
        return false;
    return !tx_after_fork(tx, fork_index_);
}
bool validate_block_impl::fetch_transaction(chain::transaction& tx,
    size_t& tx_height, const hash_digest& tx_hash) const
{
    uint64_t out_height;
    const auto result = chain_.get_transaction(tx, out_height, tx_hash);

    BITCOIN_ASSERT(out_height <= max_size_t);
    tx_height = static_cast<size_t>(out_height);

    if (!result || tx_after_fork(tx_height, fork_index_))
        return fetch_orphan_transaction(tx, tx_height, tx_hash);

    return true;
}
bool leveldb_validate_block::fetch_transaction(transaction_type& tx,
    size_t& tx_height, const hash_digest& tx_hash)
{
    leveldb_tx_info tx_info;
    bool tx_exists = common_->get_transaction(tx_info, tx_hash, true, true);
    if (!tx_exists || tx_after_fork(tx_info, fork_index_))
    {
        if (!fetch_orphan_transaction(tx, tx_height, tx_hash))
            return false;
        return true;
    }
    tx = tx_info.tx;
    tx_height = tx_info.height;
    return true;
}