diff options
author | Riccardo Spagni <ric@spagni.net> | 2018-03-05 19:11:20 +0200 |
---|---|---|
committer | Riccardo Spagni <ric@spagni.net> | 2018-03-05 19:11:20 +0200 |
commit | 4f93f745284c10f12e2524f5211030085d9626cf (patch) | |
tree | 29b5f359a8f346305bcf7bf82f459f421bfaa7a7 /src/blocks | |
parent | Merge pull request #3273 (diff) | |
parent | Wallet API: generalize 'bool testnet' to 'NetworkType nettype' (diff) | |
download | monero-4f93f745284c10f12e2524f5211030085d9626cf.tar.xz |
Merge pull request #3277
0e7ad2e2 Wallet API: generalize 'bool testnet' to 'NetworkType nettype' (stoffu)
af773211 Stagenet (stoffu)
cc9a0bee command_line: allow args to depend on more than one args (stoffu)
55f8d917 command_line::get_arg: remove 'required' for dependent args as they're always optional (stoffu)
450306a0 command line: allow has_arg to handle arg_descriptor<bool,false,true> #3318 (stoffu)
9f9e095a Use `genesis_tx` parameter in `generate_genesis_block`. #3261 (Jean Pierre Dudey)
Diffstat (limited to 'src/blocks')
-rw-r--r-- | src/blocks/CMakeLists.txt | 3 | ||||
-rw-r--r-- | src/blocks/blockexports.c | 22 | ||||
-rw-r--r-- | src/blocks/blocks.h | 4 | ||||
-rw-r--r-- | src/blocks/stagenet_blocks.dat | 0 |
4 files changed, 22 insertions, 7 deletions
diff --git a/src/blocks/CMakeLists.txt b/src/blocks/CMakeLists.txt index 079c59fb5..cf3f0b354 100644 --- a/src/blocks/CMakeLists.txt +++ b/src/blocks/CMakeLists.txt @@ -32,7 +32,8 @@ if(APPLE) else() add_custom_command(OUTPUT blocks.o MAIN_DEPENDENCY blocks.dat COMMAND cd ${CMAKE_CURRENT_SOURCE_DIR} && ${CMAKE_LINKER} ${LD_RAW_FLAGS} -r -b binary -o ${CMAKE_CURRENT_BINARY_DIR}/blocks.o blocks.dat) add_custom_command(OUTPUT testnet_blocks.o MAIN_DEPENDENCY testnet_blocks.dat COMMAND cd ${CMAKE_CURRENT_SOURCE_DIR} && ${CMAKE_LINKER} ${LD_RAW_FLAGS} -r -b binary -o ${CMAKE_CURRENT_BINARY_DIR}/testnet_blocks.o testnet_blocks.dat) - add_library(blocks STATIC blocks.o testnet_blocks.o blockexports.c) + add_custom_command(OUTPUT stagenet_blocks.o MAIN_DEPENDENCY stagenet_blocks.dat COMMAND cd ${CMAKE_CURRENT_SOURCE_DIR} && ${CMAKE_LINKER} ${LD_RAW_FLAGS} -r -b binary -o ${CMAKE_CURRENT_BINARY_DIR}/stagenet_blocks.o stagenet_blocks.dat) + add_library(blocks STATIC blocks.o testnet_blocks.o stagenet_blocks.o blockexports.c) set_target_properties(blocks PROPERTIES LINKER_LANGUAGE C) endif() diff --git a/src/blocks/blockexports.c b/src/blocks/blockexports.c index 477167a12..0154b0413 100644 --- a/src/blocks/blockexports.c +++ b/src/blocks/blockexports.c @@ -16,20 +16,24 @@ extern const struct mach_header_64 _mh_execute_header; #endif #endif -const unsigned char *get_blocks_dat_start(int testnet) +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) +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; @@ -42,30 +46,40 @@ size_t get_blocks_dat_size(int testnet) #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) +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) +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); } diff --git a/src/blocks/blocks.h b/src/blocks/blocks.h index b842009a4..ec683f47e 100644 --- a/src/blocks/blocks.h +++ b/src/blocks/blocks.h @@ -5,8 +5,8 @@ extern "C" { #endif -const unsigned char *get_blocks_dat_start(int testnet); -size_t get_blocks_dat_size(int testnet); +const unsigned char *get_blocks_dat_start(int testnet, int stagenet); +size_t get_blocks_dat_size(int testnet, int stagenet); #ifdef __cplusplus } diff --git a/src/blocks/stagenet_blocks.dat b/src/blocks/stagenet_blocks.dat new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/src/blocks/stagenet_blocks.dat |