aboutsummaryrefslogtreecommitdiff
path: root/src/blocks/blocks.cpp
diff options
context:
space:
mode:
authorRiccardo Spagni <ric@spagni.net>2018-10-05 23:13:31 +0200
committerRiccardo Spagni <ric@spagni.net>2018-10-05 23:13:32 +0200
commit79d46c4d551a9b1261801960095bf4d24967211a (patch)
tree084c67e8d2f93ed6ee6fa5629e997d8f7d56ddda /src/blocks/blocks.cpp
parentMerge pull request #4495 (diff)
parentblocks: use auto-generated .c files instead of 'LD -r -b binary' (diff)
downloadmonero-79d46c4d551a9b1261801960095bf4d24967211a.tar.xz
Merge pull request #4472
02d3ef7b blocks: use auto-generated .c files instead of 'LD -r -b binary' (xiphon)
Diffstat (limited to 'src/blocks/blocks.cpp')
-rw-r--r--src/blocks/blocks.cpp31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/blocks/blocks.cpp b/src/blocks/blocks.cpp
new file mode 100644
index 000000000..0661f8448
--- /dev/null
+++ b/src/blocks/blocks.cpp
@@ -0,0 +1,31 @@
+#include "blocks.h"
+
+#include <unordered_map>
+
+extern const unsigned char checkpoints[];
+extern const size_t checkpoints_len;
+extern const unsigned char stagenet_blocks[];
+extern const size_t stagenet_blocks_len;
+extern const unsigned char testnet_blocks[];
+extern const size_t testnet_blocks_len;
+
+namespace blocks
+{
+
+ const std::unordered_map<cryptonote::network_type, const epee::span<const unsigned char>, std::hash<size_t>> CheckpointsByNetwork = {
+ {cryptonote::network_type::MAINNET, {checkpoints, checkpoints_len}},
+ {cryptonote::network_type::STAGENET, {stagenet_blocks, stagenet_blocks_len}},
+ {cryptonote::network_type::TESTNET, {testnet_blocks, testnet_blocks_len}}
+ };
+
+ const epee::span<const unsigned char> GetCheckpointsData(cryptonote::network_type network)
+ {
+ const auto it = CheckpointsByNetwork.find(network);
+ if (it != CheckpointsByNetwork.end())
+ {
+ return it->second;
+ }
+ return nullptr;
+ }
+
+}