本文整理汇总了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_
});
///////////////////////////////////////////////////////////////////////////
}
示例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_
});
///////////////////////////////////////////////////////////////////////////
}