From 1c9424c02567cdf8313825b5e914895b212ef876 Mon Sep 17 00:00:00 2001 From: Phillip Mienk Date: Thu, 31 Oct 2019 18:09:41 -0700 Subject: [PATCH 1/2] Add compact filter client-server protcol requests. --- Makefile.am | 48 +-- builds/cmake/CMakeLists.txt | 31 +- .../libbitcoin-explorer-test.vcxproj | 14 +- .../libbitcoin-explorer-test.vcxproj.filters | 34 +- .../libbitcoin-explorer.vcxproj | 34 +- .../libbitcoin-explorer.vcxproj.filters | 62 ++-- .../libbitcoin-explorer-test.vcxproj | 14 +- .../libbitcoin-explorer-test.vcxproj.filters | 34 +- .../libbitcoin-explorer.vcxproj | 34 +- .../libbitcoin-explorer.vcxproj.filters | 62 ++-- .../libbitcoin-explorer-test.vcxproj | 14 +- .../libbitcoin-explorer-test.vcxproj.filters | 34 +- .../libbitcoin-explorer.vcxproj | 34 +- .../libbitcoin-explorer.vcxproj.filters | 62 ++-- data/bx | 17 +- include/bitcoin/explorer.hpp | 17 +- include/bitcoin/explorer/command.hpp | 2 +- .../{send-tx-p2p.hpp => broadcast-tx.hpp} | 12 +- .../commands/fetch-filter-checkpoint.hpp | 249 +++++++++++++++ .../commands/fetch-filter-headers.hpp | 295 ++++++++++++++++++ .../explorer/commands/fetch-filter.hpp | 270 ++++++++++++++++ ...int-node.hpp => get-filter-checkpoint.hpp} | 41 +-- ...eaders-node.hpp => get-filter-headers.hpp} | 43 +-- ...mpact-filters-node.hpp => get-filters.hpp} | 41 +-- ...address.hpp => match-neutrino-address.hpp} | 12 +- ...r-script.hpp => match-neutrino-script.hpp} | 12 +- .../commands/{send-tx-node.hpp => put-tx.hpp} | 14 +- include/bitcoin/explorer/generated.hpp | 17 +- model/generate.xml | 53 +++- .../{send-tx-p2p.cpp => broadcast-tx.cpp} | 4 +- src/commands/fetch-filter-checkpoint.cpp | 89 ++++++ src/commands/fetch-filter-headers.cpp | 94 ++++++ src/commands/fetch-filter.cpp | 94 ++++++ ...int-node.cpp => get-filter-checkpoint.cpp} | 14 +- ...eaders-node.cpp => get-filter-headers.cpp} | 14 +- ...mpact-filters-node.cpp => get-filters.cpp} | 14 +- ...address.cpp => match-neutrino-address.cpp} | 4 +- ...r-script.cpp => match-neutrino-script.cpp} | 4 +- src/commands/{send-tx-node.cpp => put-tx.cpp} | 4 +- src/generated.cpp | 59 ++-- .../{send-tx-p2p.cpp => broadcast-tx.cpp} | 0 ...int-node.cpp => get-filter-checkpoint.cpp} | 8 +- ...eaders-node.cpp => get-filter-headers.cpp} | 8 +- ...mpact-filters-node.cpp => get-filters.cpp} | 8 +- ...address.cpp => match-neutrino-address.cpp} | 14 +- ...r-script.cpp => match-neutrino-script.cpp} | 14 +- .../commands/{send-tx-node.cpp => put-tx.cpp} | 6 +- test/generated__find.cpp | 55 ++-- test/generated__formerly.cpp | 20 +- test/generated__symbol.cpp | 55 ++-- 50 files changed, 1665 insertions(+), 523 deletions(-) rename include/bitcoin/explorer/commands/{send-tx-p2p.hpp => broadcast-tx.hpp} (97%) create mode 100644 include/bitcoin/explorer/commands/fetch-filter-checkpoint.hpp create mode 100644 include/bitcoin/explorer/commands/fetch-filter-headers.hpp create mode 100644 include/bitcoin/explorer/commands/fetch-filter.hpp rename include/bitcoin/explorer/commands/{fetch-compact-filter-checkpoint-node.hpp => get-filter-checkpoint.hpp} (88%) rename include/bitcoin/explorer/commands/{fetch-compact-filter-headers-node.hpp => get-filter-headers.hpp} (88%) rename include/bitcoin/explorer/commands/{fetch-compact-filters-node.hpp => get-filters.hpp} (89%) rename include/bitcoin/explorer/commands/{match-neutrino-filter-address.hpp => match-neutrino-address.hpp} (95%) rename include/bitcoin/explorer/commands/{match-neutrino-filter-script.hpp => match-neutrino-script.hpp} (95%) rename include/bitcoin/explorer/commands/{send-tx-node.hpp => put-tx.hpp} (97%) rename src/commands/{send-tx-p2p.cpp => broadcast-tx.cpp} (97%) create mode 100644 src/commands/fetch-filter-checkpoint.cpp create mode 100644 src/commands/fetch-filter-headers.cpp create mode 100644 src/commands/fetch-filter.cpp rename src/commands/{fetch-compact-filter-checkpoint-node.cpp => get-filter-checkpoint.cpp} (92%) rename src/commands/{fetch-compact-filter-headers-node.cpp => get-filter-headers.cpp} (92%) rename src/commands/{fetch-compact-filters-node.cpp => get-filters.cpp} (92%) rename src/commands/{match-neutrino-filter-address.cpp => match-neutrino-address.cpp} (92%) rename src/commands/{match-neutrino-filter-script.cpp => match-neutrino-script.cpp} (92%) rename src/commands/{send-tx-node.cpp => put-tx.cpp} (97%) rename test/commands/{send-tx-p2p.cpp => broadcast-tx.cpp} (100%) rename test/commands/{fetch-compact-filter-checkpoint-node.cpp => get-filter-checkpoint.cpp} (84%) rename test/commands/{fetch-compact-filter-headers-node.cpp => get-filter-headers.cpp} (85%) rename test/commands/{fetch-compact-filters-node.cpp => get-filters.cpp} (86%) rename test/commands/{match-neutrino-filter-address.cpp => match-neutrino-address.cpp} (84%) rename test/commands/{match-neutrino-filter-script.cpp => match-neutrino-script.cpp} (85%) rename test/commands/{send-tx-node.cpp => put-tx.cpp} (91%) diff --git a/Makefile.am b/Makefile.am index f137cdffb..3caaab693 100644 --- a/Makefile.am +++ b/Makefile.am @@ -56,6 +56,7 @@ src_libbitcoin_explorer_la_SOURCES = \ src/commands/base64-encode.cpp \ src/commands/bitcoin160.cpp \ src/commands/bitcoin256.cpp \ + src/commands/broadcast-tx.cpp \ src/commands/btc-to-satoshi.cpp \ src/commands/cert-new.cpp \ src/commands/cert-public.cpp \ @@ -83,9 +84,9 @@ src_libbitcoin_explorer_la_SOURCES = \ src/commands/fetch-block-hashes.cpp \ src/commands/fetch-block-height.cpp \ src/commands/fetch-block.cpp \ - src/commands/fetch-compact-filter-checkpoint-node.cpp \ - src/commands/fetch-compact-filter-headers-node.cpp \ - src/commands/fetch-compact-filters-node.cpp \ + src/commands/fetch-filter-checkpoint.cpp \ + src/commands/fetch-filter-headers.cpp \ + src/commands/fetch-filter.cpp \ src/commands/fetch-header.cpp \ src/commands/fetch-height.cpp \ src/commands/fetch-history.cpp \ @@ -94,6 +95,9 @@ src_libbitcoin_explorer_la_SOURCES = \ src/commands/fetch-tx-index.cpp \ src/commands/fetch-tx.cpp \ src/commands/fetch-utxo.cpp \ + src/commands/get-filter-checkpoint.cpp \ + src/commands/get-filter-headers.cpp \ + src/commands/get-filters.cpp \ src/commands/hd-new.cpp \ src/commands/hd-private.cpp \ src/commands/hd-public.cpp \ @@ -105,14 +109,15 @@ src_libbitcoin_explorer_la_SOURCES = \ src/commands/input-set.cpp \ src/commands/input-sign.cpp \ src/commands/input-validate.cpp \ - src/commands/match-neutrino-filter-address.cpp \ - src/commands/match-neutrino-filter-script.cpp \ + src/commands/match-neutrino-address.cpp \ + src/commands/match-neutrino-script.cpp \ src/commands/message-sign.cpp \ src/commands/message-validate.cpp \ src/commands/mnemonic-decode.cpp \ src/commands/mnemonic-encode.cpp \ src/commands/mnemonic-new.cpp \ src/commands/mnemonic-to-seed.cpp \ + src/commands/put-tx.cpp \ src/commands/qrcode.cpp \ src/commands/ripemd160.cpp \ src/commands/satoshi-to-btc.cpp \ @@ -121,8 +126,6 @@ src_libbitcoin_explorer_la_SOURCES = \ src/commands/script-to-address.cpp \ src/commands/script-to-key.cpp \ src/commands/seed.cpp \ - src/commands/send-tx-node.cpp \ - src/commands/send-tx-p2p.cpp \ src/commands/send-tx.cpp \ src/commands/settings.cpp \ src/commands/sha160.cpp \ @@ -209,6 +212,7 @@ test_libbitcoin_explorer_test_SOURCES = \ test/commands/base64-encode.cpp \ test/commands/bitcoin160.cpp \ test/commands/bitcoin256.cpp \ + test/commands/broadcast-tx.cpp \ test/commands/btc-to-satoshi.cpp \ test/commands/cert-new.cpp \ test/commands/cert-public.cpp \ @@ -235,9 +239,6 @@ test_libbitcoin_explorer_test_SOURCES = \ test/commands/electrum-to-seed.cpp \ test/commands/fetch-balance.cpp \ test/commands/fetch-block.cpp \ - test/commands/fetch-compact-filter-checkpoint-node.cpp \ - test/commands/fetch-compact-filter-headers-node.cpp \ - test/commands/fetch-compact-filters-node.cpp \ test/commands/fetch-header.cpp \ test/commands/fetch-height.cpp \ test/commands/fetch-history.cpp \ @@ -246,6 +247,9 @@ test_libbitcoin_explorer_test_SOURCES = \ test/commands/fetch-tx-index.cpp \ test/commands/fetch-tx.cpp \ test/commands/fetch-utxo.cpp \ + test/commands/get-filter-checkpoint.cpp \ + test/commands/get-filter-headers.cpp \ + test/commands/get-filters.cpp \ test/commands/hd-new.cpp \ test/commands/hd-private.cpp \ test/commands/hd-public.cpp \ @@ -257,14 +261,15 @@ test_libbitcoin_explorer_test_SOURCES = \ test/commands/input-set.cpp \ test/commands/input-sign.cpp \ test/commands/input-validate.cpp \ - test/commands/match-neutrino-filter-address.cpp \ - test/commands/match-neutrino-filter-script.cpp \ + test/commands/match-neutrino-address.cpp \ + test/commands/match-neutrino-script.cpp \ test/commands/message-sign.cpp \ test/commands/message-validate.cpp \ test/commands/mnemonic-decode.cpp \ test/commands/mnemonic-encode.cpp \ test/commands/mnemonic-new.cpp \ test/commands/mnemonic-to-seed.cpp \ + test/commands/put-tx.cpp \ test/commands/qrcode.cpp \ test/commands/ripemd160.cpp \ test/commands/satoshi-to-btc.cpp \ @@ -273,8 +278,6 @@ test_libbitcoin_explorer_test_SOURCES = \ test/commands/script-to-address.cpp \ test/commands/script-to-key.cpp \ test/commands/seed.cpp \ - test/commands/send-tx-node.cpp \ - test/commands/send-tx-p2p.cpp \ test/commands/send-tx.cpp \ test/commands/settings.cpp \ test/commands/sha160.cpp \ @@ -341,6 +344,7 @@ include_bitcoin_explorer_commands_HEADERS = \ include/bitcoin/explorer/commands/base64-encode.hpp \ include/bitcoin/explorer/commands/bitcoin160.hpp \ include/bitcoin/explorer/commands/bitcoin256.hpp \ + include/bitcoin/explorer/commands/broadcast-tx.hpp \ include/bitcoin/explorer/commands/btc-to-satoshi.hpp \ include/bitcoin/explorer/commands/cert-new.hpp \ include/bitcoin/explorer/commands/cert-public.hpp \ @@ -368,9 +372,9 @@ include_bitcoin_explorer_commands_HEADERS = \ include/bitcoin/explorer/commands/fetch-block-hashes.hpp \ include/bitcoin/explorer/commands/fetch-block-height.hpp \ include/bitcoin/explorer/commands/fetch-block.hpp \ - include/bitcoin/explorer/commands/fetch-compact-filter-checkpoint-node.hpp \ - include/bitcoin/explorer/commands/fetch-compact-filter-headers-node.hpp \ - include/bitcoin/explorer/commands/fetch-compact-filters-node.hpp \ + include/bitcoin/explorer/commands/fetch-filter-checkpoint.hpp \ + include/bitcoin/explorer/commands/fetch-filter-headers.hpp \ + include/bitcoin/explorer/commands/fetch-filter.hpp \ include/bitcoin/explorer/commands/fetch-header.hpp \ include/bitcoin/explorer/commands/fetch-height.hpp \ include/bitcoin/explorer/commands/fetch-history.hpp \ @@ -379,6 +383,9 @@ include_bitcoin_explorer_commands_HEADERS = \ include/bitcoin/explorer/commands/fetch-tx-index.hpp \ include/bitcoin/explorer/commands/fetch-tx.hpp \ include/bitcoin/explorer/commands/fetch-utxo.hpp \ + include/bitcoin/explorer/commands/get-filter-checkpoint.hpp \ + include/bitcoin/explorer/commands/get-filter-headers.hpp \ + include/bitcoin/explorer/commands/get-filters.hpp \ include/bitcoin/explorer/commands/hd-new.hpp \ include/bitcoin/explorer/commands/hd-private.hpp \ include/bitcoin/explorer/commands/hd-public.hpp \ @@ -390,14 +397,15 @@ include_bitcoin_explorer_commands_HEADERS = \ include/bitcoin/explorer/commands/input-set.hpp \ include/bitcoin/explorer/commands/input-sign.hpp \ include/bitcoin/explorer/commands/input-validate.hpp \ - include/bitcoin/explorer/commands/match-neutrino-filter-address.hpp \ - include/bitcoin/explorer/commands/match-neutrino-filter-script.hpp \ + include/bitcoin/explorer/commands/match-neutrino-address.hpp \ + include/bitcoin/explorer/commands/match-neutrino-script.hpp \ include/bitcoin/explorer/commands/message-sign.hpp \ include/bitcoin/explorer/commands/message-validate.hpp \ include/bitcoin/explorer/commands/mnemonic-decode.hpp \ include/bitcoin/explorer/commands/mnemonic-encode.hpp \ include/bitcoin/explorer/commands/mnemonic-new.hpp \ include/bitcoin/explorer/commands/mnemonic-to-seed.hpp \ + include/bitcoin/explorer/commands/put-tx.hpp \ include/bitcoin/explorer/commands/qrcode.hpp \ include/bitcoin/explorer/commands/ripemd160.hpp \ include/bitcoin/explorer/commands/satoshi-to-btc.hpp \ @@ -406,8 +414,6 @@ include_bitcoin_explorer_commands_HEADERS = \ include/bitcoin/explorer/commands/script-to-address.hpp \ include/bitcoin/explorer/commands/script-to-key.hpp \ include/bitcoin/explorer/commands/seed.hpp \ - include/bitcoin/explorer/commands/send-tx-node.hpp \ - include/bitcoin/explorer/commands/send-tx-p2p.hpp \ include/bitcoin/explorer/commands/send-tx.hpp \ include/bitcoin/explorer/commands/settings.hpp \ include/bitcoin/explorer/commands/sha160.hpp \ diff --git a/builds/cmake/CMakeLists.txt b/builds/cmake/CMakeLists.txt index 97274094b..6141f86ab 100644 --- a/builds/cmake/CMakeLists.txt +++ b/builds/cmake/CMakeLists.txt @@ -207,6 +207,7 @@ add_library( ${CANONICAL_LIB_NAME} "../../src/commands/base64-encode.cpp" "../../src/commands/bitcoin160.cpp" "../../src/commands/bitcoin256.cpp" + "../../src/commands/broadcast-tx.cpp" "../../src/commands/btc-to-satoshi.cpp" "../../src/commands/cert-new.cpp" "../../src/commands/cert-public.cpp" @@ -234,9 +235,9 @@ add_library( ${CANONICAL_LIB_NAME} "../../src/commands/fetch-block-hashes.cpp" "../../src/commands/fetch-block-height.cpp" "../../src/commands/fetch-block.cpp" - "../../src/commands/fetch-compact-filter-checkpoint-node.cpp" - "../../src/commands/fetch-compact-filter-headers-node.cpp" - "../../src/commands/fetch-compact-filters-node.cpp" + "../../src/commands/fetch-filter-checkpoint.cpp" + "../../src/commands/fetch-filter-headers.cpp" + "../../src/commands/fetch-filter.cpp" "../../src/commands/fetch-header.cpp" "../../src/commands/fetch-height.cpp" "../../src/commands/fetch-history.cpp" @@ -245,6 +246,9 @@ add_library( ${CANONICAL_LIB_NAME} "../../src/commands/fetch-tx-index.cpp" "../../src/commands/fetch-tx.cpp" "../../src/commands/fetch-utxo.cpp" + "../../src/commands/get-filter-checkpoint.cpp" + "../../src/commands/get-filter-headers.cpp" + "../../src/commands/get-filters.cpp" "../../src/commands/hd-new.cpp" "../../src/commands/hd-private.cpp" "../../src/commands/hd-public.cpp" @@ -256,14 +260,15 @@ add_library( ${CANONICAL_LIB_NAME} "../../src/commands/input-set.cpp" "../../src/commands/input-sign.cpp" "../../src/commands/input-validate.cpp" - "../../src/commands/match-neutrino-filter-address.cpp" - "../../src/commands/match-neutrino-filter-script.cpp" + "../../src/commands/match-neutrino-address.cpp" + "../../src/commands/match-neutrino-script.cpp" "../../src/commands/message-sign.cpp" "../../src/commands/message-validate.cpp" "../../src/commands/mnemonic-decode.cpp" "../../src/commands/mnemonic-encode.cpp" "../../src/commands/mnemonic-new.cpp" "../../src/commands/mnemonic-to-seed.cpp" + "../../src/commands/put-tx.cpp" "../../src/commands/qrcode.cpp" "../../src/commands/ripemd160.cpp" "../../src/commands/satoshi-to-btc.cpp" @@ -272,8 +277,6 @@ add_library( ${CANONICAL_LIB_NAME} "../../src/commands/script-to-address.cpp" "../../src/commands/script-to-key.cpp" "../../src/commands/seed.cpp" - "../../src/commands/send-tx-node.cpp" - "../../src/commands/send-tx-p2p.cpp" "../../src/commands/send-tx.cpp" "../../src/commands/settings.cpp" "../../src/commands/sha160.cpp" @@ -394,6 +397,7 @@ if (with-tests) "../../test/commands/base64-encode.cpp" "../../test/commands/bitcoin160.cpp" "../../test/commands/bitcoin256.cpp" + "../../test/commands/broadcast-tx.cpp" "../../test/commands/btc-to-satoshi.cpp" "../../test/commands/cert-new.cpp" "../../test/commands/cert-public.cpp" @@ -420,9 +424,6 @@ if (with-tests) "../../test/commands/electrum-to-seed.cpp" "../../test/commands/fetch-balance.cpp" "../../test/commands/fetch-block.cpp" - "../../test/commands/fetch-compact-filter-checkpoint-node.cpp" - "../../test/commands/fetch-compact-filter-headers-node.cpp" - "../../test/commands/fetch-compact-filters-node.cpp" "../../test/commands/fetch-header.cpp" "../../test/commands/fetch-height.cpp" "../../test/commands/fetch-history.cpp" @@ -431,6 +432,9 @@ if (with-tests) "../../test/commands/fetch-tx-index.cpp" "../../test/commands/fetch-tx.cpp" "../../test/commands/fetch-utxo.cpp" + "../../test/commands/get-filter-checkpoint.cpp" + "../../test/commands/get-filter-headers.cpp" + "../../test/commands/get-filters.cpp" "../../test/commands/hd-new.cpp" "../../test/commands/hd-private.cpp" "../../test/commands/hd-public.cpp" @@ -442,14 +446,15 @@ if (with-tests) "../../test/commands/input-set.cpp" "../../test/commands/input-sign.cpp" "../../test/commands/input-validate.cpp" - "../../test/commands/match-neutrino-filter-address.cpp" - "../../test/commands/match-neutrino-filter-script.cpp" + "../../test/commands/match-neutrino-address.cpp" + "../../test/commands/match-neutrino-script.cpp" "../../test/commands/message-sign.cpp" "../../test/commands/message-validate.cpp" "../../test/commands/mnemonic-decode.cpp" "../../test/commands/mnemonic-encode.cpp" "../../test/commands/mnemonic-new.cpp" "../../test/commands/mnemonic-to-seed.cpp" + "../../test/commands/put-tx.cpp" "../../test/commands/qrcode.cpp" "../../test/commands/ripemd160.cpp" "../../test/commands/satoshi-to-btc.cpp" @@ -458,8 +463,6 @@ if (with-tests) "../../test/commands/script-to-address.cpp" "../../test/commands/script-to-key.cpp" "../../test/commands/seed.cpp" - "../../test/commands/send-tx-node.cpp" - "../../test/commands/send-tx-p2p.cpp" "../../test/commands/send-tx.cpp" "../../test/commands/settings.cpp" "../../test/commands/sha160.cpp" 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 c4fb96907..167ab94e1 100644 --- a/builds/msvc/vs2013/libbitcoin-explorer-test/libbitcoin-explorer-test.vcxproj +++ b/builds/msvc/vs2013/libbitcoin-explorer-test/libbitcoin-explorer-test.vcxproj @@ -84,6 +84,7 @@ + @@ -109,9 +110,6 @@ - - - @@ -120,6 +118,9 @@ + + + @@ -131,14 +132,15 @@ - - + + + @@ -147,8 +149,6 @@ - - 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 ff079e088..52271ccb2 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 @@ -60,6 +60,9 @@ src\commands + + src\commands + src\commands @@ -135,15 +138,6 @@ src\commands - - src\commands - - - src\commands - - - src\commands - src\commands @@ -168,6 +162,15 @@ src\commands + + src\commands + + + src\commands + + + src\commands + src\commands @@ -201,10 +204,10 @@ src\commands - + src\commands - + src\commands @@ -225,6 +228,9 @@ src\commands + + src\commands + src\commands @@ -249,12 +255,6 @@ src\commands - - 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 8fa89bfb6..9310fbccc 100644 --- a/builds/msvc/vs2013/libbitcoin-explorer/libbitcoin-explorer.vcxproj +++ b/builds/msvc/vs2013/libbitcoin-explorer/libbitcoin-explorer.vcxproj @@ -88,6 +88,7 @@ + @@ -115,9 +116,9 @@ - - - + + + @@ -126,6 +127,9 @@ + + + @@ -137,14 +141,15 @@ - - + + + @@ -153,8 +158,6 @@ - - @@ -224,6 +227,7 @@ + @@ -251,9 +255,9 @@ - - - + + + @@ -262,6 +266,9 @@ + + + @@ -273,14 +280,15 @@ - - + + + @@ -289,8 +297,6 @@ - - diff --git a/builds/msvc/vs2013/libbitcoin-explorer/libbitcoin-explorer.vcxproj.filters b/builds/msvc/vs2013/libbitcoin-explorer/libbitcoin-explorer.vcxproj.filters index 7b788c870..4ae6e4e93 100644 --- a/builds/msvc/vs2013/libbitcoin-explorer/libbitcoin-explorer.vcxproj.filters +++ b/builds/msvc/vs2013/libbitcoin-explorer/libbitcoin-explorer.vcxproj.filters @@ -84,6 +84,9 @@ src\commands + + src\commands + src\commands @@ -165,13 +168,13 @@ src\commands - + src\commands - + src\commands - + src\commands @@ -198,6 +201,15 @@ src\commands + + src\commands + + + src\commands + + + src\commands + src\commands @@ -231,10 +243,10 @@ src\commands - + src\commands - + src\commands @@ -255,6 +267,9 @@ src\commands + + src\commands + src\commands @@ -279,12 +294,6 @@ src\commands - - src\commands - - - src\commands - src\commands @@ -488,6 +497,9 @@ include\bitcoin\explorer\commands + + include\bitcoin\explorer\commands + include\bitcoin\explorer\commands @@ -569,13 +581,13 @@ include\bitcoin\explorer\commands - + include\bitcoin\explorer\commands - + include\bitcoin\explorer\commands - + include\bitcoin\explorer\commands @@ -602,6 +614,15 @@ include\bitcoin\explorer\commands + + include\bitcoin\explorer\commands + + + include\bitcoin\explorer\commands + + + include\bitcoin\explorer\commands + include\bitcoin\explorer\commands @@ -635,10 +656,10 @@ include\bitcoin\explorer\commands - + include\bitcoin\explorer\commands - + include\bitcoin\explorer\commands @@ -659,6 +680,9 @@ include\bitcoin\explorer\commands + + include\bitcoin\explorer\commands + include\bitcoin\explorer\commands @@ -683,12 +707,6 @@ include\bitcoin\explorer\commands - - 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 76f480364..5ebb65b89 100644 --- a/builds/msvc/vs2015/libbitcoin-explorer-test/libbitcoin-explorer-test.vcxproj +++ b/builds/msvc/vs2015/libbitcoin-explorer-test/libbitcoin-explorer-test.vcxproj @@ -84,6 +84,7 @@ + @@ -109,9 +110,6 @@ - - - @@ -120,6 +118,9 @@ + + + @@ -131,14 +132,15 @@ - - + + + @@ -147,8 +149,6 @@ - - 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 ff079e088..52271ccb2 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 @@ -60,6 +60,9 @@ src\commands + + src\commands + src\commands @@ -135,15 +138,6 @@ src\commands - - src\commands - - - src\commands - - - src\commands - src\commands @@ -168,6 +162,15 @@ src\commands + + src\commands + + + src\commands + + + src\commands + src\commands @@ -201,10 +204,10 @@ src\commands - + src\commands - + src\commands @@ -225,6 +228,9 @@ src\commands + + src\commands + src\commands @@ -249,12 +255,6 @@ src\commands - - 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 30ef0345d..8d1971879 100644 --- a/builds/msvc/vs2015/libbitcoin-explorer/libbitcoin-explorer.vcxproj +++ b/builds/msvc/vs2015/libbitcoin-explorer/libbitcoin-explorer.vcxproj @@ -88,6 +88,7 @@ + @@ -115,9 +116,9 @@ - - - + + + @@ -126,6 +127,9 @@ + + + @@ -137,14 +141,15 @@ - - + + + @@ -153,8 +158,6 @@ - - @@ -224,6 +227,7 @@ + @@ -251,9 +255,9 @@ - - - + + + @@ -262,6 +266,9 @@ + + + @@ -273,14 +280,15 @@ - - + + + @@ -289,8 +297,6 @@ - - diff --git a/builds/msvc/vs2015/libbitcoin-explorer/libbitcoin-explorer.vcxproj.filters b/builds/msvc/vs2015/libbitcoin-explorer/libbitcoin-explorer.vcxproj.filters index e6f06f6f3..a5b9dad94 100644 --- a/builds/msvc/vs2015/libbitcoin-explorer/libbitcoin-explorer.vcxproj.filters +++ b/builds/msvc/vs2015/libbitcoin-explorer/libbitcoin-explorer.vcxproj.filters @@ -84,6 +84,9 @@ src\commands + + src\commands + src\commands @@ -165,13 +168,13 @@ src\commands - + src\commands - + src\commands - + src\commands @@ -198,6 +201,15 @@ src\commands + + src\commands + + + src\commands + + + src\commands + src\commands @@ -231,10 +243,10 @@ src\commands - + src\commands - + src\commands @@ -255,6 +267,9 @@ src\commands + + src\commands + src\commands @@ -279,12 +294,6 @@ src\commands - - src\commands - - - src\commands - src\commands @@ -488,6 +497,9 @@ include\bitcoin\explorer\commands + + include\bitcoin\explorer\commands + include\bitcoin\explorer\commands @@ -569,13 +581,13 @@ include\bitcoin\explorer\commands - + include\bitcoin\explorer\commands - + include\bitcoin\explorer\commands - + include\bitcoin\explorer\commands @@ -602,6 +614,15 @@ include\bitcoin\explorer\commands + + include\bitcoin\explorer\commands + + + include\bitcoin\explorer\commands + + + include\bitcoin\explorer\commands + include\bitcoin\explorer\commands @@ -635,10 +656,10 @@ include\bitcoin\explorer\commands - + include\bitcoin\explorer\commands - + include\bitcoin\explorer\commands @@ -659,6 +680,9 @@ include\bitcoin\explorer\commands + + include\bitcoin\explorer\commands + include\bitcoin\explorer\commands @@ -683,12 +707,6 @@ include\bitcoin\explorer\commands - - 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 faf7c4c89..5bad0456d 100644 --- a/builds/msvc/vs2017/libbitcoin-explorer-test/libbitcoin-explorer-test.vcxproj +++ b/builds/msvc/vs2017/libbitcoin-explorer-test/libbitcoin-explorer-test.vcxproj @@ -84,6 +84,7 @@ + @@ -109,9 +110,6 @@ - - - @@ -120,6 +118,9 @@ + + + @@ -131,14 +132,15 @@ - - + + + @@ -147,8 +149,6 @@ - - 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 ff079e088..52271ccb2 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 @@ -60,6 +60,9 @@ src\commands + + src\commands + src\commands @@ -135,15 +138,6 @@ src\commands - - src\commands - - - src\commands - - - src\commands - src\commands @@ -168,6 +162,15 @@ src\commands + + src\commands + + + src\commands + + + src\commands + src\commands @@ -201,10 +204,10 @@ src\commands - + src\commands - + src\commands @@ -225,6 +228,9 @@ src\commands + + src\commands + src\commands @@ -249,12 +255,6 @@ src\commands - - 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 56e738e05..30e9c59ce 100644 --- a/builds/msvc/vs2017/libbitcoin-explorer/libbitcoin-explorer.vcxproj +++ b/builds/msvc/vs2017/libbitcoin-explorer/libbitcoin-explorer.vcxproj @@ -88,6 +88,7 @@ + @@ -115,9 +116,9 @@ - - - + + + @@ -126,6 +127,9 @@ + + + @@ -137,14 +141,15 @@ - - + + + @@ -153,8 +158,6 @@ - - @@ -224,6 +227,7 @@ + @@ -251,9 +255,9 @@ - - - + + + @@ -262,6 +266,9 @@ + + + @@ -273,14 +280,15 @@ - - + + + @@ -289,8 +297,6 @@ - - diff --git a/builds/msvc/vs2017/libbitcoin-explorer/libbitcoin-explorer.vcxproj.filters b/builds/msvc/vs2017/libbitcoin-explorer/libbitcoin-explorer.vcxproj.filters index afbcbe87a..7a0c4ed37 100644 --- a/builds/msvc/vs2017/libbitcoin-explorer/libbitcoin-explorer.vcxproj.filters +++ b/builds/msvc/vs2017/libbitcoin-explorer/libbitcoin-explorer.vcxproj.filters @@ -84,6 +84,9 @@ src\commands + + src\commands + src\commands @@ -165,13 +168,13 @@ src\commands - + src\commands - + src\commands - + src\commands @@ -198,6 +201,15 @@ src\commands + + src\commands + + + src\commands + + + src\commands + src\commands @@ -231,10 +243,10 @@ src\commands - + src\commands - + src\commands @@ -255,6 +267,9 @@ src\commands + + src\commands + src\commands @@ -279,12 +294,6 @@ src\commands - - src\commands - - - src\commands - src\commands @@ -488,6 +497,9 @@ include\bitcoin\explorer\commands + + include\bitcoin\explorer\commands + include\bitcoin\explorer\commands @@ -569,13 +581,13 @@ include\bitcoin\explorer\commands - + include\bitcoin\explorer\commands - + include\bitcoin\explorer\commands - + include\bitcoin\explorer\commands @@ -602,6 +614,15 @@ include\bitcoin\explorer\commands + + include\bitcoin\explorer\commands + + + include\bitcoin\explorer\commands + + + include\bitcoin\explorer\commands + include\bitcoin\explorer\commands @@ -635,10 +656,10 @@ include\bitcoin\explorer\commands - + include\bitcoin\explorer\commands - + include\bitcoin\explorer\commands @@ -659,6 +680,9 @@ include\bitcoin\explorer\commands + + include\bitcoin\explorer\commands + include\bitcoin\explorer\commands @@ -683,12 +707,6 @@ include\bitcoin\explorer\commands - - include\bitcoin\explorer\commands - - - include\bitcoin\explorer\commands - include\bitcoin\explorer\commands diff --git a/data/bx b/data/bx index 3c5e0c500..8ba320cb9 100644 --- a/data/bx +++ b/data/bx @@ -21,6 +21,7 @@ _bx() base64-encode bitcoin160 bitcoin256 + broadcast-tx btc-to-satoshi cert-new cert-public @@ -48,9 +49,9 @@ _bx() fetch-block fetch-block-hashes fetch-block-height - fetch-compact-filter-checkpoint-node - fetch-compact-filter-headers-node - fetch-compact-filters-node + fetch-filter + fetch-filter-checkpoint + fetch-filter-headers fetch-header fetch-height fetch-history @@ -59,6 +60,9 @@ _bx() fetch-tx fetch-tx-index fetch-utxo + get-filter-checkpoint + get-filter-headers + get-filters hd-new hd-private hd-public @@ -68,12 +72,13 @@ _bx() input-set input-sign input-validate - match-neutrino-filter-address - match-neutrino-filter-script + match-neutrino-address + match-neutrino-script message-sign message-validate mnemonic-new mnemonic-to-seed + put-tx qrcode ripemd160 satoshi-to-btc @@ -83,8 +88,6 @@ _bx() script-to-key seed send-tx - send-tx-node - send-tx-p2p settings sha160 sha256 diff --git a/include/bitcoin/explorer.hpp b/include/bitcoin/explorer.hpp index 0bb5546f1..78892dde5 100644 --- a/include/bitcoin/explorer.hpp +++ b/include/bitcoin/explorer.hpp @@ -40,6 +40,7 @@ #include #include #include +#include #include #include #include @@ -67,9 +68,9 @@ #include #include #include -#include -#include -#include +#include +#include +#include #include #include #include @@ -78,6 +79,9 @@ #include #include #include +#include +#include +#include #include #include #include @@ -89,14 +93,15 @@ #include #include #include -#include -#include +#include +#include #include #include #include #include #include #include +#include #include #include #include @@ -105,8 +110,6 @@ #include #include #include -#include -#include #include #include #include diff --git a/include/bitcoin/explorer/command.hpp b/include/bitcoin/explorer/command.hpp index 69841ab9c..665580110 100644 --- a/include/bitcoin/explorer/command.hpp +++ b/include/bitcoin/explorer/command.hpp @@ -267,7 +267,7 @@ class BCX_API command ) ( "server.url", - value(&setting_.server.url)->default_value({ "tcp://mainnet.libbitcoin.net:9091" }), + value(&setting_.server.url)->default_value({ "tcp://127.0.0.1:9091" }), "The URL of the Libbitcoin query service." ) ( diff --git a/include/bitcoin/explorer/commands/send-tx-p2p.hpp b/include/bitcoin/explorer/commands/broadcast-tx.hpp similarity index 97% rename from include/bitcoin/explorer/commands/send-tx-p2p.hpp rename to include/bitcoin/explorer/commands/broadcast-tx.hpp index a7c4de699..08cd1cc73 100644 --- a/include/bitcoin/explorer/commands/send-tx-p2p.hpp +++ b/include/bitcoin/explorer/commands/broadcast-tx.hpp @@ -16,8 +16,8 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -#ifndef BX_SEND_TX_P2P_HPP -#define BX_SEND_TX_P2P_HPP +#ifndef BX_BROADCAST_TX_HPP +#define BX_BROADCAST_TX_HPP #include #include @@ -59,9 +59,9 @@ namespace commands { "Sent transaction." /** - * Class to implement the send-tx-p2p command. + * Class to implement the broadcast-tx command. */ -class BCX_API send_tx_p2p +class BCX_API broadcast_tx : public command { public: @@ -71,7 +71,7 @@ class BCX_API send_tx_p2p */ static const char* symbol() { - return "send-tx-p2p"; + return "broadcast-tx"; } /** @@ -87,7 +87,7 @@ class BCX_API send_tx_p2p */ virtual const char* name() { - return send_tx_p2p::symbol(); + return broadcast_tx::symbol(); } /** diff --git a/include/bitcoin/explorer/commands/fetch-filter-checkpoint.hpp b/include/bitcoin/explorer/commands/fetch-filter-checkpoint.hpp new file mode 100644 index 000000000..292c47518 --- /dev/null +++ b/include/bitcoin/explorer/commands/fetch-filter-checkpoint.hpp @@ -0,0 +1,249 @@ +/** + * Copyright (c) 2011-2019 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_FILTER_CHECKPOINT_HPP +#define BX_FETCH_FILTER_CHECKPOINT_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 +#include + +/********* GENERATED SOURCE CODE, DO NOT EDIT EXCEPT EXPERIMENTALLY **********/ + +namespace libbitcoin { +namespace explorer { +namespace commands { + +/** + * Various localizable strings. + */ +#define BX_BIP157_UNSUPPORTED \ + "The peer does not indicate support for BIP157." + +/** + * Class to implement the fetch-filter-checkpoint command. + */ +class BCX_API fetch_filter_checkpoint + : public command +{ +public: + + /** + * The symbolic (not localizable) command name, lower case. + */ + static const char* symbol() + { + return "fetch-filter-checkpoint"; + } + + + /** + * The member symbolic (not localizable) command name, lower case. + */ + virtual const char* name() + { + return fetch_filter_checkpoint::symbol(); + } + + /** + * The localizable command category name, upper case. + */ + virtual const char* category() + { + return "ONLINE"; + } + + /** + * The localizable command description. + */ + virtual const char* description() + { + return "Retrieve compact filter checkpoint via a Libbitcoin server."; + } + + /** + * Load program argument definitions. + * A value of -1 indicates that the number of instances is unlimited. + * @return The loaded program argument definitions. + */ + virtual system::arguments_metadata& load_arguments() + { + return get_argument_metadata() + .add("hash", 1); + } + + /** + * 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) + { + const auto raw = requires_raw_input(); + load_input(get_hash_argument(), "hash", variables, input, raw); + } + + /** + * Load program option definitions. + * BUGBUG: see boost bug/fix: svn.boost.org/trac/boost/ticket/8009 + * @return The loaded program option definitions. + */ + virtual system::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", + value(&argument_.hash), + "The Base16 block hash. If not specified the hash is read from STDIN." + ); + + 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 system::console_result invoke(std::ostream& output, + std::ostream& cerr); + + /* Properties */ + + /** + * Get the value of the hash argument. + */ + virtual system::config::hash256& get_hash_argument() + { + return argument_.hash; + } + + /** + * Set the value of the hash argument. + */ + virtual void set_hash_argument( + const system::config::hash256& value) + { + argument_.hash = value; + } + + /** + * 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; + } + +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() + : hash() + { + } + + system::config::hash256 hash; + } 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() + { + } + + explorer::config::encoding format; + } option_; +}; + +} // namespace commands +} // namespace explorer +} // namespace libbitcoin + +#endif diff --git a/include/bitcoin/explorer/commands/fetch-filter-headers.hpp b/include/bitcoin/explorer/commands/fetch-filter-headers.hpp new file mode 100644 index 000000000..9410d8dda --- /dev/null +++ b/include/bitcoin/explorer/commands/fetch-filter-headers.hpp @@ -0,0 +1,295 @@ +/** + * Copyright (c) 2011-2019 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_FILTER_HEADERS_HPP +#define BX_FETCH_FILTER_HEADERS_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 +#include + +/********* GENERATED SOURCE CODE, DO NOT EDIT EXCEPT EXPERIMENTALLY **********/ + +namespace libbitcoin { +namespace explorer { +namespace commands { + +/** + * Various localizable strings. + */ +#define BX_BIP157_UNSUPPORTED \ + "The peer does not indicate support for BIP157." + +/** + * Class to implement the fetch-filter-headers command. + */ +class BCX_API fetch_filter_headers + : public command +{ +public: + + /** + * The symbolic (not localizable) command name, lower case. + */ + static const char* symbol() + { + return "fetch-filter-headers"; + } + + + /** + * The member symbolic (not localizable) command name, lower case. + */ + virtual const char* name() + { + return fetch_filter_headers::symbol(); + } + + /** + * The localizable command category name, upper case. + */ + virtual const char* category() + { + return "ONLINE"; + } + + /** + * The localizable command description. + */ + virtual const char* description() + { + return "Retrieve compact filter headers via a Libbitcoin server. The distance between provided height and hash must be strictly less than 2000."; + } + + /** + * Load program argument definitions. + * A value of -1 indicates that the number of instances is unlimited. + * @return The loaded program argument definitions. + */ + virtual system::arguments_metadata& load_arguments() + { + return get_argument_metadata() + .add("start_height", 1); + } + + /** + * 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 system::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'." + ) + ( + "stop_hash,s", + value(&option_.stop_hash), + "The Base16 stop block hash." + ) + ( + "stop_height,t", + value(&option_.stop_height), + "The stop block height." + ) + ( + "start_height", + value(&argument_.start_height), + "The starting 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 system::console_result invoke(std::ostream& output, + std::ostream& cerr); + + /* Properties */ + + /** + * Get the value of the start_height argument. + */ + virtual uint32_t& get_start_height_argument() + { + return argument_.start_height; + } + + /** + * Set the value of the start_height argument. + */ + virtual void set_start_height_argument( + const uint32_t& value) + { + argument_.start_height = value; + } + + /** + * 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 stop_hash option. + */ + virtual system::config::hash256& get_stop_hash_option() + { + return option_.stop_hash; + } + + /** + * Set the value of the stop_hash option. + */ + virtual void set_stop_hash_option( + const system::config::hash256& value) + { + option_.stop_hash = value; + } + + /** + * Get the value of the stop_height option. + */ + virtual uint32_t& get_stop_height_option() + { + return option_.stop_height; + } + + /** + * Set the value of the stop_height option. + */ + virtual void set_stop_height_option( + const uint32_t& value) + { + option_.stop_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() + : start_height() + { + } + + uint32_t start_height; + } 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(), + stop_hash(), + stop_height() + { + } + + explorer::config::encoding format; + system::config::hash256 stop_hash; + uint32_t stop_height; + } option_; +}; + +} // namespace commands +} // namespace explorer +} // namespace libbitcoin + +#endif diff --git a/include/bitcoin/explorer/commands/fetch-filter.hpp b/include/bitcoin/explorer/commands/fetch-filter.hpp new file mode 100644 index 000000000..1b3aa85ed --- /dev/null +++ b/include/bitcoin/explorer/commands/fetch-filter.hpp @@ -0,0 +1,270 @@ +/** + * Copyright (c) 2011-2019 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_FILTER_HPP +#define BX_FETCH_FILTER_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 +#include + +/********* GENERATED SOURCE CODE, DO NOT EDIT EXCEPT EXPERIMENTALLY **********/ + +namespace libbitcoin { +namespace explorer { +namespace commands { + +/** + * Various localizable strings. + */ +#define BX_BIP157_UNSUPPORTED \ + "The peer does not indicate support for BIP157." + +/** + * Class to implement the fetch-filter command. + */ +class BCX_API fetch_filter + : public command +{ +public: + + /** + * The symbolic (not localizable) command name, lower case. + */ + static const char* symbol() + { + return "fetch-filter"; + } + + + /** + * The member symbolic (not localizable) command name, lower case. + */ + virtual const char* name() + { + return fetch_filter::symbol(); + } + + /** + * The localizable command category name, upper case. + */ + virtual const char* category() + { + return "ONLINE"; + } + + /** + * The localizable command description. + */ + virtual const char* description() + { + return "Retrieve compact filters via a Libbitcoin server."; + } + + /** + * Load program argument definitions. + * A value of -1 indicates that the number of instances is unlimited. + * @return The loaded program argument definitions. + */ + virtual system::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 system::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 system::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 system::config::hash256& get_hash_option() + { + return option_.hash; + } + + /** + * Set the value of the hash option. + */ + virtual void set_hash_option( + const system::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; + system::config::hash256 hash; + uint32_t height; + } option_; +}; + +} // namespace commands +} // namespace explorer +} // namespace libbitcoin + +#endif diff --git a/include/bitcoin/explorer/commands/fetch-compact-filter-checkpoint-node.hpp b/include/bitcoin/explorer/commands/get-filter-checkpoint.hpp similarity index 88% rename from include/bitcoin/explorer/commands/fetch-compact-filter-checkpoint-node.hpp rename to include/bitcoin/explorer/commands/get-filter-checkpoint.hpp index 6cfdb5659..bd681d8b5 100644 --- a/include/bitcoin/explorer/commands/fetch-compact-filter-checkpoint-node.hpp +++ b/include/bitcoin/explorer/commands/get-filter-checkpoint.hpp @@ -16,8 +16,8 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -#ifndef BX_FETCH_COMPACT_FILTER_CHECKPOINT_NODE_HPP -#define BX_FETCH_COMPACT_FILTER_CHECKPOINT_NODE_HPP +#ifndef BX_GET_FILTER_CHECKPOINT_HPP +#define BX_GET_FILTER_CHECKPOINT_HPP #include #include @@ -57,13 +57,11 @@ namespace commands { */ #define BX_BIP157_UNSUPPORTED \ "The peer does not indicate support for BIP157." -#define BX_INVALID_FILTER_TYPE \ - "The provided filter type exceeds encodable limits." /** - * Class to implement the fetch-compact-filter-checkpoint-node command. + * Class to implement the get-filter-checkpoint command. */ -class BCX_API fetch_compact_filter_checkpoint_node +class BCX_API get_filter_checkpoint : public command { public: @@ -73,7 +71,7 @@ class BCX_API fetch_compact_filter_checkpoint_node */ static const char* symbol() { - return "fetch-compact-filter-checkpoint-node"; + return "get-filter-checkpoint"; } @@ -82,7 +80,7 @@ class BCX_API fetch_compact_filter_checkpoint_node */ virtual const char* name() { - return fetch_compact_filter_checkpoint_node::symbol(); + return get_filter_checkpoint::symbol(); } /** @@ -109,7 +107,6 @@ class BCX_API fetch_compact_filter_checkpoint_node virtual system::arguments_metadata& load_arguments() { return get_argument_metadata() - .add("filter_type", 1) .add("hash", 1); } @@ -160,11 +157,6 @@ class BCX_API fetch_compact_filter_checkpoint_node value(&option_.port)->default_value(8333), "The IP port of the Bitcoin service on the node. Defaults to 8333, the standard for mainnet." ) - ( - "filter_type", - value(&argument_.filter_type), - "The compact filter type." - ) ( "hash", value(&argument_.hash), @@ -193,23 +185,6 @@ class BCX_API fetch_compact_filter_checkpoint_node /* Properties */ - /** - * Get the value of the filter_type argument. - */ - virtual uint16_t& get_filter_type_argument() - { - return argument_.filter_type; - } - - /** - * Set the value of the filter_type argument. - */ - virtual void set_filter_type_argument( - const uint16_t& value) - { - argument_.filter_type = value; - } - /** * Get the value of the hash argument. */ @@ -288,12 +263,10 @@ class BCX_API fetch_compact_filter_checkpoint_node struct argument { argument() - : filter_type(), - hash() + : hash() { } - uint16_t filter_type; system::config::hash256 hash; } argument_; diff --git a/include/bitcoin/explorer/commands/fetch-compact-filter-headers-node.hpp b/include/bitcoin/explorer/commands/get-filter-headers.hpp similarity index 88% rename from include/bitcoin/explorer/commands/fetch-compact-filter-headers-node.hpp rename to include/bitcoin/explorer/commands/get-filter-headers.hpp index 9ffb76107..6a32608a6 100644 --- a/include/bitcoin/explorer/commands/fetch-compact-filter-headers-node.hpp +++ b/include/bitcoin/explorer/commands/get-filter-headers.hpp @@ -16,8 +16,8 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -#ifndef BX_FETCH_COMPACT_FILTER_HEADERS_NODE_HPP -#define BX_FETCH_COMPACT_FILTER_HEADERS_NODE_HPP +#ifndef BX_GET_FILTER_HEADERS_HPP +#define BX_GET_FILTER_HEADERS_HPP #include #include @@ -57,13 +57,11 @@ namespace commands { */ #define BX_BIP157_UNSUPPORTED \ "The peer does not indicate support for BIP157." -#define BX_INVALID_FILTER_TYPE \ - "The provided filter type exceeds encodable limits." /** - * Class to implement the fetch-compact-filter-headers-node command. + * Class to implement the get-filter-headers command. */ -class BCX_API fetch_compact_filter_headers_node +class BCX_API get_filter_headers : public command { public: @@ -73,7 +71,7 @@ class BCX_API fetch_compact_filter_headers_node */ static const char* symbol() { - return "fetch-compact-filter-headers-node"; + return "get-filter-headers"; } @@ -82,7 +80,7 @@ class BCX_API fetch_compact_filter_headers_node */ virtual const char* name() { - return fetch_compact_filter_headers_node::symbol(); + return get_filter_headers::symbol(); } /** @@ -98,7 +96,7 @@ class BCX_API fetch_compact_filter_headers_node */ virtual const char* description() { - return "Retrieve compact filter headers via a single Bitcoin network node. The distance between provided height and hash must be strictly less than 2000.."; + return "Retrieve compact filter headers via a single Bitcoin network node. The distance between provided height and hash must be strictly less than 2000."; } /** @@ -109,7 +107,6 @@ class BCX_API fetch_compact_filter_headers_node virtual system::arguments_metadata& load_arguments() { return get_argument_metadata() - .add("filter_type", 1) .add("height", 1) .add("hash", 1); } @@ -161,11 +158,6 @@ class BCX_API fetch_compact_filter_headers_node value(&option_.port)->default_value(8333), "The IP port of the Bitcoin service on the node. Defaults to 8333, the standard for mainnet." ) - ( - "filter_type", - value(&argument_.filter_type), - "The compact filter type." - ) ( "height", value(&argument_.height), @@ -199,23 +191,6 @@ class BCX_API fetch_compact_filter_headers_node /* Properties */ - /** - * Get the value of the filter_type argument. - */ - virtual uint16_t& get_filter_type_argument() - { - return argument_.filter_type; - } - - /** - * Set the value of the filter_type argument. - */ - virtual void set_filter_type_argument( - const uint16_t& value) - { - argument_.filter_type = value; - } - /** * Get the value of the height argument. */ @@ -311,13 +286,11 @@ class BCX_API fetch_compact_filter_headers_node struct argument { argument() - : filter_type(), - height(), + : height(), hash() { } - uint16_t filter_type; uint32_t height; system::config::hash256 hash; } argument_; diff --git a/include/bitcoin/explorer/commands/fetch-compact-filters-node.hpp b/include/bitcoin/explorer/commands/get-filters.hpp similarity index 89% rename from include/bitcoin/explorer/commands/fetch-compact-filters-node.hpp rename to include/bitcoin/explorer/commands/get-filters.hpp index ebd824589..6df43e72d 100644 --- a/include/bitcoin/explorer/commands/fetch-compact-filters-node.hpp +++ b/include/bitcoin/explorer/commands/get-filters.hpp @@ -16,8 +16,8 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -#ifndef BX_FETCH_COMPACT_FILTERS_NODE_HPP -#define BX_FETCH_COMPACT_FILTERS_NODE_HPP +#ifndef BX_GET_FILTERS_HPP +#define BX_GET_FILTERS_HPP #include #include @@ -57,13 +57,11 @@ namespace commands { */ #define BX_BIP157_UNSUPPORTED \ "The peer does not indicate support for BIP157." -#define BX_INVALID_FILTER_TYPE \ - "The provided filter type exceeds encodable limits." /** - * Class to implement the fetch-compact-filters-node command. + * Class to implement the get-filters command. */ -class BCX_API fetch_compact_filters_node +class BCX_API get_filters : public command { public: @@ -73,7 +71,7 @@ class BCX_API fetch_compact_filters_node */ static const char* symbol() { - return "fetch-compact-filters-node"; + return "get-filters"; } @@ -82,7 +80,7 @@ class BCX_API fetch_compact_filters_node */ virtual const char* name() { - return fetch_compact_filters_node::symbol(); + return get_filters::symbol(); } /** @@ -109,7 +107,6 @@ class BCX_API fetch_compact_filters_node virtual system::arguments_metadata& load_arguments() { return get_argument_metadata() - .add("filter_type", 1) .add("height", 1) .add("hash", 1); } @@ -161,11 +158,6 @@ class BCX_API fetch_compact_filters_node value(&option_.port)->default_value(8333), "The IP port of the Bitcoin service on the node. Defaults to 8333, the standard for mainnet." ) - ( - "filter_type", - value(&argument_.filter_type), - "The compact filter type." - ) ( "height", value(&argument_.height), @@ -199,23 +191,6 @@ class BCX_API fetch_compact_filters_node /* Properties */ - /** - * Get the value of the filter_type argument. - */ - virtual uint16_t& get_filter_type_argument() - { - return argument_.filter_type; - } - - /** - * Set the value of the filter_type argument. - */ - virtual void set_filter_type_argument( - const uint16_t& value) - { - argument_.filter_type = value; - } - /** * Get the value of the height argument. */ @@ -311,13 +286,11 @@ class BCX_API fetch_compact_filters_node struct argument { argument() - : filter_type(), - height(), + : height(), hash() { } - uint16_t filter_type; uint32_t height; system::config::hash256 hash; } argument_; diff --git a/include/bitcoin/explorer/commands/match-neutrino-filter-address.hpp b/include/bitcoin/explorer/commands/match-neutrino-address.hpp similarity index 95% rename from include/bitcoin/explorer/commands/match-neutrino-filter-address.hpp rename to include/bitcoin/explorer/commands/match-neutrino-address.hpp index ee8e6b54f..56ec60c73 100644 --- a/include/bitcoin/explorer/commands/match-neutrino-filter-address.hpp +++ b/include/bitcoin/explorer/commands/match-neutrino-address.hpp @@ -16,8 +16,8 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -#ifndef BX_MATCH_NEUTRINO_FILTER_ADDRESS_HPP -#define BX_MATCH_NEUTRINO_FILTER_ADDRESS_HPP +#ifndef BX_MATCH_NEUTRINO_ADDRESS_HPP +#define BX_MATCH_NEUTRINO_ADDRESS_HPP #include #include @@ -63,9 +63,9 @@ namespace commands { "Address does not match filter." /** - * Class to implement the match-neutrino-filter-address command. + * Class to implement the match-neutrino-address command. */ -class BCX_API match_neutrino_filter_address +class BCX_API match_neutrino_address : public command { public: @@ -75,7 +75,7 @@ class BCX_API match_neutrino_filter_address */ static const char* symbol() { - return "match-neutrino-filter-address"; + return "match-neutrino-address"; } @@ -84,7 +84,7 @@ class BCX_API match_neutrino_filter_address */ virtual const char* name() { - return match_neutrino_filter_address::symbol(); + return match_neutrino_address::symbol(); } /** diff --git a/include/bitcoin/explorer/commands/match-neutrino-filter-script.hpp b/include/bitcoin/explorer/commands/match-neutrino-script.hpp similarity index 95% rename from include/bitcoin/explorer/commands/match-neutrino-filter-script.hpp rename to include/bitcoin/explorer/commands/match-neutrino-script.hpp index b49c0ade5..d5df65f1e 100644 --- a/include/bitcoin/explorer/commands/match-neutrino-filter-script.hpp +++ b/include/bitcoin/explorer/commands/match-neutrino-script.hpp @@ -16,8 +16,8 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -#ifndef BX_MATCH_NEUTRINO_FILTER_SCRIPT_HPP -#define BX_MATCH_NEUTRINO_FILTER_SCRIPT_HPP +#ifndef BX_MATCH_NEUTRINO_SCRIPT_HPP +#define BX_MATCH_NEUTRINO_SCRIPT_HPP #include #include @@ -63,9 +63,9 @@ namespace commands { "Script does not match filter." /** - * Class to implement the match-neutrino-filter-script command. + * Class to implement the match-neutrino-script command. */ -class BCX_API match_neutrino_filter_script +class BCX_API match_neutrino_script : public command { public: @@ -75,7 +75,7 @@ class BCX_API match_neutrino_filter_script */ static const char* symbol() { - return "match-neutrino-filter-script"; + return "match-neutrino-script"; } @@ -84,7 +84,7 @@ class BCX_API match_neutrino_filter_script */ virtual const char* name() { - return match_neutrino_filter_script::symbol(); + return match_neutrino_script::symbol(); } /** diff --git a/include/bitcoin/explorer/commands/send-tx-node.hpp b/include/bitcoin/explorer/commands/put-tx.hpp similarity index 97% rename from include/bitcoin/explorer/commands/send-tx-node.hpp rename to include/bitcoin/explorer/commands/put-tx.hpp index e944f2e3c..106c76d1f 100644 --- a/include/bitcoin/explorer/commands/send-tx-node.hpp +++ b/include/bitcoin/explorer/commands/put-tx.hpp @@ -16,8 +16,8 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -#ifndef BX_SEND_TX_NODE_HPP -#define BX_SEND_TX_NODE_HPP +#ifndef BX_PUT_TX_HPP +#define BX_PUT_TX_HPP #include #include @@ -59,9 +59,9 @@ namespace commands { "Sent transaction." /** - * Class to implement the send-tx-node command. + * Class to implement the put-tx command. */ -class BCX_API send_tx_node +class BCX_API put_tx : public command { public: @@ -71,7 +71,7 @@ class BCX_API send_tx_node */ static const char* symbol() { - return "send-tx-node"; + return "put-tx"; } /** @@ -79,7 +79,7 @@ class BCX_API send_tx_node */ static const char* formerly() { - return "sendtx-node"; + return "send-tx-node"; } /** @@ -87,7 +87,7 @@ class BCX_API send_tx_node */ virtual const char* name() { - return send_tx_node::symbol(); + return put_tx::symbol(); } /** diff --git a/include/bitcoin/explorer/generated.hpp b/include/bitcoin/explorer/generated.hpp index efbd07364..32a317357 100644 --- a/include/bitcoin/explorer/generated.hpp +++ b/include/bitcoin/explorer/generated.hpp @@ -37,6 +37,7 @@ #include #include #include +#include #include #include #include @@ -64,9 +65,9 @@ #include #include #include -#include -#include -#include +#include +#include +#include #include #include #include @@ -75,6 +76,9 @@ #include #include #include +#include +#include +#include #include #include #include @@ -86,14 +90,15 @@ #include #include #include -#include -#include +#include +#include #include #include #include #include #include #include +#include #include #include #include @@ -103,8 +108,6 @@ #include #include #include -#include -#include #include #include #include diff --git a/model/generate.xml b/model/generate.xml index 778abaa41..116381bd2 100644 --- a/model/generate.xml +++ b/model/generate.xml @@ -307,36 +307,63 @@