Skip to content

Commit

Permalink
Merge pull request #481 from evoskuil/version3
Browse files Browse the repository at this point in the history
version 3.2.0
  • Loading branch information
evoskuil authored May 2, 2017
2 parents 6de1e1b + 63e44b6 commit 8c886eb
Show file tree
Hide file tree
Showing 10 changed files with 55 additions and 22 deletions.
Binary file modified builds/msvc/resource.rc
Binary file not shown.
8 changes: 4 additions & 4 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
AC_PREREQ([2.65])

# Process command-line arguments and perform initialization and verification.
AC_INIT([libbitcoin-explorer], [3.1.0], [[email protected]])
AC_INIT([libbitcoin-explorer], [3.2.0], [[email protected]])

# Do compilation tests.
AC_LANG(C++)
Expand Down Expand Up @@ -165,10 +165,10 @@ AC_SUBST([bitcoin_client_CPPFLAGS], [${bitcoin_client_CFLAGS}])
AC_MSG_NOTICE([bitcoin_client_CPPFLAGS : ${bitcoin_client_CPPFLAGS}])
AC_MSG_NOTICE([bitcoin_client_LIBS : ${bitcoin_client_LIBS}])

# Require bitcoin-network of at least version 3.1.0 and output ${bitcoin_network_CPPFLAGS/LIBS/PKG}.
# Require bitcoin-network of at least version 3.2.0 and output ${bitcoin_network_CPPFLAGS/LIBS/PKG}.
#------------------------------------------------------------------------------
PKG_CHECK_MODULES([bitcoin_network], [libbitcoin-network >= 3.1.0])
AC_SUBST([bitcoin_network_PKG], ['libbitcoin-network >= 3.1.0'])
PKG_CHECK_MODULES([bitcoin_network], [libbitcoin-network >= 3.2.0])
AC_SUBST([bitcoin_network_PKG], ['libbitcoin-network >= 3.2.0'])
AC_SUBST([bitcoin_network_CPPFLAGS], [${bitcoin_network_CFLAGS}])
AC_MSG_NOTICE([bitcoin_network_CPPFLAGS : ${bitcoin_network_CPPFLAGS}])
AC_MSG_NOTICE([bitcoin_network_LIBS : ${bitcoin_network_LIBS}])
Expand Down
4 changes: 2 additions & 2 deletions include/bitcoin/explorer/version.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
* For interpretation of the versioning scheme see: http://semver.org
*/

#define LIBBITCOIN_EXPLORER_VERSION "3.1.0"
#define LIBBITCOIN_EXPLORER_VERSION "3.2.0"
#define LIBBITCOIN_EXPLORER_MAJOR_VERSION 3
#define LIBBITCOIN_EXPLORER_MINOR_VERSION 1
#define LIBBITCOIN_EXPLORER_MINOR_VERSION 2
#define LIBBITCOIN_EXPLORER_PATCH_VERSION 0

#endif
2 changes: 1 addition & 1 deletion libbitcoin-explorer.pc.in
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Version: @PACKAGE_VERSION@
#==============================================================================
# Dependencies that publish package configuration.
#------------------------------------------------------------------------------
Requires: libbitcoin-client >= 3.1.0 libbitcoin-network >= 3.1.0
Requires: libbitcoin-client >= 3.1.0 libbitcoin-network >= 3.2.0

# Include directory and any other required compiler flags.
#------------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion src/dispatch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ console_result dispatch_command(int argc, const char* argv[],
log::stream console_out(&output, null_deleter());
log::stream console_err(&error, null_deleter());

log::initialize(debug_log, error_log, console_out, console_err);
log::initialize(debug_log, error_log, console_out, console_err, false);
}

return command->invoke(out, err);
Expand Down
8 changes: 6 additions & 2 deletions src/prop_tree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -166,10 +166,12 @@ ptree prop_tree(const chain::history::list& rows,
ptree prop_list(const tx_input_type& tx_input)
{
ptree tree;

// This will have default versioning, but the address version is unused.
const auto script_address = payment_address::extract(tx_input.script());

if (script_address)
tree.put("address", script_address);
tree.put("address_hash", hash160(script_address.hash()));

tree.put("previous_output.hash", hash256(tx_input.previous_output().hash()));
tree.put("previous_output.index", tx_input.previous_output().index());
Expand Down Expand Up @@ -219,10 +221,12 @@ ptree prop_tree(const std::vector<input>& inputs, bool json)
ptree prop_list(const tx_output_type& tx_output)
{
ptree tree;

// This will have default versioning, but the address version is unused.
const auto address = payment_address::extract(tx_output.script());

if (address)
tree.put("address", address);
tree.put("address_hash", hash160(address.hash()));

tree.put("script", tx_output.script().to_string(
machine::rule_fork::all_rules));
Expand Down
9 changes: 5 additions & 4 deletions test/commands/fetch-tx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ BOOST_AUTO_TEST_SUITE(fetch_tx__invoke)

#define FETCH_TX_SATOSHIS_WORDS_XML \
"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" \
"<transaction><hash>4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b</hash><inputs><input><previous_output><hash>0000000000000000000000000000000000000000000000000000000000000000</hash><index>4294967295</index></previous_output><script>[ffff001d] [04] [5468652054696d65732030332f4a616e2f32303039204368616e63656c6c6f72206f6e206272696e6b206f66207365636f6e64206261696c6f757420666f722062616e6b73]</script><sequence>4294967295</sequence></input></inputs><lock_time>0</lock_time><outputs><output><address>1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa</address><script>[04678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef38c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5f] checksig</script><value>5000000000</value></output></outputs><version>1</version></transaction>\n"
"<transaction><hash>4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b</hash><inputs><input><previous_output><hash>0000000000000000000000000000000000000000000000000000000000000000</hash><index>4294967295</index></previous_output><script>[ffff001d] [04] [5468652054696d65732030332f4a616e2f32303039204368616e63656c6c6f72206f6e206272696e6b206f66207365636f6e64206261696c6f757420666f722062616e6b73]</script><sequence>4294967295</sequence></input></inputs><lock_time>0</lock_time><outputs><output><address_hash>62e907b15cbf27d5425399ebf6f0fb50ebb88f18</address_hash><script>[04678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef38c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5f] checksig</script><value>5000000000</value></output></outputs><version>1</version></transaction>\n"

#define FETCH_TX_SATOSHIS_WORDS_TX_INFO \
#define FETCH_TX_SATOSHIS_WORDS_TX_INFO \
"transaction\n" \
"{\n" \
" hash 4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b\n" \
Expand All @@ -52,7 +52,7 @@ BOOST_AUTO_TEST_SUITE(fetch_tx__invoke)
" {\n" \
" output\n" \
" {\n" \
" address 1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa\n" \
" address_hash 62e907b15cbf27d5425399ebf6f0fb50ebb88f18\n" \
" script \"[04678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef38c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5f] checksig\"\n" \
" value 5000000000\n" \
" }\n" \
Expand All @@ -62,6 +62,7 @@ BOOST_AUTO_TEST_SUITE(fetch_tx__invoke)

#define FETCH_TX_SECOND_TX_HASH \
"0e3e2357e806b6cdb1f70b54c3a3a17b6714ee1f0e68bebb44a74b1efd512098"

#define FETCH_TX_SECOND_TX_INFO \
"transaction\n" \
"{\n" \
Expand All @@ -84,7 +85,7 @@ BOOST_AUTO_TEST_SUITE(fetch_tx__invoke)
" {\n" \
" output\n" \
" {\n" \
" address 12c6DSiU4Rq3P4ZxziKxzrL5LmMBrzjrJX\n" \
" address_hash 119b098e2e980a229e139a9ed01a469e518e6f26\n" \
" script \"[0496b538e853519c726a2c91e61ec11600ae1390813a627c66fb8be7947be63c52da7589379515d4e0a604f8141781e62294721166bf621e73a82cbf2342c858ee] checksig\"\n" \
" value 5000000000\n" \
" }\n" \
Expand Down
8 changes: 8 additions & 0 deletions test/commands/script-decode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,13 @@ BOOST_AUTO_TEST_CASE(script_decode__invoke__data__okay_output)
BX_REQUIRE_OUTPUT("[cf2e5b02] 0xd6 0xf0 [40f5a9defbbf710c388b8451c82145b1419fe9696837b1cdefc569a2a79baa6da2f747] 0xc3 nop3 10 [2a081dfd5e799abc41262103e0d17114] nip <invalid>\n");
}

BOOST_AUTO_TEST_CASE(script_decode__invoke__issue_477__okay_output)
{
BX_DECLARE_COMMAND(script_decode);
command.set_base16_argument({ "4730440220688fb2aef767f21127b375d50d0ab8f7a1abaecad08e7c4987f7305c90e5a02502203282909b7863149bf4c92589764df80744afb509b949c06bfbeb28864277d88d0121025334b571c11e22967452f195509260f6a6dd10357fc4ad76b1c0aa5981ac254e" });
BX_REQUIRE_OKAY(command.invoke(output, error));
BX_REQUIRE_OUTPUT("[30440220688fb2aef767f21127b375d50d0ab8f7a1abaecad08e7c4987f7305c90e5a02502203282909b7863149bf4c92589764df80744afb509b949c06bfbeb28864277d88d01] [025334b571c11e22967452f195509260f6a6dd10357fc4ad76b1c0aa5981ac254e]\n");
}

BOOST_AUTO_TEST_SUITE_END()
BOOST_AUTO_TEST_SUITE_END()
19 changes: 14 additions & 5 deletions test/commands/tx-decode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ BOOST_AUTO_TEST_SUITE(tx_decode__invoke)
" {\n" \
" output\n" \
" {\n" \
" address 1966U1pjj15tLxPXZ19U48c99EJDkdXeqb\n" \
" address_hash 58b7a60f11a904feef35a639b6048de8dd4d9f1c\n" \
" script \"dup hash160 [58b7a60f11a904feef35a639b6048de8dd4d9f1c] equalverify checksig\"\n" \
" value 45000\n" \
" }\n" \
Expand Down Expand Up @@ -86,7 +86,7 @@ BOOST_AUTO_TEST_SUITE(tx_decode__invoke)
" }\n" \
" output\n" \
" {\n" \
" address 1KbjyvFBRc2p6dKpTfDAFdT5DqmVLGX3B4\n" \
" address_hash cc04492c12d0ddeb4cf88cfccb0d6d78d0fcd39d\n" \
" script \"dup hash160 [cc04492c12d0ddeb4cf88cfccb0d6d78d0fcd39d] equalverify checksig\"\n" \
" value 42\n" \
" }\n" \
Expand Down Expand Up @@ -116,7 +116,7 @@ BOOST_AUTO_TEST_SUITE(tx_decode__invoke)
" {\n" \
" output\n" \
" {\n" \
" address 13Ft7SkreJY9D823NPm4t6D1cBqLYTJtAe\n" \
" address_hash 18c0bd8d1818f1bf99cb1df2269c645318ef7b73\n" \
" script \"dup hash160 [18c0bd8d1818f1bf99cb1df2269c645318ef7b73] equalverify checksig\"\n" \
" value 500\n" \
" }\n" \
Expand All @@ -132,7 +132,7 @@ BOOST_AUTO_TEST_SUITE(tx_decode__invoke)
" {\n" \
" input\n" \
" {\n" \
" address 1JziqzXeBPyHPeAHrG4DCDW4ASXeGGF6p6\n" \
" address_hash c564c740c6900b93afc9f1bdaef0a9d466adf6ee\n" \
" previous_output\n" \
" {\n" \
" hash 7c3e880e7c93a7b01506188c36a239f70b561dfa622d0aa0d8f3b7403c94017d\n" \
Expand All @@ -147,7 +147,7 @@ BOOST_AUTO_TEST_SUITE(tx_decode__invoke)
" {\n" \
" output\n" \
" {\n" \
" address 1966U1pjj15tLxPXZ19U48c99EJDkdXeqb\n" \
" address_hash 58b7a60f11a904feef35a639b6048de8dd4d9f1c\n" \
" script \"dup hash160 [58b7a60f11a904feef35a639b6048de8dd4d9f1c] equalverify checksig\"\n" \
" value 45000\n" \
" }\n" \
Expand Down Expand Up @@ -191,5 +191,14 @@ BOOST_AUTO_TEST_CASE(tx_decode__invoke__example_4__expected_output)
BX_REQUIRE_OUTPUT(TX_DECODE_EXAMPLE4);
}

////BOOST_AUTO_TEST_CASE(tx_decode__invoke__issue_477__expected_output)
////{
//// BX_DECLARE_COMMAND(tx_decode);
//// command.set_format_option({ "info" });
//// command.set_transaction_argument({ "0100000001833d56a22cd88ef7a17d51d30b169a86aa4138f60867a6e21fc88a7b546b5d64010000006a4730440220688fb2aef767f21127b375d50d0ab8f7a1abaecad08e7c4987f7305c90e5a02502203282909b7863149bf4c92589764df80744afb509b949c06bfbeb28864277d88d0121025334b571c11e22967452f195509260f6a6dd10357fc4ad76b1c0aa5981ac254effffffff030000000000000000246a22414243444546917ce6520f0740cd2c373bd506415777bd23e8680123456789abcdef10270000000000001976a914ce5b06176d2572d4fb985747f197c389b8ac64e888ac30750000000000001976a9143c6602137d7f9a68a96aff2d3cf37bbdeeb95b7d88ac00000000" });
//// BX_REQUIRE_OKAY(command.invoke(output, error));
//// BX_REQUIRE_OUTPUT(TX_DECODE_EXAMPLE4);
////}

BOOST_AUTO_TEST_SUITE_END()
BOOST_AUTO_TEST_SUITE_END()
17 changes: 14 additions & 3 deletions test/commands/validate-tx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,18 @@ BOOST_AUTO_TEST_SUITE(validate_tx__invoke)
#define VALIDATE_TX_NEW_TX_BASE16 \
"0100000001b3807042c92f449bbf79b33ca59d7dfec7f4cc71096704a9c526dddf496ee097010000006a473044022039a36013301597daef41fbe593a02cc513d0b55527ec2df1050e2e8ff49c85c202201035fe810e283bcf394485c6a9dfd117ad9f684cdd83d36453718f5d0491b9dd012103c40cbd64c9c608df2c9730f49b0888c4db1c436e8b2b74aead6c6afbd10428c0ffffffff01905f0100000000001976a91418c0bd8d1818f1bf99cb1df2269c645318ef7b7388ac00000000"

BOOST_AUTO_TEST_CASE(validate_tx__invoke__mainnet_satoshis_words__failure_error)
#define VALIDATE_TX_ISSUE_477 \
"0100000001833d56a22cd88ef7a17d51d30b169a86aa4138f60867a6e21fc88a7b546b5d64010000006a4730440220688fb2aef767f21127b375d50d0ab8f7a1abaecad08e7c4987f7305c90e5a02502203282909b7863149bf4c92589764df80744afb509b949c06bfbeb28864277d88d0121025334b571c11e22967452f195509260f6a6dd10357fc4ad76b1c0aa5981ac254effffffff030000000000000000246a22414243444546917ce6520f0740cd2c373bd506415777bd23e8680123456789abcdef10270000000000001976a914ce5b06176d2572d4fb985747f197c389b8ac64e888ac30750000000000001976a9143c6602137d7f9a68a96aff2d3cf37bbdeeb95b7d88ac00000000"

BOOST_AUTO_TEST_CASE(validate_tx__invoke__mainnet_satoshis_words__failure_coinbase_transaction)
{
BX_DECLARE_CLIENT_COMMAND(validate_tx);
command.set_transaction_argument({ BX_SATOSHIS_WORDS_TX_BASE16 });
BX_REQUIRE_FAILURE(command.invoke(output, error));
BX_REQUIRE_ERROR(BX_ERROR_MESSAGE(coinbase_transaction) + "\n");
}

BOOST_AUTO_TEST_CASE(validate_tx__invoke__bad_signature_tx__failure_error)
BOOST_AUTO_TEST_CASE(validate_tx__invoke__bad_signature_tx__failure_missing_previous_output)
{
BX_DECLARE_CLIENT_COMMAND(validate_tx);
command.set_transaction_argument({ VALIDATE_TX_BAD_SIGNATURE_TX_BASE16 });
Expand All @@ -50,7 +53,7 @@ BOOST_AUTO_TEST_CASE(validate_tx__invoke__bad_signature_tx__failure_error)
BX_REQUIRE_ERROR(BX_ERROR_MESSAGE(missing_previous_output) + "\n");
}

BOOST_AUTO_TEST_CASE(validate_tx__invoke__new_tx__failure_error)
BOOST_AUTO_TEST_CASE(validate_tx__invoke__new_tx__failure_missing_previous_output)
{
BX_DECLARE_CLIENT_COMMAND(validate_tx);
command.set_transaction_argument({ VALIDATE_TX_NEW_TX_BASE16 });
Expand All @@ -62,5 +65,13 @@ BOOST_AUTO_TEST_CASE(validate_tx__invoke__new_tx__failure_error)
BX_REQUIRE_ERROR(BX_ERROR_MESSAGE(missing_previous_output) + "\n");
}

BOOST_AUTO_TEST_CASE(validate_tx__invoke__issue_477__failure_op_equal_verify2)
{
BX_DECLARE_CLIENT_COMMAND(validate_tx);
command.set_transaction_argument({ VALIDATE_TX_ISSUE_477 });
BX_REQUIRE_FAILURE(command.invoke(output, error));
BX_REQUIRE_ERROR(BX_ERROR_MESSAGE(op_equal_verify2) + "\n");
}

BOOST_AUTO_TEST_SUITE_END()
BOOST_AUTO_TEST_SUITE_END()

0 comments on commit 8c886eb

Please sign in to comment.