| 1 | #include "blocks.h" |
| 2 | |
| 3 | #include <unordered_map> |
| 4 | |
| 5 | extern const unsigned char checkpoints[]; |
| 6 | extern const size_t checkpoints_len; |
| 7 | extern const unsigned char stagenet_blocks[]; |
| 8 | extern const size_t stagenet_blocks_len; |
| 9 | extern const unsigned char testnet_blocks[]; |
| 10 | extern const size_t testnet_blocks_len; |
| 11 | |
| 12 | namespace blocks |
| 13 | { |
| 14 | |
| 15 | const std::unordered_map<cryptonote::network_type, const epee::span<const unsigned char>, std::hash<size_t>> CheckpointsByNetwork = { |
| 16 | {cryptonote::network_type::MAINNET, {checkpoints, checkpoints_len}}, |
| 17 | {cryptonote::network_type::STAGENET, {stagenet_blocks, stagenet_blocks_len}}, |
| 18 | {cryptonote::network_type::TESTNET, {testnet_blocks, testnet_blocks_len}} |
| 19 | }; |
| 20 | |
| 21 | const epee::span<const unsigned char> GetCheckpointsData(cryptonote::network_type network) |
| 22 | { |
| 23 | const auto it = CheckpointsByNetwork.find(network); |
| 24 | if (it != CheckpointsByNetwork.end()) |
| 25 | { |
| 26 | return it->second; |
| 27 | } |
| 28 | return nullptr; |
| 29 | } |
| 30 | |
| 31 | } |