diff options
author | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2015-10-16 19:45:35 +0100 |
---|---|---|
committer | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2015-10-17 00:11:26 +0100 |
commit | b13e7f284b909df8ca54fe93c231910a130f9f3e (patch) | |
tree | a79e281f205a0578312aa3b7cfc9a488036b9078 /src/blockchain_utilities/blockchain_export.cpp | |
parent | bootstrap_file: do not try to create a directory with an empty name (diff) | |
download | monero-b13e7f284b909df8ca54fe93c231910a130f9f3e.tar.xz |
blockchain_export can now export to a blocks.dat format
Also make the number of blocks endian independant, and add
support for testnet
Diffstat (limited to '')
-rw-r--r-- | src/blockchain_utilities/blockchain_export.cpp | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/src/blockchain_utilities/blockchain_export.cpp b/src/blockchain_utilities/blockchain_export.cpp index 8db8b7cdb..4a96bad6b 100644 --- a/src/blockchain_utilities/blockchain_export.cpp +++ b/src/blockchain_utilities/blockchain_export.cpp @@ -27,6 +27,7 @@ // THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "bootstrap_file.h" +#include "blocksdat_file.h" #include "common/command_line.h" #include "version.h" @@ -39,6 +40,7 @@ int main(int argc, char* argv[]) { uint32_t log_level = 0; uint64_t block_stop = 0; + bool blocks_dat = false; boost::filesystem::path default_data_path {tools::get_default_data_dir()}; boost::filesystem::path default_testnet_data_path {default_data_path / "testnet"}; @@ -54,6 +56,7 @@ int main(int argc, char* argv[]) , "Run on testnet." , false }; + const command_line::arg_descriptor<bool> arg_blocks_dat = {"blocksdat", "Output in blocks.dat format", blocks_dat}; command_line::add_arg(desc_cmd_sett, command_line::arg_data_dir, default_data_path.string()); @@ -62,6 +65,7 @@ int main(int argc, char* argv[]) command_line::add_arg(desc_cmd_sett, arg_testnet_on); command_line::add_arg(desc_cmd_sett, arg_log_level); command_line::add_arg(desc_cmd_sett, arg_block_stop); + command_line::add_arg(desc_cmd_sett, arg_blocks_dat); command_line::add_arg(desc_cmd_only, command_line::arg_help); @@ -94,6 +98,7 @@ int main(int argc, char* argv[]) LOG_PRINT_L0("Setting log level = " << log_level); bool opt_testnet = command_line::get_arg(vm, arg_testnet_on); + bool opt_blocks_dat = command_line::get_arg(vm, arg_blocks_dat); std::string m_config_folder; @@ -155,8 +160,16 @@ int main(int argc, char* argv[]) LOG_PRINT_L0("Source blockchain storage initialized OK"); LOG_PRINT_L0("Exporting blockchain raw data..."); - BootstrapFile bootstrap; - r = bootstrap.store_blockchain_raw(core_storage, NULL, output_file_path, block_stop); + if (opt_blocks_dat) + { + BlocksdatFile blocksdat; + r = blocksdat.store_blockchain_raw(core_storage, NULL, output_file_path, block_stop); + } + else + { + BootstrapFile bootstrap; + r = bootstrap.store_blockchain_raw(core_storage, NULL, output_file_path, block_stop); + } CHECK_AND_ASSERT_MES(r, false, "Failed to export blockchain raw data"); LOG_PRINT_L0("Blockchain raw data exported OK"); } |