diff --git a/.travis.yml b/.travis.yml index bff35d3e29..9b53175725 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,8 +10,7 @@ dist: xenial sudo: true install: - - sudo apt-get install --allow-unauthenticated libboost-thread-dev libboost-iostreams-dev libboost-date-time-dev libboost-system-dev libboost-filesystem-dev libboost-program-options-dev libboost-chrono-dev libboost-test-dev libboost-context-dev libboost-regex-dev libboost-coroutine-dev cmake parallel - + - sudo apt-get install --allow-unauthenticated libboost-thread-dev libboost-iostreams-dev libboost-date-time-dev libboost-system-dev libboost-filesystem-dev libboost-program-options-dev libboost-chrono-dev libboost-test-dev libboost-context-dev libboost-regex-dev libboost-coroutine-dev libleveldb-dev libsnappy-dev cmake parallel addons: sonarcloud: organization: "flwyiq7go36p6lipr64tbesy5jayad3q" diff --git a/CMakeLists.txt b/CMakeLists.txt index b49b7529ac..6115cadf57 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -19,6 +19,12 @@ else() set( CMAKE_CXX_EXTENSIONS OFF ) endif() +set(LOAD_QUERY_TXID_PLUGIN OFF CACHE BOOL "query_txid plugin is off normal state") +if(${LOAD_QUERY_TXID_PLUGIN} STREQUAL "ON") + add_definitions(-DQUERY_TXID_PLUGIN_ABLE) + set( QUERY_TXID graphene_query_txid) +endif() + # http://stackoverflow.com/a/18369825 if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.8) @@ -322,4 +328,5 @@ endif(ENABLE_INSTALLER) MESSAGE( STATUS "" ) MESSAGE( STATUS "PROFILER: ${USE_PROFILER}" ) +MESSAGE( STATUS "LOAD_QUERY_TXID_PLUGIN: ${LOAD_QUERY_TXID_PLUGIN}") MESSAGE( STATUS "" ) diff --git a/Dockerfile b/Dockerfile index 9c703458ba..1afe8a6611 100644 --- a/Dockerfile +++ b/Dockerfile @@ -26,6 +26,8 @@ RUN \ libboost-coroutine-dev \ libtool \ doxygen \ + libleveldb-dev \ + libsnappy-dev \ ca-certificates \ fish \ && \ @@ -47,6 +49,7 @@ RUN \ git submodule update --init --recursive && \ cmake \ -DCMAKE_BUILD_TYPE=Release \ + -DLOAD_QUERY_TXID_PLUGIN=ON \ -DGRAPHENE_DISABLE_UNITY_BUILD=ON \ . && \ make witness_node cli_wallet get_dev_key && \ diff --git a/libraries/app/CMakeLists.txt b/libraries/app/CMakeLists.txt index 71762b1d90..415845308f 100644 --- a/libraries/app/CMakeLists.txt +++ b/libraries/app/CMakeLists.txt @@ -16,11 +16,12 @@ add_library( graphene_app # need to link graphene_debug_witness because plugins aren't sufficiently isolated #246 target_link_libraries( graphene_app graphene_market_history graphene_account_history graphene_elasticsearch graphene_grouped_orders - graphene_api_helper_indexes + graphene_api_helper_indexes ${QUERY_TXID} graphene_chain fc graphene_db graphene_net graphene_utilities graphene_debug_witness ) target_include_directories( graphene_app PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include" - "${CMAKE_CURRENT_SOURCE_DIR}/../egenesis/include" ) + "${CMAKE_CURRENT_SOURCE_DIR}/../egenesis/include" + "${CMAKE_CURRENT_SOURCE_DIR}/../plugins/query_txid_object/include") if(MSVC) set_source_files_properties( application.cpp api.cpp database_api.cpp PROPERTIES COMPILE_FLAGS "/bigobj" ) diff --git a/libraries/app/database_api.cpp b/libraries/app/database_api.cpp index adbe87fc7f..812510006c 100644 --- a/libraries/app/database_api.cpp +++ b/libraries/app/database_api.cpp @@ -35,7 +35,9 @@ #include #include - +#ifdef QUERY_TXID_PLUGIN_ABLE +#include +#endif template class fc::api; namespace graphene { namespace app { @@ -244,7 +246,6 @@ processed_transaction database_api::get_transaction( uint32_t block_num, uint32_ { return my->get_transaction( block_num, trx_in_block ); } - optional database_api::get_recent_transaction_by_id( const transaction_id_type& id )const { try { @@ -1877,7 +1878,10 @@ std::string database_api::get_transaction_hex(const signed_transaction& trx)cons { return my->get_transaction_hex( trx ); } - +optional database_api::get_transaction_by_txid(transaction_id_type txid)const +{ + return my->get_transaction_by_txid(txid); +} std::string database_api_impl::get_transaction_hex(const signed_transaction& trx)const { return fc::to_hex(fc::raw::pack(trx)); @@ -1888,6 +1892,41 @@ std::string database_api::get_transaction_hex_without_sig( { return my->get_transaction_hex_without_sig(trx); } +optional database_api_impl::get_transaction_by_txid(transaction_id_type txid)const +{ +try{ + #ifdef QUERY_TXID_PLUGIN_ABLE + auto &txid_index = _db.get_index_type().indices().get(); + auto itor = txid_index.find(txid); + if(itor != txid_index.end()){ + auto trx_entry = *itor; + auto opt_block = _db.fetch_block_by_number(trx_entry.block_num); + FC_ASSERT(opt_block); + FC_ASSERT(opt_block->transactions.size() > trx_entry.trx_in_block); + optional res = opt_block->transactions[trx_entry.trx_in_block]; + res->query_txid_block_number = trx_entry.block_num; + res->query_txid_trx_in_block = trx_entry.trx_in_block; + return res; + } + else{ + std::string txid_str(txid); + auto result = query_txid::query_txid_plugin::query_trx_by_id(txid_str); + if(!result){ + return{}; + } + auto trx_entry = *result; + auto opt_block = _db.fetch_block_by_number(trx_entry.block_num); + FC_ASSERT(opt_block); + FC_ASSERT(opt_block->transactions.size() > trx_entry.trx_in_block); + optional res = opt_block->transactions[trx_entry.trx_in_block]; + res->query_txid_block_number = trx_entry.block_num; + res->query_txid_trx_in_block = trx_entry.trx_in_block; + return res; + } + #endif + } +FC_CAPTURE_AND_RETHROW((txid)); +} std::string database_api_impl::get_transaction_hex_without_sig( const signed_transaction &trx) const diff --git a/libraries/app/database_api_impl.hxx b/libraries/app/database_api_impl.hxx index e2e7c376a4..38455d2b13 100644 --- a/libraries/app/database_api_impl.hxx +++ b/libraries/app/database_api_impl.hxx @@ -54,7 +54,7 @@ class database_api_impl : public std::enable_shared_from_this map> get_block_header_batch(const vector block_nums)const; optional get_block(uint32_t block_num)const; processed_transaction get_transaction( uint32_t block_num, uint32_t trx_in_block )const; - + optional get_transaction_by_txid(transaction_id_type txid)const; // Globals chain_property_object get_chain_properties()const; global_property_object get_global_properties()const; diff --git a/libraries/app/include/graphene/app/database_api.hpp b/libraries/app/include/graphene/app/database_api.hpp index 1960e64824..e9a913813e 100644 --- a/libraries/app/include/graphene/app/database_api.hpp +++ b/libraries/app/include/graphene/app/database_api.hpp @@ -42,6 +42,8 @@ #include +#include + #include #include @@ -177,6 +179,7 @@ class database_api * @return the transaction at the given position */ processed_transaction get_transaction( uint32_t block_num, uint32_t trx_in_block )const; + optional get_transaction_by_txid(transaction_id_type txid)const; /** * If the transaction has not expired, this method will return the transaction for the given ID or @@ -912,6 +915,7 @@ FC_API(graphene::app::database_api, (get_block) (get_transaction) (get_recent_transaction_by_id) + (get_transaction_by_txid) // Globals (get_chain_properties) diff --git a/libraries/plugins/CMakeLists.txt b/libraries/plugins/CMakeLists.txt index 412b185e08..d5f0e5a7d3 100644 --- a/libraries/plugins/CMakeLists.txt +++ b/libraries/plugins/CMakeLists.txt @@ -8,3 +8,7 @@ add_subdirectory( debug_witness ) add_subdirectory( snapshot ) add_subdirectory( es_objects ) add_subdirectory( api_helper_indexes ) +add_subdirectory( query_txid_object ) +if(${LOAD_QUERY_TXID_PLUGIN} STREQUAL "ON") + add_subdirectory( query_txid ) +endif() diff --git a/libraries/plugins/README.md b/libraries/plugins/README.md index 411bab9b13..07dbb9bc0a 100644 --- a/libraries/plugins/README.md +++ b/libraries/plugins/README.md @@ -20,3 +20,4 @@ Folder | Name | Description [market_history](market_history) | Market History | Save market history data | Market data | Stable | 5 [snapshot](snapshot) | Snapshot | Get a json of all objects in blockchain at a specificed time or block | Debug | Stable | [witness](witness) | Witness | Generate and sign blocks | Block producer | Stable | +[query_txid](query_txid) | Query_txid | Get the transaction data by transaction id | Data | Experimental | 8 \ No newline at end of file diff --git a/libraries/plugins/query_txid/CMakeLists.txt b/libraries/plugins/query_txid/CMakeLists.txt new file mode 100644 index 0000000000..2701f907c8 --- /dev/null +++ b/libraries/plugins/query_txid/CMakeLists.txt @@ -0,0 +1,23 @@ +file(GLOB HEADERS "include/graphene/query_txid/*.hpp") + +add_library( graphene_query_txid + query_txid_plugin.cpp + ) +find_path(LevelDB_INCLUDE_PATH NAMES leveldb/db.h leveldb/write_batch.h) +find_library(LevelDB_LIBRARY NAMES libleveldb.a) +find_library(Snappy_LIBRARY NAMES libsnappy.a) + +if(LevelDB_INCLUDE_PATH AND LevelDB_LIBRARY AND Snappy_LIBRARY) + target_link_libraries( graphene_query_txid graphene_chain graphene_app ${LevelDB_LIBRARY} ${Snappy_LIBRARY} ) + target_include_directories( graphene_query_txid + PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include" ${LevelDB_INCLUDE_PATH}) + install( TARGETS + graphene_query_txid + + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib + ) +else(LevelDB_INCLUDE_PATH AND LevelDB_LIBRARY AND Snappy_LIBRARY) + message(FATAL_ERROR "You need leveldb and snappy") +endif() diff --git a/libraries/plugins/query_txid/include/graphene/query_txid/query_txid_plugin.hpp b/libraries/plugins/query_txid/include/graphene/query_txid/query_txid_plugin.hpp new file mode 100644 index 0000000000..644fae3348 --- /dev/null +++ b/libraries/plugins/query_txid/include/graphene/query_txid/query_txid_plugin.hpp @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2019 GXChain and zhaoxiangfei、bijianing97 . + * + * The MIT License + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ +#pragma once +#include +#include +#include +namespace graphene +{ +namespace query_txid +{ +using namespace chain; +namespace detail +{ +class query_txid_plugin_impl; +} +class query_txid_plugin : public graphene::app::plugin +{ + public: + query_txid_plugin(); + virtual ~query_txid_plugin(); + + std::string plugin_name() const override; + + virtual void plugin_set_program_options( + boost::program_options::options_description &cli, + boost::program_options::options_description &cfg) override; + + virtual void plugin_initialize(const boost::program_options::variables_map &options) override; + virtual void plugin_startup() override; + + static optional query_trx_by_id(std::string txid); + + friend class detail::query_txid_plugin_impl; + + std::unique_ptr my; +}; +} }// graphene::query_txid diff --git a/libraries/plugins/query_txid/query_txid_plugin.cpp b/libraries/plugins/query_txid/query_txid_plugin.cpp new file mode 100644 index 0000000000..71678c7c41 --- /dev/null +++ b/libraries/plugins/query_txid/query_txid_plugin.cpp @@ -0,0 +1,222 @@ +/* + * Copyright (c) 2019 GXChain and zhaoxiangfei、bijianing97 . + * + * The MIT License + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace graphene{ namespace query_txid{ + +namespace detail +{ +using namespace leveldb; +class query_txid_plugin_impl +{ + public: + query_txid_plugin_impl(query_txid_plugin &_plugin) + : _self(_plugin) + { + } + ~query_txid_plugin_impl() + { + } + + void collect_txid_index(const signed_block &b); + + graphene::chain::database &database() + { + return _self.database(); + } + void init(); + static optional query_trx_by_id(std::string txid); + std::string db_path = "trx_entry.db"; + uint64_t limit_batch = 1000; + private: + query_txid_plugin &_self; + fc::signal sig_remove; + + static leveldb::DB *leveldb; + void consume_block(); + void remove_trx_index(const uint64_t trx_entry_id); +}; +leveldb::DB *query_txid_plugin_impl::leveldb = nullptr; + +void query_txid_plugin_impl::init() +{ + try { + leveldb::Options options; + options.create_if_missing = true; + db_path = database().get_data_dir().string() + db_path; + leveldb::Status s = leveldb::DB::Open(options, db_path, &leveldb); + sig_remove.connect([this](const uint64_t trx_entry_id) { remove_trx_index(trx_entry_id); }); + } + FC_LOG_AND_RETHROW() +} +optional query_txid_plugin_impl::query_trx_by_id(std::string txid) +{ + try { + if (leveldb == nullptr) return optional(); + std::string value; + leveldb::Status s = leveldb->Get(leveldb::ReadOptions(), txid, &value); + if (!s.ok()) return optional(); + std::vector data(value.begin(), value.end()); + return fc::raw::unpack(data); + } + FC_LOG_AND_RETHROW() +} +void query_txid_plugin_impl::collect_txid_index(const signed_block &b) +{ + try { + graphene::chain::database &db = database(); + for (unsigned int idx = 0; idx < b.transactions.size(); idx++) { + db.create([&b,&idx](trx_entry_object &obj) { + obj.txid = b.transactions[idx].id(); + obj.block_num = b.block_num(); + obj.trx_in_block = idx; + }); + } + consume_block(); + } + FC_LOG_AND_RETHROW() +} +void query_txid_plugin_impl::consume_block() +{ + try { + graphene::chain::database &db = database(); + const auto &dpo = db.get_dynamic_global_properties(); + uint64_t irr_num = dpo.last_irreversible_block_num; + + const auto &trx_idx = db.get_index_type().indices(); + const auto &trx_bn_idx = trx_idx.get(); + if (trx_idx.begin() == trx_idx.end()) return; + auto itor_begin = trx_bn_idx.begin(); + auto itor_end = trx_bn_idx.lower_bound(irr_num); + uint64_t number = std::distance(itor_begin,itor_end); + uint64_t backupnum = number; + auto put_index = itor_begin->id.instance(); + while (number > limit_batch) { + leveldb::WriteBatch batch; + auto itor_backup = itor_begin; + for (uint64_t idx = 0; idx < limit_batch; idx++) { + auto serialize = fc::raw::pack(*itor_begin); + std::string txid(itor_begin->txid); + batch.Put(txid, {serialize.data(), serialize.size()}); + put_index = itor_begin->id.instance(); + itor_begin++; + if (itor_begin == itor_end) break; + } + leveldb::WriteOptions write_options; + write_options.sync = true; + Status s = leveldb->Write(write_options, &batch); + if (!s.ok()) { + itor_begin = itor_backup; + put_index = itor_begin->id.instance(); + break; + } + number -= limit_batch; + } + if (backupnum > limit_batch) + sig_remove(put_index); + } + FC_LOG_AND_RETHROW() +} +void query_txid_plugin_impl::remove_trx_index(const uint64_t trx_entry_id) +{ + try { + graphene::chain::database &db = database(); + const auto &trx_idx = db.get_index_type().indices(); + for (auto itor = trx_idx.begin(); itor != trx_idx.end();) { + auto backup_itr = itor; + ++itor; + if (itor->id.instance() < trx_entry_id) { + db.remove(*backup_itr); + } else { + break; + } + } + } + FC_LOG_AND_RETHROW() +} +} // namespace detail + +query_txid_plugin::query_txid_plugin() + : my(new detail::query_txid_plugin_impl(*this)) +{ +} + +query_txid_plugin::~query_txid_plugin() +{ +} + +std::string query_txid_plugin::plugin_name() const +{ + return "query_txid"; +} + +void query_txid_plugin::plugin_set_program_options( + boost::program_options::options_description &cli, + boost::program_options::options_description &cfg) +{ + cli.add_options()("query-txid-path", boost::program_options::value(), + "Save the leveldb path of the transaction history") + ("limit-batch", boost::program_options::value(), + "Number of records written to leveldb in batches"); + cfg.add(cli); +} + +void query_txid_plugin::plugin_initialize(const boost::program_options::variables_map &options) +{ + try { + ilog("query_txid plugin initialized"); + database().add_index>(); + database().applied_block.connect([this](const signed_block &b) { my->collect_txid_index(b); }); + if (options.count("query-txid-path")) { + my->db_path = options["query-txid-path"].as(); + if (!fc::exists(my->db_path)) + fc::create_directories(my->db_path); + } + if (options.count("limit-batch")) { + my->limit_batch = options["limit-batch"].as(); + } + my->init(); + } + FC_LOG_AND_RETHROW() +} + +void query_txid_plugin::plugin_startup() +{ +} + +optional query_txid_plugin::query_trx_by_id(std::string txid) +{ + return detail::query_txid_plugin_impl::query_trx_by_id(txid); +} + +} } // graphene::query_txid diff --git a/libraries/plugins/query_txid_object/CMakeLists.txt b/libraries/plugins/query_txid_object/CMakeLists.txt new file mode 100644 index 0000000000..7b29f9c08f --- /dev/null +++ b/libraries/plugins/query_txid_object/CMakeLists.txt @@ -0,0 +1 @@ +file(GLOB HEADERS "include/graphene/query_txid_object/*.hpp") diff --git a/libraries/plugins/query_txid_object/include/graphene/query_txid_object/transaction_entry_object.hpp b/libraries/plugins/query_txid_object/include/graphene/query_txid_object/transaction_entry_object.hpp new file mode 100644 index 0000000000..558233203a --- /dev/null +++ b/libraries/plugins/query_txid_object/include/graphene/query_txid_object/transaction_entry_object.hpp @@ -0,0 +1,80 @@ +/* + * Copyright (c) 2019 GXChain and zhaoxiangfei、bijianing97 . + * + * The MIT License + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ +#pragma once +#include +#include +#include + +namespace graphene { namespace chain { + + struct query_trx_info : public graphene::protocol::processed_transaction + { + query_trx_info( const signed_transaction& trx = signed_transaction()) + : processed_transaction(trx){} + + virtual ~query_trx_info() = default; + + uint64_t query_txid_block_number = 0; + uint64_t query_txid_trx_in_block = 0; + }; + #ifndef QUERY_TXID_SPACE_ID + #define QUERY_TXID_SPACE_ID 8 + #endif + enum query_txid_object_type + { + transaction_position_object_type = 0 + }; + class trx_entry_object : public abstract_object + { + public: + static const uint8_t space_id = QUERY_TXID_SPACE_ID; + static const uint8_t type_id = transaction_position_object_type; + trx_entry_object(){} + + transaction_id_type txid; + uint32_t block_num; + uint32_t trx_in_block; + }; + + struct by_txid; + struct by_blocknum; + + typedef multi_index_container< + trx_entry_object, + indexed_by< + ordered_unique< tag, member< object, object_id_type, &object::id > >, + ordered_unique< tag, member< trx_entry_object, transaction_id_type, &trx_entry_object::txid > >, + ordered_non_unique< tag, member< trx_entry_object, uint32_t, &trx_entry_object::block_num > > + > + + > trx_entry_multi_index_type; + + typedef generic_index trx_entry_index; + +} } // graphene::chain + +FC_REFLECT_DERIVED( graphene::chain::trx_entry_object, (graphene::chain::object), + (txid)(block_num)(trx_in_block)) +FC_REFLECT_DERIVED( graphene::chain::query_trx_info, (graphene::protocol::processed_transaction), + (query_txid_block_number)(query_txid_trx_in_block)) diff --git a/programs/build_helpers/build_and_test b/programs/build_helpers/build_and_test index 062f4d1883..b70158ac46 100755 --- a/programs/build_helpers/build_and_test +++ b/programs/build_helpers/build_and_test @@ -4,7 +4,7 @@ set -e programs/build_helpers/buildstep -s 3500 ccache -s programs/build_helpers/buildstep Prepare 1 "sed -i '/tests/d' libraries/fc/CMakeLists.txt" -programs/build_helpers/buildstep cmake 5 "cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_FLAGS=--coverage -DCMAKE_CXX_FLAGS=--coverage -DBoost_USE_STATIC_LIBS=OFF -DCMAKE_CXX_OUTPUT_EXTENSION_REPLACE=ON ." +programs/build_helpers/buildstep cmake 5 "cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_FLAGS=--coverage -DCMAKE_CXX_FLAGS=--coverage -DBoost_USE_STATIC_LIBS=OFF -DCMAKE_CXX_OUTPUT_EXTENSION_REPLACE=ON -DLOAD_QUERY_TXID_PLUGIN=ON." programs/build_helpers/buildstep make.everything 2400 "programs/build_helpers/make_with_sonar bw-output -j 2 witness_node chain_test cli_test" set -o pipefail programs/build_helpers/buildstep run.chain_test 240 "libraries/fc/tests/run-parallel-tests.sh tests/chain_test" diff --git a/programs/witness_node/CMakeLists.txt b/programs/witness_node/CMakeLists.txt index d671a93c17..3ef61c3480 100644 --- a/programs/witness_node/CMakeLists.txt +++ b/programs/witness_node/CMakeLists.txt @@ -13,7 +13,7 @@ endif() target_link_libraries( witness_node PRIVATE graphene_app graphene_delayed_node graphene_account_history graphene_elasticsearch graphene_market_history graphene_grouped_orders graphene_witness graphene_chain graphene_debug_witness graphene_egenesis_full graphene_snapshot graphene_es_objects - graphene_api_helper_indexes + graphene_api_helper_indexes ${QUERY_TXID} fc ${CMAKE_DL_LIBS} ${PLATFORM_SPECIFIC_LIBS} ) install( TARGETS diff --git a/programs/witness_node/main.cpp b/programs/witness_node/main.cpp index 400d09f0ff..82e7f96396 100644 --- a/programs/witness_node/main.cpp +++ b/programs/witness_node/main.cpp @@ -35,6 +35,10 @@ #include #include +#ifdef QUERY_TXID_PLUGIN_ABLE +#include +#endif + #include #include @@ -96,6 +100,9 @@ int main(int argc, char** argv) { auto es_objects_plug = node->register_plugin(); auto grouped_orders_plug = node->register_plugin(); auto api_helper_indexes_plug = node->register_plugin(); + #ifdef QUERY_TXID_PLUGIN_ABLE + auto querytxid_plug = node->register_plugin(); + #endif // add plugin options to config try