forked from wownero/wownero
This reverts commitrelease-v0.5.079d46c4d55
, reversing changes made toc9fc61dbb5
.
parent
3f2bfe87f7
commit
ac5674524a
@ -0,0 +1,87 @@
|
|||||||
|
#include <stddef.h>
|
||||||
|
|
||||||
|
#if defined(__APPLE__)
|
||||||
|
#include <mach-o/getsect.h>
|
||||||
|
#ifdef BUILD_SHARED_LIBS
|
||||||
|
#if !defined(__LP64__)
|
||||||
|
const struct mach_header _mh_execute_header;
|
||||||
|
#else
|
||||||
|
const struct mach_header_64 _mh_execute_header;
|
||||||
|
#endif
|
||||||
|
#else
|
||||||
|
#if !defined(__LP64__)
|
||||||
|
extern const struct mach_header _mh_execute_header;
|
||||||
|
#else
|
||||||
|
extern const struct mach_header_64 _mh_execute_header;
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
const unsigned char *get_blocks_dat_start(int testnet, int stagenet)
|
||||||
|
{
|
||||||
|
size_t size;
|
||||||
|
if (testnet)
|
||||||
|
return getsectiondata(&_mh_execute_header, "__DATA", "__testnet_blocks_dat", &size);
|
||||||
|
else if (stagenet)
|
||||||
|
return getsectiondata(&_mh_execute_header, "__DATA", "__stagenet_blocks_dat", &size);
|
||||||
|
else
|
||||||
|
return getsectiondata(&_mh_execute_header, "__DATA", "__blocks_dat", &size);
|
||||||
|
}
|
||||||
|
|
||||||
|
size_t get_blocks_dat_size(int testnet, int stagenet)
|
||||||
|
{
|
||||||
|
size_t size;
|
||||||
|
if (testnet)
|
||||||
|
getsectiondata(&_mh_execute_header, "__DATA", "__testnet_blocks_dat", &size);
|
||||||
|
else if (stagenet)
|
||||||
|
getsectiondata(&_mh_execute_header, "__DATA", "__stagenet_blocks_dat", &size);
|
||||||
|
else
|
||||||
|
getsectiondata(&_mh_execute_header, "__DATA", "__blocks_dat", &size);
|
||||||
|
return size;
|
||||||
|
}
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
#if defined(_WIN32) && !defined(_WIN64)
|
||||||
|
#define _binary_blocks_start binary_blocks_dat_start
|
||||||
|
#define _binary_blocks_end binary_blocks_dat_end
|
||||||
|
#define _binary_testnet_blocks_start binary_testnet_blocks_dat_start
|
||||||
|
#define _binary_testnet_blocks_end binary_testnet_blocks_dat_end
|
||||||
|
#define _binary_stagenet_blocks_start binary_stagenet_blocks_dat_start
|
||||||
|
#define _binary_stagenet_blocks_end binary_stagenet_blocks_dat_end
|
||||||
|
#else
|
||||||
|
#define _binary_blocks_start _binary_blocks_dat_start
|
||||||
|
#define _binary_blocks_end _binary_blocks_dat_end
|
||||||
|
#define _binary_testnet_blocks_start _binary_testnet_blocks_dat_start
|
||||||
|
#define _binary_testnet_blocks_end _binary_testnet_blocks_dat_end
|
||||||
|
#define _binary_stagenet_blocks_start _binary_stagenet_blocks_dat_start
|
||||||
|
#define _binary_stagenet_blocks_end _binary_stagenet_blocks_dat_end
|
||||||
|
#endif
|
||||||
|
|
||||||
|
extern const unsigned char _binary_blocks_start[];
|
||||||
|
extern const unsigned char _binary_blocks_end[];
|
||||||
|
extern const unsigned char _binary_testnet_blocks_start[];
|
||||||
|
extern const unsigned char _binary_testnet_blocks_end[];
|
||||||
|
extern const unsigned char _binary_stagenet_blocks_start[];
|
||||||
|
extern const unsigned char _binary_stagenet_blocks_end[];
|
||||||
|
|
||||||
|
const unsigned char *get_blocks_dat_start(int testnet, int stagenet)
|
||||||
|
{
|
||||||
|
if (testnet)
|
||||||
|
return _binary_testnet_blocks_start;
|
||||||
|
else if (stagenet)
|
||||||
|
return _binary_stagenet_blocks_start;
|
||||||
|
else
|
||||||
|
return _binary_blocks_start;
|
||||||
|
}
|
||||||
|
|
||||||
|
size_t get_blocks_dat_size(int testnet, int stagenet)
|
||||||
|
{
|
||||||
|
if (testnet)
|
||||||
|
return (size_t) (_binary_testnet_blocks_end - _binary_testnet_blocks_start);
|
||||||
|
else if (stagenet)
|
||||||
|
return (size_t) (_binary_stagenet_blocks_end - _binary_stagenet_blocks_start);
|
||||||
|
else
|
||||||
|
return (size_t) (_binary_blocks_end - _binary_blocks_start);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
@ -1,31 +0,0 @@
|
|||||||
#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;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,12 +1,16 @@
|
|||||||
#ifndef SRC_BLOCKS_BLOCKS_H_
|
#ifndef SRC_BLOCKS_BLOCKS_H_
|
||||||
#define SRC_BLOCKS_BLOCKS_H_
|
#define SRC_BLOCKS_BLOCKS_H_
|
||||||
|
|
||||||
#include "cryptonote_config.h"
|
#ifdef __cplusplus
|
||||||
#include "span.h"
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace blocks
|
const unsigned char *get_blocks_dat_start(int testnet, int stagenet);
|
||||||
{
|
size_t get_blocks_dat_size(int testnet, int stagenet);
|
||||||
const epee::span<const unsigned char> GetCheckpointsData(cryptonote::network_type network);
|
|
||||||
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#endif /* SRC_BLOCKS_BLOCKS_H_ */
|
#endif /* SRC_BLOCKS_BLOCKS_H_ */
|
||||||
|
Loading…
Reference in new issue