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


C++ node_impl::blockchain方法代码示例

本文整理汇总了C++中node_impl::blockchain方法的典型用法代码示例。如果您正苦于以下问题:C++ node_impl::blockchain方法的具体用法?C++ node_impl::blockchain怎么用?C++ node_impl::blockchain使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在node_impl的用法示例。


在下文中一共展示了node_impl::blockchain方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: blockchain_fetch_stealth

void blockchain_fetch_stealth(node_impl& node,
    const incoming_message& request, queue_send_callback queue_send)
{
    const data_chunk& data = request.data();
    if (data.empty())
    {
        log_error(LOG_WORKER)
            << "Incorrect data size (empty) for blockchain.fetch_stealth";
        return;
    }
    auto deserial = make_deserializer(data.begin(), data.end());
    // number_bits
    uint8_t number_bits = deserial.read_byte();
    stealth_prefix prefix(number_bits);
    log_info(LOG_WORKER) << data.size() << " " << prefix.num_blocks();
    if (data.size() != 1 + prefix.num_blocks() + 4)
    {
        log_error(LOG_WORKER)
            << "Incorrect data size (" << data.size()
	    << ") for blockchain.fetch_stealth";
        return;
    }
    // actual bitfield data
    data_chunk bitfield = deserial.read_data(prefix.num_blocks());
    boost::from_block_range(bitfield.begin(), bitfield.end(), prefix);
    // from_height
    size_t from_height = deserial.read_4_bytes();
    node.blockchain().fetch_stealth(prefix,
        std::bind(stealth_fetched, _1, _2, request, queue_send), from_height);
}
开发者ID:u20024804,项目名称:libbitcoin-server,代码行数:30,代码来源:blockchain.cpp

示例2:

query_service_handler::query_service_handler(
    config_map_type& config, node_impl& node)
  : stop_secret_(config["stop-secret"].c_str()),
    chain_(node.blockchain()),
    txpool_(node.transaction_pool()),
    protocol_(node.protocol())
{
}
开发者ID:genjix,项目名称:query,代码行数:8,代码来源:service.cpp

示例3: fetch_block_header_by_hash

void fetch_block_header_by_hash(node_impl& node,
    const incoming_message& request, queue_send_callback queue_send)
{
    const data_chunk& data = request.data();
    BITCOIN_ASSERT(data.size() == 32);
    auto deserial = make_deserializer(data.begin(), data.end());
    const hash_digest blk_hash = deserial.read_hash();
    node.blockchain().fetch_block_header(blk_hash,
        std::bind(block_header_fetched, _1, _2, request, queue_send));
}
开发者ID:u20024804,项目名称:libbitcoin-server,代码行数:10,代码来源:blockchain.cpp

示例4: fetch_block_header_by_height

void fetch_block_header_by_height(node_impl& node,
    const incoming_message& request, queue_send_callback queue_send)
{
    const data_chunk& data = request.data();
    BITCOIN_ASSERT(data.size() == 4);
    auto deserial = make_deserializer(data.begin(), data.end());
    size_t height = deserial.read_4_bytes();
    node.blockchain().fetch_block_header(height,
        std::bind(block_header_fetched, _1, _2, request, queue_send));
}
开发者ID:u20024804,项目名称:libbitcoin-server,代码行数:10,代码来源:blockchain.cpp

示例5: blockchain_fetch_transaction

void blockchain_fetch_transaction(node_impl& node,
    const incoming_message& request, queue_send_callback queue_send)
{
    hash_digest tx_hash;
    if (!unwrap_fetch_transaction_args(tx_hash, request))
        return;
    log_debug(LOG_REQUEST) << "blockchain.fetch_transaction("
        << tx_hash << ")";
    node.blockchain().fetch_transaction(tx_hash,
        std::bind(transaction_fetched, _1, _2, request, queue_send));
}
开发者ID:u20024804,项目名称:libbitcoin-server,代码行数:11,代码来源:blockchain.cpp

示例6: blockchain_fetch_last_height

void blockchain_fetch_last_height(node_impl& node,
    const incoming_message& request, queue_send_callback queue_send)
{
    const data_chunk& data = request.data();
    if (!data.empty())
    {
        log_error(LOG_WORKER)
            << "Incorrect data size for blockchain.fetch_last_height";
        return;
    }
    node.blockchain().fetch_last_height(
        std::bind(last_height_fetched, _1, _2, request, queue_send));
}
开发者ID:u20024804,项目名称:libbitcoin-server,代码行数:13,代码来源:blockchain.cpp

示例7: blockchain_fetch_history

void blockchain_fetch_history(node_impl& node,
    const incoming_message& request, queue_send_callback queue_send)
{
    payment_address payaddr;
    uint32_t from_height;
    if (!unwrap_fetch_history_args(payaddr, from_height, request))
        return;
    log_debug(LOG_REQUEST) << "blockchain.fetch_history("
        << payaddr.encoded() << ", from_height=" << from_height << ")";
    node.blockchain().fetch_history(payaddr,
        std::bind(send_history_result,
            _1, _2, request, queue_send), from_height);
}
开发者ID:u20024804,项目名称:libbitcoin-server,代码行数:13,代码来源:blockchain.cpp

示例8: fullnode_fetch_history

void fullnode_fetch_history(node_impl& node,
    const incoming_message& request, zmq_socket_ptr socket)
{
    payment_address payaddr;
    uint32_t from_height;
    if (!unwrap_fetch_history_args(payaddr, from_height, request))
        return;
    log_debug(LOG_WORKER) << "fetch_history("
        << payaddr.encoded() << ", from_height=" << from_height << ")";
    fetch_history(node.blockchain(), node.transaction_indexer(),
        payaddr,
        std::bind(send_history_result, _1, _2, request, socket),
        from_height);
}
开发者ID:Bobalot,项目名称:obelisk,代码行数:14,代码来源:fullnode.cpp

示例9: blockchain_fetch_block_height

void blockchain_fetch_block_height(node_impl& node,
    const incoming_message& request, queue_send_callback queue_send)
{
    const data_chunk& data = request.data();
    if (data.size() != 32)
    {
        log_error(LOG_WORKER)
            << "Incorrect data size for blockchain.fetch_block_height";
        return;
    }
    auto deserial = make_deserializer(data.begin(), data.end());
    const hash_digest blk_hash = deserial.read_hash();
    node.blockchain().fetch_block_height(blk_hash,
        std::bind(block_height_fetched, _1, _2, request, queue_send));
}
开发者ID:u20024804,项目名称:libbitcoin-server,代码行数:15,代码来源:blockchain.cpp

示例10: blockchain_fetch_spend

void blockchain_fetch_spend(node_impl& node,
    const incoming_message& request, queue_send_callback queue_send)
{
    const data_chunk& data = request.data();
    if (data.size() != 36)
    {
        log_error(LOG_WORKER)
            << "Incorrect data size for blockchain.fetch_spend";
        return;
    }
    auto deserial = make_deserializer(data.begin(), data.end());
    output_point outpoint;
    outpoint.hash = deserial.read_hash();
    outpoint.index = deserial.read_4_bytes();
    node.blockchain().fetch_spend(outpoint,
        std::bind(spend_fetched, _1, _2, request, queue_send));
}
开发者ID:u20024804,项目名称:libbitcoin-server,代码行数:17,代码来源:blockchain.cpp


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