本文整理汇总了C++中reader::read_hash方法的典型用法代码示例。如果您正苦于以下问题:C++ reader::read_hash方法的具体用法?C++ reader::read_hash怎么用?C++ reader::read_hash使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类reader
的用法示例。
在下文中一共展示了reader::read_hash方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: from_data
// Optimize reads by short-circuiting what is unnecessary.
// Invalid returns are conflated with skipped, but are store only.
bool stealth_record::from_data(reader& source, size_t start_height,
const binary& filter)
{
height_ = source.read_4_bytes_little_endian();
if (height_ < start_height)
{
reset();
source.skip(serialized_size(false) - sizeof(uint32_t));
return false;
}
prefix_ = source.read_4_bytes_little_endian();
if (!filter.is_prefix_of(prefix_))
{
reset();
source.skip(serialized_size(false) - 2 * sizeof(uint32_t));
return false;
}
unsigned_ephemeral_ = source.read_hash();
public_key_hash_ = source.read_short_hash();
transaction_hash_ = source.read_hash();
if (!source)
reset();
return source;
}
示例2: from_data
bool block_transactions::from_data(uint32_t version, reader& source)
{
reset();
block_hash_ = source.read_hash();
const auto count = source.read_size_little_endian();
// Guard against potential for arbitrary memory allocation.
if (count > max_block_size)
source.invalidate();
else
transactions_.resize(count);
// Order is required.
for (auto& tx: transactions_)
if (!tx.from_data(source, true))
break;
if (version < block_transactions::version_minimum)
source.invalidate();
if (!source)
reset();
return source;
}
示例3: from_data
bool point::from_data(reader& source, bool wire)
{
reset();
valid_ = true;
hash_ = source.read_hash();
if (wire)
{
index_ = source.read_4_bytes_little_endian();
}
else
{
index_ = source.read_2_bytes_little_endian();
// Convert 16 bit sentinel to 32 bit sentinel.
if (index_ == max_uint16)
index_ = null_index;
}
if (!source)
reset();
return source;
}
示例4: from_data
bool merkle_block::from_data(reader& source)
{
reset();
bool result = header.from_data(source, true);
uint64_t hash_count = 0;
if (result)
{
hash_count = source.read_variable_uint_little_endian();
result = source;
}
for (uint64_t i = 0; (i < hash_count) && result; ++i)
{
hashes.push_back(source.read_hash());
result = source;
}
if (result)
{
auto size = source.read_variable_uint_little_endian();
BITCOIN_ASSERT(size <= bc::max_size_t);
const auto flag_count = static_cast<size_t>(size);
flags = source.read_data(flag_count);
result = source && (flags.size() == flag_count);
}
if (!result)
reset();
return result;
}
示例5: from_data
// Avoid point reuse due to affect on store tx serialization.
bool payment_record::from_data(reader& source, bool wire)
{
valid_ = true;
output_ = (source.read_byte() == 1);
if (wire)
{
height_ = source.read_4_bytes_little_endian();
link_ = unlinked;
hash_ = source.read_hash();
index_ = source.read_4_bytes_little_endian();
}
else
{
height_ = 0;
link_ = source.read_8_bytes_little_endian();
hash_ = null_hash;
index_ = source.read_2_bytes_little_endian();
// Convert 16 bit sentinel to 32 bit sentinel.
if (index_ == max_uint16)
index_ = point::null_index;
}
data_ = source.read_8_bytes_little_endian();
if (!source)
reset();
return source;
}
示例6: from_data
bool point::from_data(reader& source)
{
auto result = true;
reset();
hash = source.read_hash();
index = source.read_4_bytes_little_endian();
result = source;
if (!result)
reset();
return result;
}
示例7: from_data
bool reject::from_data(reader& source)
{
bool result = 0;
reset();
message = source.read_string();
code = error_code_from_byte(source.read_byte());
reason = source.read_string();
if ((message == chain::block::command) ||
(message == chain::transaction::command))
{
data = source.read_hash();
}
result = source;
if (!result)
reset();
return result;
}