本文整理汇总了C++中cryptonote::core::get_alternative_blocks方法的典型用法代码示例。如果您正苦于以下问题:C++ core::get_alternative_blocks方法的具体用法?C++ core::get_alternative_blocks怎么用?C++ core::get_alternative_blocks使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cryptonote::core
的用法示例。
在下文中一共展示了core::get_alternative_blocks方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
//-----------------------------------------------------------------------------------------------------
bool gen_chain_switch_1::check_split_switched(cryptonote::core& c, size_t ev_index, const std::vector<test_event_entry>& events)
{
DEFINE_TESTS_ERROR_CONTEXT("gen_chain_switch_1::check_split_switched");
std::vector<block> blocks;
bool r = c.get_blocks(0, 10000, blocks);
CHECK_TEST_CONDITION(r);
CHECK_EQ(6 + 2 * CRYPTONOTE_MINED_MONEY_UNLOCK_WINDOW, blocks.size());
auto it = blocks.end();
--it; --it; --it;
CHECK_TEST_CONDITION(std::equal(blocks.begin(), it, m_chain_1.begin()));
CHECK_TEST_CONDITION(blocks.back() == boost::get<block>(events[24 + 2 * CRYPTONOTE_MINED_MONEY_UNLOCK_WINDOW])); // blk_7
std::vector<block> alt_blocks;
r = c.get_alternative_blocks(alt_blocks);
CHECK_TEST_CONDITION(r);
CHECK_EQ(2, c.get_alternative_blocks_count());
// Some blocks that were in main chain are in alt chain now
BOOST_FOREACH(block b, alt_blocks)
{
CHECK_TEST_CONDITION(m_chain_1.end() != std::find(m_chain_1.begin(), m_chain_1.end(), b));
}
示例2:
//-----------------------------------------------------------------------------------------------------
bool gen_chain_switch_1::check_split_switched(CryptoNote::core& c, size_t ev_index, const std::vector<test_event_entry>& events)
{
DEFINE_TESTS_ERROR_CONTEXT("gen_chain_switch_1::check_split_switched");
std::list<Block> blocks;
bool r = c.get_blocks(0, 10000, blocks);
CHECK_TEST_CONDITION(r);
CHECK_EQ(6 + 2 * m_currency.minedMoneyUnlockWindow(), blocks.size());
auto it = blocks.end();
--it; --it; --it;
CHECK_TEST_CONDITION(std::equal(blocks.begin(), it, m_chain_1.begin()));
CHECK_TEST_CONDITION(blocks.back() == boost::get<Block>(events[24 + 2 * m_currency.minedMoneyUnlockWindow()])); // blk_7
std::list<Block> alt_blocks;
r = c.get_alternative_blocks(alt_blocks);
CHECK_TEST_CONDITION(r);
CHECK_EQ(2, c.get_alternative_blocks_count());
// Some blocks that were in main chain are in alt chain now
BOOST_FOREACH(Block b, alt_blocks)
{
CHECK_TEST_CONDITION(m_chain_1.end() != std::find(m_chain_1.begin(), m_chain_1.end(), b));
}