本文整理汇总了C++中channel_ptr::subscribe_get_blocks方法的典型用法代码示例。如果您正苦于以下问题:C++ channel_ptr::subscribe_get_blocks方法的具体用法?C++ channel_ptr::subscribe_get_blocks怎么用?C++ channel_ptr::subscribe_get_blocks使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类channel_ptr
的用法示例。
在下文中一共展示了channel_ptr::subscribe_get_blocks方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: get_blocks
void session::get_blocks(const std::error_code& ec,
const get_blocks_type& packet, channel_ptr node)
{
if (ec)
{
log_error(LOG_SESSION) << "get_blocks: " << ec.message();
return;
}
// send 500 invs from last fork point
// have memory of last inv, ready to trigger send next 500 once
// getdata done for it.
node->subscribe_get_blocks(
std::bind(&session::get_blocks, this, _1, _2, node));
}
示例2: new_channel
void session::new_channel(const std::error_code& ec, channel_ptr node)
{
if (ec)
{
log_warning(LOG_SESSION) << "New channel: " << ec.message();
return;
}
BITCOIN_ASSERT(node);
node->subscribe_inventory(
std::bind(&session::inventory, this, _1, _2, node));
node->subscribe_get_data(
std::bind(&session::get_data, this, _1, _2, node));
node->subscribe_get_blocks(
std::bind(&session::get_blocks, this, _1, _2, node));
// tx
// block
protocol_.subscribe_channel(
std::bind(&session::new_channel, this, _1, _2));
poll_.monitor(node);
}