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


C++ reader::read_hash方法代码示例

本文整理汇总了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;
}
开发者ID:libbitcoin,项目名称:libbitcoin,代码行数:32,代码来源:stealth_record.cpp

示例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;
}
开发者ID:libbitcoin,项目名称:libbitcoin,代码行数:26,代码来源:block_transactions.cpp

示例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;
}
开发者ID:RojavaCrypto,项目名称:libbitcoin,代码行数:25,代码来源:point.cpp

示例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;
}
开发者ID:GeopaymeEE,项目名称:libbitcoin,代码行数:33,代码来源:merkle_block.cpp

示例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;
}
开发者ID:RojavaCrypto,项目名称:libbitcoin,代码行数:32,代码来源:payment_record.cpp

示例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;
}
开发者ID:respu,项目名称:libbitcoin,代码行数:12,代码来源:point.cpp

示例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;
}
开发者ID:bankonca,项目名称:libbitcoin,代码行数:23,代码来源:reject.cpp


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