当前位置: 首页>>代码示例>>C++>>正文


C++ transaction::outputs方法代码示例

本文整理汇总了C++中transaction::outputs方法的典型用法代码示例。如果您正苦于以下问题:C++ transaction::outputs方法的具体用法?C++ transaction::outputs怎么用?C++ transaction::outputs使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在transaction的用法示例。


在下文中一共展示了transaction::outputs方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: add

void unspent_outputs::add(const transaction& tx, size_t height,
    uint32_t median_time_past, bool confirmed)
{
    if (disabled() || tx.outputs().empty())
        return;

    if (tx.is_coinbase())
    {
        LOG_DEBUG(LOG_DATABASE)
            << "Output cache hit rate: " << hit_rate() << ", size: " << size();
    }

    // Critical Section
    ///////////////////////////////////////////////////////////////////////////
    unique_lock lock(mutex_);

    // It's been a long time since the last restart (~16 years).
    if (sequence_ == max_uint32)
        unspent_.clear();

    // Remove the oldest entry if the buffer is at capacity.
    if (unspent_.size() >= capacity_)
        unspent_.right.erase(unspent_.right.begin());

    // TODO: promote the unconfirmed tx cache instead of replacing it.
    // A confirmed tx may replace the same unconfirmed tx here.
    unspent_.insert(
    {
        unspent_transaction{ tx, height, median_time_past, confirmed },
        ++sequence_
    });
    ///////////////////////////////////////////////////////////////////////////
}
开发者ID:RojavaCrypto,项目名称:libbitcoin-database,代码行数:33,代码来源:unspent_outputs.cpp

示例2: add

void unspent_outputs::add(const transaction& transaction, size_t height)
{
    if (capacity_ == 0 || transaction.outputs().empty())
        return;

    // Critical Section
    ///////////////////////////////////////////////////////////////////////////
    unique_lock lock(mutex_);

    // It's been a long time since the last restart (~16 years).
    if (sequence_ == max_uint32)
        unspent_.clear();

    // Remove the oldest entry if the buffer is at capacity.
    if (unspent_.size() >= capacity_)
        unspent_.right.erase(unspent_.right.begin());

    unspent_.insert(
    {
        unspent_transaction{ transaction, height },
        ++sequence_
    });
    ///////////////////////////////////////////////////////////////////////////
}
开发者ID:evoskuil,项目名称:libbitcoin-database,代码行数:24,代码来源:unspent_outputs.cpp


注:本文中的transaction::outputs方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。