| 808 | } |
| 809 | |
| 810 | void BlockChain::test_print_tips() const { |
| 811 | CumulativeDifficulty ocd; |
| 812 | Hash obid; |
| 813 | if (get_oldest_tip(&ocd, &obid)) |
| 814 | std::cout << "oldest tip cd=" << ocd << " bid=" << obid << std::endl; |
| 815 | std::cout << "---- BlockTree structure ----" << std::endl; |
| 816 | for (DB::Cursor cur = m_db.begin(CHILDREN_PREFIX); !cur.end(); cur.next()) { |
| 817 | Hash bid; |
| 818 | DB::from_binary_key(cur.get_suffix(), 0, bid.data, sizeof(bid.data)); |
| 819 | size_t counter = 1; |
| 820 | seria::from_binary(counter, cur.get_value_array()); |
| 821 | api::BlockHeader info = read_header(bid); |
| 822 | std::cout << "branch height=" << info.height << " bid=" << bid << " children=" << counter << std::endl; |
| 823 | } |
| 824 | for_each_tip([&](CumulativeDifficulty cd, Hash bid) -> bool { |
| 825 | api::BlockHeader info = read_header(bid); |
| 826 | std::cout << "tip height=" << info.height << " bid=" << bid << " CD=" << cd << std::endl; |
| 827 | return true; |
| 828 | }); |
| 829 | } |
| 830 | |
| 831 | void BlockChain::test_print_structure(Height n_confirmations) const { |
| 832 | CumulativeDifficulty ocd; |
nothing calls this directly
no test coverage detected