diff --git a/Makefile.am b/Makefile.am
index 442a59ebc..bb8195029 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -78,6 +78,7 @@ src_libbitcoin_explorer_la_SOURCES = \
src/commands/electrum-new.cpp \
src/commands/electrum-to-seed.cpp \
src/commands/fetch-balance.cpp \
+ src/commands/fetch-block.cpp \
src/commands/fetch-header.cpp \
src/commands/fetch-height.cpp \
src/commands/fetch-history.cpp \
@@ -218,6 +219,7 @@ test_libbitcoin_explorer_test_SOURCES = \
test/commands/electrum-new.cpp \
test/commands/electrum-to-seed.cpp \
test/commands/fetch-balance.cpp \
+ test/commands/fetch-block.cpp \
test/commands/fetch-header.cpp \
test/commands/fetch-height.cpp \
test/commands/fetch-history.cpp \
@@ -339,6 +341,7 @@ include_bitcoin_explorer_commands_HEADERS = \
include/bitcoin/explorer/commands/electrum-new.hpp \
include/bitcoin/explorer/commands/electrum-to-seed.hpp \
include/bitcoin/explorer/commands/fetch-balance.hpp \
+ include/bitcoin/explorer/commands/fetch-block.hpp \
include/bitcoin/explorer/commands/fetch-header.hpp \
include/bitcoin/explorer/commands/fetch-height.hpp \
include/bitcoin/explorer/commands/fetch-history.hpp \
diff --git a/builds/msvc/vs2013/libbitcoin-explorer-test/libbitcoin-explorer-test.vcxproj b/builds/msvc/vs2013/libbitcoin-explorer-test/libbitcoin-explorer-test.vcxproj
index 148b9d57f..3622d1f01 100644
--- a/builds/msvc/vs2013/libbitcoin-explorer-test/libbitcoin-explorer-test.vcxproj
+++ b/builds/msvc/vs2013/libbitcoin-explorer-test/libbitcoin-explorer-test.vcxproj
@@ -106,6 +106,7 @@
+
diff --git a/builds/msvc/vs2013/libbitcoin-explorer-test/libbitcoin-explorer-test.vcxproj.filters b/builds/msvc/vs2013/libbitcoin-explorer-test/libbitcoin-explorer-test.vcxproj.filters
index eac87e93c..1f1a30906 100644
--- a/builds/msvc/vs2013/libbitcoin-explorer-test/libbitcoin-explorer-test.vcxproj.filters
+++ b/builds/msvc/vs2013/libbitcoin-explorer-test/libbitcoin-explorer-test.vcxproj.filters
@@ -126,6 +126,9 @@
src\commands
+
+ src\commands
+
src\commands
diff --git a/builds/msvc/vs2013/libbitcoin-explorer/libbitcoin-explorer.vcxproj b/builds/msvc/vs2013/libbitcoin-explorer/libbitcoin-explorer.vcxproj
index 94c340f6a..d994e58ba 100644
--- a/builds/msvc/vs2013/libbitcoin-explorer/libbitcoin-explorer.vcxproj
+++ b/builds/msvc/vs2013/libbitcoin-explorer/libbitcoin-explorer.vcxproj
@@ -110,6 +110,7 @@
+
@@ -232,6 +233,7 @@
+
diff --git a/builds/msvc/vs2013/libbitcoin-explorer/libbitcoin-explorer.vcxproj.filters b/builds/msvc/vs2013/libbitcoin-explorer/libbitcoin-explorer.vcxproj.filters
index bc55196c6..7934ebf49 100644
--- a/builds/msvc/vs2013/libbitcoin-explorer/libbitcoin-explorer.vcxproj.filters
+++ b/builds/msvc/vs2013/libbitcoin-explorer/libbitcoin-explorer.vcxproj.filters
@@ -150,6 +150,9 @@
src\commands
+
+ src\commands
+
src\commands
@@ -512,6 +515,9 @@
include\bitcoin\explorer\commands
+
+ include\bitcoin\explorer\commands
+
include\bitcoin\explorer\commands
diff --git a/builds/msvc/vs2015/libbitcoin-explorer-test/libbitcoin-explorer-test.vcxproj b/builds/msvc/vs2015/libbitcoin-explorer-test/libbitcoin-explorer-test.vcxproj
index 2751c4a72..b0653c69c 100644
--- a/builds/msvc/vs2015/libbitcoin-explorer-test/libbitcoin-explorer-test.vcxproj
+++ b/builds/msvc/vs2015/libbitcoin-explorer-test/libbitcoin-explorer-test.vcxproj
@@ -106,6 +106,7 @@
+
diff --git a/builds/msvc/vs2015/libbitcoin-explorer-test/libbitcoin-explorer-test.vcxproj.filters b/builds/msvc/vs2015/libbitcoin-explorer-test/libbitcoin-explorer-test.vcxproj.filters
index eac87e93c..1f1a30906 100644
--- a/builds/msvc/vs2015/libbitcoin-explorer-test/libbitcoin-explorer-test.vcxproj.filters
+++ b/builds/msvc/vs2015/libbitcoin-explorer-test/libbitcoin-explorer-test.vcxproj.filters
@@ -126,6 +126,9 @@
src\commands
+
+ src\commands
+
src\commands
diff --git a/builds/msvc/vs2015/libbitcoin-explorer/libbitcoin-explorer.vcxproj b/builds/msvc/vs2015/libbitcoin-explorer/libbitcoin-explorer.vcxproj
index e3cce7dd9..b6977a934 100644
--- a/builds/msvc/vs2015/libbitcoin-explorer/libbitcoin-explorer.vcxproj
+++ b/builds/msvc/vs2015/libbitcoin-explorer/libbitcoin-explorer.vcxproj
@@ -110,6 +110,7 @@
+
@@ -232,6 +233,7 @@
+
diff --git a/builds/msvc/vs2015/libbitcoin-explorer/libbitcoin-explorer.vcxproj.filters b/builds/msvc/vs2015/libbitcoin-explorer/libbitcoin-explorer.vcxproj.filters
index a7d7d9a7b..759e630d3 100644
--- a/builds/msvc/vs2015/libbitcoin-explorer/libbitcoin-explorer.vcxproj.filters
+++ b/builds/msvc/vs2015/libbitcoin-explorer/libbitcoin-explorer.vcxproj.filters
@@ -150,6 +150,9 @@
src\commands
+
+ src\commands
+
src\commands
@@ -512,6 +515,9 @@
include\bitcoin\explorer\commands
+
+ include\bitcoin\explorer\commands
+
include\bitcoin\explorer\commands
diff --git a/builds/msvc/vs2017/libbitcoin-explorer-test/libbitcoin-explorer-test.vcxproj b/builds/msvc/vs2017/libbitcoin-explorer-test/libbitcoin-explorer-test.vcxproj
index 1646ef704..9b30bac9f 100644
--- a/builds/msvc/vs2017/libbitcoin-explorer-test/libbitcoin-explorer-test.vcxproj
+++ b/builds/msvc/vs2017/libbitcoin-explorer-test/libbitcoin-explorer-test.vcxproj
@@ -106,6 +106,7 @@
+
diff --git a/builds/msvc/vs2017/libbitcoin-explorer-test/libbitcoin-explorer-test.vcxproj.filters b/builds/msvc/vs2017/libbitcoin-explorer-test/libbitcoin-explorer-test.vcxproj.filters
index eac87e93c..1f1a30906 100644
--- a/builds/msvc/vs2017/libbitcoin-explorer-test/libbitcoin-explorer-test.vcxproj.filters
+++ b/builds/msvc/vs2017/libbitcoin-explorer-test/libbitcoin-explorer-test.vcxproj.filters
@@ -126,6 +126,9 @@
src\commands
+
+ src\commands
+
src\commands
diff --git a/builds/msvc/vs2017/libbitcoin-explorer/libbitcoin-explorer.vcxproj b/builds/msvc/vs2017/libbitcoin-explorer/libbitcoin-explorer.vcxproj
index c7f50150b..372586cd4 100644
--- a/builds/msvc/vs2017/libbitcoin-explorer/libbitcoin-explorer.vcxproj
+++ b/builds/msvc/vs2017/libbitcoin-explorer/libbitcoin-explorer.vcxproj
@@ -110,6 +110,7 @@
+
@@ -232,6 +233,7 @@
+
diff --git a/builds/msvc/vs2017/libbitcoin-explorer/libbitcoin-explorer.vcxproj.filters b/builds/msvc/vs2017/libbitcoin-explorer/libbitcoin-explorer.vcxproj.filters
index 8afed9a07..73de6148b 100644
--- a/builds/msvc/vs2017/libbitcoin-explorer/libbitcoin-explorer.vcxproj.filters
+++ b/builds/msvc/vs2017/libbitcoin-explorer/libbitcoin-explorer.vcxproj.filters
@@ -150,6 +150,9 @@
src\commands
+
+ src\commands
+
src\commands
@@ -512,6 +515,9 @@
include\bitcoin\explorer\commands
+
+ include\bitcoin\explorer\commands
+
include\bitcoin\explorer\commands
diff --git a/data/bx b/data/bx
index 9f084e023..d224cbf47 100644
--- a/data/bx
+++ b/data/bx
@@ -43,6 +43,7 @@ _bx()
electrum-new
electrum-to-seed
fetch-balance
+ fetch-block
fetch-header
fetch-height
fetch-history
diff --git a/include/bitcoin/explorer.hpp b/include/bitcoin/explorer.hpp
index 360499fe3..fe349c252 100644
--- a/include/bitcoin/explorer.hpp
+++ b/include/bitcoin/explorer.hpp
@@ -62,6 +62,7 @@
#include
#include
#include
+#include
#include
#include
#include
diff --git a/include/bitcoin/explorer/commands/fetch-block.hpp b/include/bitcoin/explorer/commands/fetch-block.hpp
new file mode 100644
index 000000000..b4efd6aa3
--- /dev/null
+++ b/include/bitcoin/explorer/commands/fetch-block.hpp
@@ -0,0 +1,263 @@
+/**
+ * Copyright (c) 2011-2017 libbitcoin developers (see AUTHORS)
+ *
+ * This file is part of libbitcoin.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+#ifndef BX_FETCH_BLOCK_HPP
+#define BX_FETCH_BLOCK_HPP
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+/********* GENERATED SOURCE CODE, DO NOT EDIT EXCEPT EXPERIMENTALLY **********/
+
+namespace libbitcoin {
+namespace explorer {
+namespace commands {
+
+/**
+ * Class to implement the fetch-block command.
+ */
+class BCX_API fetch_block
+ : public command
+{
+public:
+
+ /**
+ * The symbolic (not localizable) command name, lower case.
+ */
+ static const char* symbol()
+ {
+ return "fetch-block";
+ }
+
+
+ /**
+ * The member symbolic (not localizable) command name, lower case.
+ */
+ virtual const char* name()
+ {
+ return fetch_block::symbol();
+ }
+
+ /**
+ * The localizable command category name, upper case.
+ */
+ virtual const char* category()
+ {
+ return "ONLINE";
+ }
+
+ /**
+ * The localizable command description.
+ */
+ virtual const char* description()
+ {
+ return "Get the block from the specified hash or height. Height is ignored if both are specified. Requires a Libbitcoin server connection.";
+ }
+
+ /**
+ * Load program argument definitions.
+ * A value of -1 indicates that the number of instances is unlimited.
+ * @return The loaded program argument definitions.
+ */
+ virtual arguments_metadata& load_arguments()
+ {
+ return get_argument_metadata();
+ }
+
+ /**
+ * Load parameter fallbacks from file or input as appropriate.
+ * @param[in] input The input stream for loading the parameters.
+ * @param[in] The loaded variables.
+ */
+ virtual void load_fallbacks(std::istream& input,
+ po::variables_map& variables)
+ {
+ }
+
+ /**
+ * Load program option definitions.
+ * BUGBUG: see boost bug/fix: svn.boost.org/trac/boost/ticket/8009
+ * @return The loaded program option definitions.
+ */
+ virtual options_metadata& load_options()
+ {
+ using namespace po;
+ options_description& options = get_option_metadata();
+ options.add_options()
+ (
+ BX_HELP_VARIABLE ",h",
+ value()->zero_tokens(),
+ "Get a description and instructions for this command."
+ )
+ (
+ BX_CONFIG_VARIABLE ",c",
+ value(),
+ "The path to the configuration settings file."
+ )
+ (
+ "format,f",
+ value(&option_.format),
+ "The output format. Options are 'info', 'json' and 'xml', defaults to 'info'."
+ )
+ (
+ "hash,s",
+ value(&option_.hash),
+ "The Base16 block hash."
+ )
+ (
+ "height,t",
+ value(&option_.height),
+ "The block height."
+ );
+
+ return options;
+ }
+
+ /**
+ * Set variable defaults from configuration variable values.
+ * @param[in] variables The loaded variables.
+ */
+ virtual void set_defaults_from_config(po::variables_map& variables)
+ {
+ }
+
+ /**
+ * Invoke the command.
+ * @param[out] output The input stream for the command execution.
+ * @param[out] error The input stream for the command execution.
+ * @return The appropriate console return code { -1, 0, 1 }.
+ */
+ virtual console_result invoke(std::ostream& output,
+ std::ostream& cerr);
+
+ /* Properties */
+
+ /**
+ * Get the value of the format option.
+ */
+ virtual explorer::config::encoding& get_format_option()
+ {
+ return option_.format;
+ }
+
+ /**
+ * Set the value of the format option.
+ */
+ virtual void set_format_option(
+ const explorer::config::encoding& value)
+ {
+ option_.format = value;
+ }
+
+ /**
+ * Get the value of the hash option.
+ */
+ virtual bc::config::hash256& get_hash_option()
+ {
+ return option_.hash;
+ }
+
+ /**
+ * Set the value of the hash option.
+ */
+ virtual void set_hash_option(
+ const bc::config::hash256& value)
+ {
+ option_.hash = value;
+ }
+
+ /**
+ * Get the value of the height option.
+ */
+ virtual uint32_t& get_height_option()
+ {
+ return option_.height;
+ }
+
+ /**
+ * Set the value of the height option.
+ */
+ virtual void set_height_option(
+ const uint32_t& value)
+ {
+ option_.height = value;
+ }
+
+private:
+
+ /**
+ * Command line argument bound variables.
+ * Uses cross-compiler safe constructor-based zeroize.
+ * Zeroize for unit test consistency with program_options initialization.
+ */
+ struct argument
+ {
+ argument()
+ {
+ }
+
+ } argument_;
+
+ /**
+ * Command line option bound variables.
+ * Uses cross-compiler safe constructor-based zeroize.
+ * Zeroize for unit test consistency with program_options initialization.
+ */
+ struct option
+ {
+ option()
+ : format(),
+ hash(),
+ height()
+ {
+ }
+
+ explorer::config::encoding format;
+ bc::config::hash256 hash;
+ uint32_t height;
+ } option_;
+};
+
+} // namespace commands
+} // namespace explorer
+} // namespace libbitcoin
+
+#endif
diff --git a/include/bitcoin/explorer/generated.hpp b/include/bitcoin/explorer/generated.hpp
index deb3be05c..06587aaf6 100644
--- a/include/bitcoin/explorer/generated.hpp
+++ b/include/bitcoin/explorer/generated.hpp
@@ -59,6 +59,7 @@
#include
#include
#include
+#include
#include
#include
#include
diff --git a/model/generate.xml b/model/generate.xml
index 6b40ab1f3..b4aecc47f 100644
--- a/model/generate.xml
+++ b/model/generate.xml
@@ -283,6 +283,12 @@
+
+
+
+
+
+
diff --git a/src/commands/fetch-block.cpp b/src/commands/fetch-block.cpp
new file mode 100644
index 000000000..a728bbf9f
--- /dev/null
+++ b/src/commands/fetch-block.cpp
@@ -0,0 +1,80 @@
+/**
+ * Copyright (c) 2011-2017 libbitcoin developers (see AUTHORS)
+ *
+ * This file is part of libbitcoin.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+
+#include
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+namespace libbitcoin {
+namespace explorer {
+namespace commands {
+using namespace bc::client;
+using namespace bc::explorer::config;
+
+console_result fetch_block::invoke(std::ostream& output, std::ostream& error)
+{
+ // Bound parameters.
+ const auto height = get_height_option();
+ const hash_digest& hash = get_hash_option();
+ const encoding& encoding = get_format_option();
+ const auto connection = get_connection(*this);
+
+ obelisk_client client(connection.retries);
+ if (!client.connect(connection))
+ {
+ display_connection_failure(error, connection.server);
+ return console_result::failure;
+ }
+
+ callback_state state(error, output, encoding);
+
+ // This enables json-style array formatting.
+ const auto json = encoding == encoding_engine::json;
+
+ auto on_done = [&state, json](const code& ec, const chain::block& block)
+ {
+ if (!state.succeeded(ec))
+ return;
+
+ state.output(bc::property_tree(block, json));
+ };
+
+ // Height is ignored if both are specified.
+ // Use the null_hash as sentinel to determine whether to use height or hash.
+ if (hash == null_hash)
+ client.blockchain_fetch_block(on_done, height);
+ else
+ client.blockchain_fetch_block(on_done, hash);
+
+ client.wait();
+
+ return state.get_result();
+}
+
+
+} //namespace commands
+} //namespace explorer
+} //namespace libbitcoin
diff --git a/src/generated.cpp b/src/generated.cpp
index 43ae50ea8..83acc431b 100644
--- a/src/generated.cpp
+++ b/src/generated.cpp
@@ -72,6 +72,7 @@ void broadcast(const function)> func)
func(make_shared());
func(make_shared());
func(make_shared());
+ func(make_shared());
func(make_shared());
func(make_shared());
func(make_shared());
@@ -208,6 +209,8 @@ shared_ptr find(const string& symbol)
return make_shared();
if (symbol == fetch_balance::symbol())
return make_shared();
+ if (symbol == fetch_block::symbol())
+ return make_shared();
if (symbol == fetch_header::symbol())
return make_shared();
if (symbol == fetch_height::symbol())
diff --git a/test/commands/fetch-block.cpp b/test/commands/fetch-block.cpp
new file mode 100644
index 000000000..5e2eb4051
--- /dev/null
+++ b/test/commands/fetch-block.cpp
@@ -0,0 +1,116 @@
+/**
+ * Copyright (c) 2011-2017 libbitcoin developers (see AUTHORS)
+ *
+ * This file is part of libbitcoin.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+
+#include "command.hpp"
+
+BX_USING_NAMESPACES()
+
+BOOST_AUTO_TEST_SUITE(network)
+BOOST_AUTO_TEST_SUITE(fetch_header__invoke)
+
+#define FETCH_BLOCK_GENESIS_INFO \
+"block\n" \
+"{\n" \
+" bits 486604799\n" \
+" hash 000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f\n" \
+" merkle_tree_hash 4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b\n" \
+" nonce 2083236893\n" \
+" previous_block_hash 0000000000000000000000000000000000000000000000000000000000000000\n" \
+" time_stamp 1231006505\n" \
+" version 1\n" \
+" transactions\n" \
+" {\n" \
+" transaction\n" \
+" {\n" \
+" hash 4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b\n" \
+" inputs\n" \
+" {\n" \
+" input\n" \
+" {\n" \
+" address_hash 5b19778555f776292926b8dd581e1b9d2ab7cbbb\n" \
+" previous_output\n" \
+" {\n" \
+" hash 0000000000000000000000000000000000000000000000000000000000000000\n" \
+" index 4294967295\n" \
+" }\n" \
+" script \"[ffff001d] [04] [5468652054696d65732030332f4a616e2f32303039204368616e63656c6c6f72206f6e206272696e6b206f66207365636f6e64206261696c6f757420666f722062616e6b73]\"\n" \
+" sequence 4294967295\n" \
+" }\n" \
+" }\n" \
+" lock_time 0\n" \
+" outputs\n" \
+" {\n" \
+" output\n" \
+" {\n" \
+" address_hash 62e907b15cbf27d5425399ebf6f0fb50ebb88f18\n" \
+" script \"[04678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef38c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5f] checksig\"\n" \
+" value 5000000000\n" \
+" }\n" \
+" }\n" \
+" version 1\n" \
+" }\n" \
+" }\n" \
+"}\n" \
+
+
+#define FETCH_BLOCK_ONE_XML \
+"\n" \
+"48660479900000000839a8e6886ab5951d76f411475428afc90947ee320161bbf18eb60480e3e2357e806b6cdb1f70b54c3a3a17b6714ee1f0e68bebb44a74b1efd5120982573394689000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f123146966510e3e2357e806b6cdb1f70b54c3a3a17b6714ee1f0e68bebb44a74b1efd5120986d4c0aa972c314840ac07be96c5dde9c714c9ca400000000000000000000000000000000000000000000000000000000000000004294967295429496729501"
+
+#define BX_GENESIS_BLOCK_HASH "000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f"
+
+BOOST_AUTO_TEST_CASE(fetch_block__invoke__mainnet_block_height_0_info__okay_output)
+{
+ BX_DECLARE_CLIENT_COMMAND(fetch_block);
+ command.set_height_option(0);
+ command.set_format_option({ "info" });
+ BX_REQUIRE_OKAY(command.invoke(output, error));
+ BX_REQUIRE_OUTPUT(FETCH_BLOCK_GENESIS_INFO);
+}
+
+BOOST_AUTO_TEST_CASE(fetch_block__invoke__mainnet_block_height_1_xml__okay_output)
+{
+ BX_DECLARE_CLIENT_COMMAND(fetch_block);
+ command.set_height_option(1);
+ command.set_format_option({ "xml" });
+ BX_REQUIRE_OKAY(command.invoke(output, error));
+ BX_REQUIRE_OUTPUT(FETCH_BLOCK_ONE_XML);
+}
+
+BOOST_AUTO_TEST_CASE(fetch_block__invoke__mainnet_block_hash_genesis_info__okay_output)
+{
+ BX_DECLARE_CLIENT_COMMAND(fetch_block);
+ command.set_hash_option({ BX_GENESIS_BLOCK_HASH });
+ command.set_format_option({ "info" });
+ BX_REQUIRE_OKAY(command.invoke(output, error));
+ BX_REQUIRE_OUTPUT(FETCH_BLOCK_GENESIS_INFO);
+}
+
+BOOST_AUTO_TEST_CASE(fetch_block__invoke__mainnet_block_height_42_block_hash_genesis_info__okay_output)
+{
+ BX_DECLARE_CLIENT_COMMAND(fetch_block);
+ command.set_height_option(42);
+ command.set_format_option({ "info" });
+ command.set_hash_option({ BX_GENESIS_BLOCK_HASH });
+ BX_REQUIRE_OKAY(command.invoke(output, error));
+ BX_REQUIRE_OUTPUT(FETCH_BLOCK_GENESIS_INFO);
+}
+
+BOOST_AUTO_TEST_SUITE_END()
+BOOST_AUTO_TEST_SUITE_END()
diff --git a/test/generated__find.cpp b/test/generated__find.cpp
index 12a2504fe..bbe2e76fc 100644
--- a/test/generated__find.cpp
+++ b/test/generated__find.cpp
@@ -208,6 +208,11 @@ BOOST_AUTO_TEST_CASE(generated__find__fetch_balance__returns_object)
BOOST_REQUIRE(find("fetch-balance") != nullptr);
}
+BOOST_AUTO_TEST_CASE(generated__find__fetch_block__returns_object)
+{
+ BOOST_REQUIRE(find("fetch-block") != nullptr);
+}
+
BOOST_AUTO_TEST_CASE(generated__find__fetch_header__returns_object)
{
BOOST_REQUIRE(find("fetch-header") != nullptr);
diff --git a/test/generated__symbol.cpp b/test/generated__symbol.cpp
index 1c4d56ce4..8cdfc103d 100644
--- a/test/generated__symbol.cpp
+++ b/test/generated__symbol.cpp
@@ -208,6 +208,11 @@ BOOST_AUTO_TEST_CASE(generated__symbol__fetch_balance__returns_expected_value)
BOOST_REQUIRE_EQUAL(fetch_balance::symbol(), "fetch-balance");
}
+BOOST_AUTO_TEST_CASE(generated__symbol__fetch_block__returns_expected_value)
+{
+ BOOST_REQUIRE_EQUAL(fetch_block::symbol(), "fetch-block");
+}
+
BOOST_AUTO_TEST_CASE(generated__symbol__fetch_header__returns_expected_value)
{
BOOST_REQUIRE_EQUAL(fetch_header::symbol(), "fetch-header");