本文整理汇总了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);
}
示例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())
{
}
示例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));
}
示例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));
}
示例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));
}
示例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));
}
示例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);
}
示例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);
}
示例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));
}
示例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));
}