Exemplo n.º 1
0
bool alert::from_data(uint32_t , reader& source)
{
    reset();

    payload_ = source.read_bytes(source.read_size_little_endian());
    signature_ = source.read_bytes(source.read_size_little_endian());

    if (!source)
        reset();

    return source;
}
Exemplo n.º 2
0
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;
}