本文整理汇总了C++中reader::read_variable_uint_little_endian方法的典型用法代码示例。如果您正苦于以下问题:C++ reader::read_variable_uint_little_endian方法的具体用法?C++ reader::read_variable_uint_little_endian怎么用?C++ reader::read_variable_uint_little_endian使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类reader
的用法示例。
在下文中一共展示了reader::read_variable_uint_little_endian方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: from_data
bool alert::from_data(reader& source)
{
reset();
auto size = source.read_variable_uint_little_endian();
BITCOIN_ASSERT(size <= bc::max_size_t);
const auto payload_size = static_cast<size_t>(size);
size_t signature_size = 0;
auto result = static_cast<bool>(source);
if (result)
{
payload = source.read_data(payload_size);
result = source && (payload.size() == payload_size);
}
if (result)
{
size = source.read_variable_uint_little_endian();
BITCOIN_ASSERT(size <= bc::max_size_t);
signature_size = static_cast<size_t>(size);
result = source;
}
if (result)
{
signature = source.read_data(signature_size);
result = source && (signature.size() == signature_size);
}
if (!result)
reset();
return result;
}
示例2: from_data
bool alert_payload::from_data(reader& source)
{
reset();
version = source.read_4_bytes_little_endian();
relay_until = source.read_8_bytes_little_endian();
expiration = source.read_8_bytes_little_endian();
id = source.read_4_bytes_little_endian();
cancel = source.read_4_bytes_little_endian();
uint64_t set_cancel_size = source.read_variable_uint_little_endian();
for (uint64_t i = 0; i < set_cancel_size && source; i++)
set_cancel.push_back(source.read_4_bytes_little_endian());
min_version = source.read_4_bytes_little_endian();
max_version = source.read_4_bytes_little_endian();
uint64_t set_sub_version_size = source.read_variable_uint_little_endian();
for (uint64_t i = 0; i < set_sub_version_size && source; i++)
set_sub_version.push_back(source.read_string());
priority = source.read_4_bytes_little_endian();
comment = source.read_string();
status_bar = source.read_string();
reserved = source.read_string();
if (!source)
reset();
return source;
}
示例3: 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;
}
示例4: from_data
bool transaction::from_data(reader& source)
{
auto result = true;
reset();
version = source.read_4_bytes_little_endian();
result = source;
if (result)
{
uint64_t tx_in_count = source.read_variable_uint_little_endian();
result = source;
for (uint64_t i = 0; (i < tx_in_count) && result; ++i)
{
inputs.emplace_back();
result = inputs.back().from_data(source);
}
}
if (result)
{
auto tx_out_count = source.read_variable_uint_little_endian();
result = source;
for (uint64_t i = 0; (i < tx_out_count) && result; ++i)
{
outputs.emplace_back();
result = outputs.back().from_data(source);
}
}
if (result)
{
locktime = source.read_4_bytes_little_endian();
result = source;
}
if (!result)
reset();
return result;
}
示例5: from_data
bool headers::from_data(reader& source)
{
reset();
uint64_t count = source.read_variable_uint_little_endian();
auto result = static_cast<bool>(source);
for (uint64_t i = 0; (i < count) && result; ++i)
{
elements.emplace_back();
result = elements.back().from_data(source, true);
}
if (!result)
reset();
return result;
}
示例6: from_data
bool block::from_data(reader& source)
{
reset();
auto result = header.from_data(source, false);
if (result)
{
header.transaction_count = source.read_variable_uint_little_endian();
result = source;
}
for (uint64_t i = 0; (i < header.transaction_count) && result; ++i)
{
transactions.emplace_back();
result = transactions.back().from_data(source);
}
if (!result)
reset();
return result;
}
示例7: from_data
bool filter_load::from_data(reader& source)
{
bool result = false;
reset();
uint64_t filter_size = source.read_variable_uint_little_endian();
result = source;
if (result)
{
filter = source.read_data(filter_size);
hash_functions = source.read_4_bytes_little_endian();
tweak = source.read_4_bytes_little_endian();
flags = source.read_byte();
result = source && (filter.size() == filter_size);
}
if (!result)
reset();
return result;
}