From c149a5b9b1f85577ce7f04226e4b0786d21ca104 Mon Sep 17 00:00:00 2001 From: Vikram Rajkumar Date: Wed, 1 Mar 2017 17:11:55 -0600 Subject: [PATCH 1/8] Update seed nodes --- libraries/app/application.cpp | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/libraries/app/application.cpp b/libraries/app/application.cpp index 4c965082..0b7fc33f 100644 --- a/libraries/app/application.cpp +++ b/libraries/app/application.cpp @@ -163,21 +163,22 @@ namespace detail { } else { + // https://bitsharestalk.org/index.php/topic,23715.0.html vector seeds = { - "104.236.144.84:1777", // puppies - "128.199.143.47:2015", // Harvey - "185.25.22.21:1776", // liondani (Greece) - "bitshares.openledger.info:1776", // OpenLedger - "bts-seed1.abit-more.com:62015", // abit - "seed.bitsharesnodes.com:1776", // wackou - "seed.blocktrades.us:1776", // BlockTrades - "seed.roelandp.nl:1776", // roelandp (Canada) - "seed02.bitsharesnodes.com:1776", - "seed04.bitsharesnodes.com:1776", // Thom - "seed05.bitsharesnodes.com:1776", // Thom - "seed06.bitsharesnodes.com:1776", // Thom - "seed07.bitsharesnodes.com:1776", // Thom - "51.15.61.160:1776" // lafona + "104.236.144.84:1777", // puppies (USA) + "128.199.143.47:2015", // Harvey (Singapore) + "212.47.249.84:50696", // iHashFury (France) + "51.15.61.160:1776", // lafona (France) + "bts-seed1.abit-more.com:62015", // abit (China) + "seed.bitsharesnodes.com:1776", // wackou (Netherlands) + "seed.blocktrades.us:1776", // BlockTrades (USA) + "seed.cubeconnex.com:1777", // cube (USA) + "seed.roelandp.nl:1776", // roelandp (Canada) + "seed04.bitsharesnodes.com:1776", // Thom (Australia) + "seed05.bitsharesnodes.com:1776", // Thom (USA) + "seed06.bitsharesnodes.com:1776", // Thom (USA) + "seed07.bitsharesnodes.com:1776", // Thom (Singapore) + "seeds.bitshares.eu:1776" // pc (http://seeds.quisquis.de/bitshares.html) }; for( const string& endpoint_string : seeds ) { From 9231d05d07de6be37b04cae0d7c2aa5ee7c292a5 Mon Sep 17 00:00:00 2001 From: Vikram Rajkumar Date: Thu, 2 Mar 2017 13:05:25 -0600 Subject: [PATCH 2/8] Fix comment --- libraries/wallet/include/graphene/wallet/wallet.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/wallet/include/graphene/wallet/wallet.hpp b/libraries/wallet/include/graphene/wallet/wallet.hpp index aed51ec1..b27057f7 100644 --- a/libraries/wallet/include/graphene/wallet/wallet.hpp +++ b/libraries/wallet/include/graphene/wallet/wallet.hpp @@ -349,7 +349,7 @@ class wallet_api * This returns a list of operation history objects, which describe activity on the account. * * @param name the name or id of the account - * @param limit the number of entries to return (starting from the most recent) (max 100) + * @param limit the number of entries to return (starting from the most recent) * @returns a list of \c operation_history_objects */ vector get_account_history(string name, int limit)const; From b39997fc771d5fbf4c19dc49f49e33600fcf6600 Mon Sep 17 00:00:00 2001 From: Vikram Rajkumar Date: Sat, 4 Mar 2017 17:13:10 -0600 Subject: [PATCH 3/8] Update README --- LICENSE.md => LICENSE | 4 +- README.md | 122 +++++++++++++++++------------------------- docs | 2 +- 3 files changed, 51 insertions(+), 77 deletions(-) rename LICENSE.md => LICENSE (93%) diff --git a/LICENSE.md b/LICENSE similarity index 93% rename from LICENSE.md rename to LICENSE index 0415b22c..7a374cc6 100644 --- a/LICENSE.md +++ b/LICENSE @@ -1,4 +1,5 @@ -Copyright (c) 2015 Cryptonomex, Inc., and contributors. +Copyright (c) 2015-2016 Cryptonomex Inc. +Copyright (c) 2015-2017 contributors The MIT License @@ -19,4 +20,3 @@ 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. - diff --git a/README.md b/README.md index a83ba292..66a4612a 100644 --- a/README.md +++ b/README.md @@ -1,97 +1,72 @@ -[![Slack](http://slack.bitshares.org/badge.svg)](http://slack.bitshares.org/) +BitShares Core +============== +BitShares Core is the BitShares blockchain implementation and command-line interface. +The web wallet is [BitShares UI](https://github.com/bitshares/bitshares-ui). -Intro for new developers ------------------------- +Visit [BitShares.org](https://bitshares.org/) to learn about BitShares. -This is a quick introduction to get new developers up to speed on BitShares. +Join the community at [BitSharesTalk.org](https://bitsharestalk.org/). -Starting BitShares ------------------ +**NOTE:** The official BitShares git repository location, default branch, and submodule remotes were recently changed. Existing +repositories can be updated with the following steps: -For Ubuntu 14.04 LTS users, see this link first: - https://github.com/cryptonomex/graphene/wiki/build-ubuntu + git remote set-url origin https://github.com/bitshares/bitshares-core.git + git checkout master + git remote set-head origin --auto + git pull + git submodule sync --recursive + git submodule update --init --recursive -and then proceed with: +Getting Started +--------------- +Build instructions and additional documentation are available in the +[wiki](https://github.com/bitshares/bitshares-core/wiki). - git clone https://github.com/bitshares/bitshares-2 - cd bitshares-2 +To build after all dependencies are installed: + + git clone https://github.com/bitshares/bitshares-core.git + cd bitshares-core + git checkout git submodule update --init --recursive cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo . make + +Alternate Boost versions can be specified using the `DBOOST_ROOT` CMake argument. After building, the witness node can +be launched with: + ./programs/witness_node/witness_node -This will launch the witness node. If you would like to launch the command-line wallet, you must first specify a port -for communication with the witness node. To do this, add text to `witness_node_data_dir/config.ini` as follows, then -restart the node: +The node will automatically create a data directory including a config file. It will take some time to fully synchronize +the blockchain. After syncing, you can exit the node using Ctrl+C and setup the command-line wallet by editing +`witness_node_data_dir/config.ini` as follows: rpc-endpoint = 127.0.0.1:8090 -Then, in a separate terminal window, start the command-line wallet `cli_wallet`: +After starting the witness node again, in a separate terminal you can run: ./programs/cli_wallet/cli_wallet -To set your iniital password to 'password' use: +Set your inital password: - >>> set_password password - >>> unlock password + >>> set_password + >>> unlock To import your initial balance: - >>> import_balance nathan [5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3] true + >>> import_balance [] true If you send private keys over this connection, `rpc-endpoint` should be bound to localhost for security. -A list of CLI wallet commands is available -[here](https://github.com/bitshares/bitshares-2/blob/bitshares/libraries/wallet/include/graphene/wallet/wallet.hpp). +Use `help` to see all available wallet commands. Source definition and listing of all commands is available +[here](https://github.com/bitshares/bitshares-core/blob/master/libraries/wallet/include/graphene/wallet/wallet.hpp). -Code coverage testing ---------------------- +Support +------- +Technical support is available in the [BitSharesTalk technical support subforum](https://bitsharestalk.org/index.php?board=45.0). -Check how much code is covered by unit tests, using gcov/lcov (see http://ltp.sourceforge.net/coverage/lcov.php ). +BitShares Core bugs can be reported directly to the [issue tracker](https://github.com/bitshares/bitshares-core/issues). - cmake -D ENABLE_COVERAGE_TESTING=true -D CMAKE_BUILD_TYPE=Debug . - make - lcov --capture --initial --directory . --output-file base.info --no-external - libraries/fc/bloom_test - libraries/fc/task_cancel_test - libraries/fc/api - libraries/fc/blind - libraries/fc/ecc_test test - libraries/fc/real128_test - libraries/fc/lzma_test README.md - libraries/fc/ntp_test - tests/intense_test - tests/app_test - tests/chain_bench - tests/chain_test - tests/performance_test - lcov --capture --directory . --output-file test.info --no-external - lcov --add-tracefile base.info --add-tracefile test.info --output-file total.info - lcov -o interesting.info -r total.info libraries/fc/vendor/\* libraries/fc/tests/\* tests/\* - mkdir -p lcov - genhtml interesting.info --output-directory lcov --prefix `pwd` - -Now open `lcov/index.html` in a browser. - -Unit testing ------------- - -We use the Boost unit test framework for unit testing. Most unit -tests reside in the `chain_test` build target. - -Witness node ------------- - -The role of the witness node is to broadcast transactions, download blocks, and optionally sign them. - -``` -./witness_node --rpc-endpoint 127.0.0.1:8090 --enable-stale-production -w '"1.6.0"' '"1.6.1"' '"1.6.2"' '"1.6.3"' '"1.6.4"' '"1.6.5"' '"1.6.6"' '"1.6.7"' '"1.6.8"' '"1.6.9"' '"1.6.10"' '"1.6.11"' '"1.6.12"' '"1.6.13"' '"1.6.14"' '"1.6.15"' '"1.6.16"' '"1.6.17"' '"1.6.18"' '"1.6.19"' '"1.6.20"' '"1.6.21"' '"1.6.22"' '"1.6.23"' '"1.6.24"' '"1.6.25"' '"1.6.26"' '"1.6.27"' '"1.6.28"' '"1.6.29"' '"1.6.30"' '"1.6.31"' '"1.6.32"' '"1.6.33"' '"1.6.34"' '"1.6.35"' '"1.6.36"' '"1.6.37"' '"1.6.38"' '"1.6.39"' '"1.6.40"' '"1.6.41"' '"1.6.42"' '"1.6.43"' '"1.6.44"' '"1.6.45"' '"1.6.46"' '"1.6.47"' '"1.6.48"' '"1.6.49"' '"1.6.50"' '"1.6.51"' '"1.6.52"' '"1.6.53"' '"1.6.54"' '"1.6.55"' '"1.6.56"' '"1.6.57"' '"1.6.58"' '"1.6.59"' '"1.6.60"' '"1.6.61"' '"1.6.62"' '"1.6.63"' '"1.6.64"' '"1.6.65"' '"1.6.66"' '"1.6.67"' '"1.6.68"' '"1.6.69"' '"1.6.70"' '"1.6.71"' '"1.6.72"' '"1.6.73"' '"1.6.74"' '"1.6.75"' '"1.6.76"' '"1.6.77"' '"1.6.78"' '"1.6.79"' '"1.6.80"' '"1.6.81"' '"1.6.82"' '"1.6.83"' '"1.6.84"' '"1.6.85"' '"1.6.86"' '"1.6.87"' '"1.6.88"' '"1.6.89"' '"1.6.90"' '"1.6.91"' '"1.6.92"' '"1.6.93"' '"1.6.94"' '"1.6.95"' '"1.6.96"' '"1.6.97"' '"1.6.98"' '"1.6.99"' '"1.6.100"' -``` - -Running specific tests ----------------------- - -- `tests/chain_tests -t block_tests/name_of_test` +BitShares UI bugs should be reported to the [UI issue tracker](https://github.com/bitshares/bitshares-ui/issues) Using the API ------------- @@ -164,13 +139,8 @@ If you want information which is not available from an API, it might be availabl from the [database](https://bitshares.github.io/doxygen/classgraphene_1_1chain_1_1database.html); it is fairly simple to write API methods to expose database methods. -Running private testnet ------------------------ - -See the [documentation](https://github.com/cryptonomex/graphene/wiki/private-testnet) if you want to run a private testnet. - -Questions ---------- +FAQ +--- - Is there a way to generate help with parameter names and method descriptions? @@ -240,3 +210,7 @@ Questions connecting to. Therefore the API to add p2p connections needs to be set up with proper access controls. +License +------- +BitShares Core is under the MIT license. See [LICENSE](https://github.com/bitshares/bitshares-core/blob/master/LICENSE) +for more information. diff --git a/docs b/docs index cc4a57cf..474c28bc 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit cc4a57cf18161d591bb2ad23a2cfa630fa2f9915 +Subproject commit 474c28bc7181739f25229b45b76646a693cad998 From f1f1e59664372b039221113714b20f78e3a7c6ae Mon Sep 17 00:00:00 2001 From: Vikram Rajkumar Date: Sat, 4 Mar 2017 17:18:38 -0600 Subject: [PATCH 4/8] Add README TOC --- README.md | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 66a4612a..81b44092 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,16 @@ BitShares Core ============== +* [Getting Started](#getting-started) +* [Support](#support) +* [Using the API](#using-the-api) +* [Accessing restricted API's](#accessing-restricted-apis) +* [FAQ](#faq) +* [License](#license) + BitShares Core is the BitShares blockchain implementation and command-line interface. The web wallet is [BitShares UI](https://github.com/bitshares/bitshares-ui). -Visit [BitShares.org](https://bitshares.org/) to learn about BitShares. - -Join the community at [BitSharesTalk.org](https://bitsharestalk.org/). +Visit [BitShares.org](https://bitshares.org/) to learn about BitShares and join the community at [BitSharesTalk.org](https://bitsharestalk.org/). **NOTE:** The official BitShares git repository location, default branch, and submodule remotes were recently changed. Existing repositories can be updated with the following steps: @@ -36,7 +41,7 @@ be launched with: ./programs/witness_node/witness_node -The node will automatically create a data directory including a config file. It will take some time to fully synchronize +The node will automatically create a data directory including a config file. It may take several hours to fully synchronize the blockchain. After syncing, you can exit the node using Ctrl+C and setup the command-line wallet by editing `witness_node_data_dir/config.ini` as follows: From 24d1ce8b1fc42a36b97cfed4670a1f1823bc692a Mon Sep 17 00:00:00 2001 From: oxarbitrage Date: Mon, 13 Mar 2017 17:03:15 -0700 Subject: [PATCH 5/8] log unexpected exception in close function for github issue 81 --- libraries/chain/db_management.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libraries/chain/db_management.cpp b/libraries/chain/db_management.cpp index 8da18f25..3f1ea985 100644 --- a/libraries/chain/db_management.cpp +++ b/libraries/chain/db_management.cpp @@ -165,8 +165,9 @@ void database::close(bool rewind) } } } - catch (...) + catch ( const fc::exception& e ) { + wlog( "Database close unexpected exception: ${e}", ("e", e) ); } } From 8ae1f6b3a52c36b0c9c454654a338511c0f4812b Mon Sep 17 00:00:00 2001 From: Vikram Rajkumar Date: Thu, 16 Mar 2017 12:46:09 -0500 Subject: [PATCH 6/8] Remove NTP time --- libraries/CMakeLists.txt | 1 - libraries/app/CMakeLists.txt | 2 +- libraries/app/application.cpp | 15 +-- libraries/fc | 2 +- libraries/net/include/graphene/net/node.hpp | 3 - libraries/net/node.cpp | 14 +- .../plugins/debug_witness/debug_witness.cpp | 1 - libraries/plugins/witness/CMakeLists.txt | 2 +- libraries/plugins/witness/witness.cpp | 15 +-- libraries/time/CMakeLists.txt | 18 --- libraries/time/include/graphene/time/time.hpp | 46 ------- libraries/time/time.cpp | 126 ------------------ tests/CMakeLists.txt | 4 +- tests/app/main.cpp | 2 - tests/benchmarks/genesis_allocation.cpp | 2 - 15 files changed, 15 insertions(+), 238 deletions(-) delete mode 100644 libraries/time/CMakeLists.txt delete mode 100644 libraries/time/include/graphene/time/time.hpp delete mode 100644 libraries/time/time.cpp diff --git a/libraries/CMakeLists.txt b/libraries/CMakeLists.txt index 6af806f9..b3c37f48 100644 --- a/libraries/CMakeLists.txt +++ b/libraries/CMakeLists.txt @@ -4,7 +4,6 @@ add_subdirectory( deterministic_openssl_rand ) add_subdirectory( chain ) add_subdirectory( egenesis ) add_subdirectory( net ) -add_subdirectory( time ) add_subdirectory( utilities ) add_subdirectory( app ) add_subdirectory( plugins ) diff --git a/libraries/app/CMakeLists.txt b/libraries/app/CMakeLists.txt index 29d76fe8..75b9ca52 100644 --- a/libraries/app/CMakeLists.txt +++ b/libraries/app/CMakeLists.txt @@ -12,7 +12,7 @@ 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_chain fc graphene_db graphene_net graphene_time graphene_utilities graphene_debug_witness ) +target_link_libraries( graphene_app graphene_market_history graphene_account_history 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" ) diff --git a/libraries/app/application.cpp b/libraries/app/application.cpp index 0b7fc33f..0b42c6b0 100644 --- a/libraries/app/application.cpp +++ b/libraries/app/application.cpp @@ -28,15 +28,12 @@ #include #include -#include #include #include #include -#include - #include #include @@ -336,7 +333,7 @@ namespace detail { bool modified_genesis = false; if( _options->count("genesis-timestamp") ) { - genesis.initial_timestamp = fc::time_point_sec( graphene::time::now() ) + genesis.initial_parameters.block_interval + _options->at("genesis-timestamp").as(); + genesis.initial_timestamp = fc::time_point_sec( fc::time_point::now() ) + genesis.initial_parameters.block_interval + _options->at("genesis-timestamp").as(); genesis.initial_timestamp -= genesis.initial_timestamp.sec_since_epoch() % genesis.initial_parameters.block_interval; modified_genesis = true; std::cerr << "Used genesis timestamp: " << genesis.initial_timestamp.to_iso_string() << " (PLEASE RECORD THIS)\n"; @@ -468,8 +465,6 @@ namespace detail { _force_validate = true; } - graphene::time::now(); - if( _options->count("api-access") ) _apiaccess = fc::json::from_file( _options->at("api-access").as() ) .as(); @@ -538,7 +533,7 @@ namespace detail { std::vector& contained_transaction_message_ids) override { try { - auto latency = graphene::time::now() - blk_msg.block.timestamp; + auto latency = fc::time_point::now() - blk_msg.block.timestamp; FC_ASSERT( (latency.count()/1000) > -5000, "Rejecting block with timestamp in the future" ); if (!sync_mode || blk_msg.block.block_num() % 10000 == 0) { @@ -910,12 +905,6 @@ namespace detail { return fc::time_point_sec::min(); } FC_CAPTURE_AND_RETHROW( (block_id) ) } - /** returns graphene::time::now() */ - virtual fc::time_point_sec get_blockchain_now() override - { - return graphene::time::now(); - } - virtual item_hash_t get_head_block_id() const override { return _chain_db->head_block_id(); diff --git a/libraries/fc b/libraries/fc index e3238628..0d0b485f 160000 --- a/libraries/fc +++ b/libraries/fc @@ -1 +1 @@ -Subproject commit e3238628fc319fbd9ce8d3b00e771cb806d69f2e +Subproject commit 0d0b485f3ab76d46da1bbe5d85c60a6d95e06bd4 diff --git a/libraries/net/include/graphene/net/node.hpp b/libraries/net/include/graphene/net/node.hpp index 1e01904f..e17af148 100644 --- a/libraries/net/include/graphene/net/node.hpp +++ b/libraries/net/include/graphene/net/node.hpp @@ -158,9 +158,6 @@ namespace graphene { namespace net { */ virtual fc::time_point_sec get_block_time(const item_hash_t& block_id) = 0; - /** returns graphene::blockchain::now() */ - virtual fc::time_point_sec get_blockchain_now() = 0; - virtual item_hash_t get_head_block_id() const = 0; virtual uint32_t estimate_last_known_fork_from_git_revision_timestamp(uint32_t unix_timestamp) const = 0; diff --git a/libraries/net/node.cpp b/libraries/net/node.cpp index 9e13e599..2b8a877f 100644 --- a/libraries/net/node.cpp +++ b/libraries/net/node.cpp @@ -396,7 +396,6 @@ namespace graphene { namespace net { namespace detail { void connection_count_changed( uint32_t c ) override; uint32_t get_block_number(const item_hash_t& block_id) override; fc::time_point_sec get_block_time(const item_hash_t& block_id) override; - fc::time_point_sec get_blockchain_now() override; item_hash_t get_head_block_id() const override; uint32_t estimate_last_known_fork_from_git_revision_timestamp(uint32_t unix_timestamp) const override; void error_encountered(const std::string& message, const fc::oexception& error) override; @@ -2642,7 +2641,8 @@ namespace graphene { namespace net { namespace detail { fc::time_point_sec minimum_time_of_last_offered_block = originating_peer->last_block_time_delegate_has_seen + // timestamp of the block immediately before the first unfetched block originating_peer->number_of_unfetched_item_ids * GRAPHENE_MIN_BLOCK_INTERVAL; - if (minimum_time_of_last_offered_block > _delegate->get_blockchain_now() + GRAPHENE_NET_FUTURE_SYNC_BLOCKS_GRACE_PERIOD_SEC) + fc::time_point_sec now = fc::time_point::now(); + if (minimum_time_of_last_offered_block > now + GRAPHENE_NET_FUTURE_SYNC_BLOCKS_GRACE_PERIOD_SEC) { wlog("Disconnecting from peer ${peer} who offered us an implausible number of blocks, their last block would be in the future (${timestamp})", ("peer", originating_peer->get_remote_endpoint()) @@ -2650,7 +2650,7 @@ namespace graphene { namespace net { namespace detail { fc::exception error_for_peer(FC_LOG_MESSAGE(error, "You offered me a list of more sync blocks than could possibly exist. Total blocks offered: ${blocks}, Minimum time of the last block you offered: ${minimum_time_of_last_offered_block}, Now: ${now}", ("blocks", originating_peer->number_of_unfetched_item_ids) ("minimum_time_of_last_offered_block", minimum_time_of_last_offered_block) - ("now", _delegate->get_blockchain_now()))); + ("now", now))); disconnect_from_peer(originating_peer, "You offered me a list of more sync blocks than could possibly exist", true, error_for_peer); @@ -5448,14 +5448,6 @@ namespace graphene { namespace net { namespace detail { INVOKE_AND_COLLECT_STATISTICS(get_block_time, block_id); } - /** returns graphene::blockchain::now() */ - fc::time_point_sec statistics_gathering_node_delegate_wrapper::get_blockchain_now() - { - // this function doesn't need to block, - ASSERT_TASK_NOT_PREEMPTED(); - return _node_delegate->get_blockchain_now(); - } - item_hash_t statistics_gathering_node_delegate_wrapper::get_head_block_id() const { INVOKE_AND_COLLECT_STATISTICS(get_head_block_id); diff --git a/libraries/plugins/debug_witness/debug_witness.cpp b/libraries/plugins/debug_witness/debug_witness.cpp index 7bb5562d..751d1e82 100644 --- a/libraries/plugins/debug_witness/debug_witness.cpp +++ b/libraries/plugins/debug_witness/debug_witness.cpp @@ -25,7 +25,6 @@ #include #include -#include #include diff --git a/libraries/plugins/witness/CMakeLists.txt b/libraries/plugins/witness/CMakeLists.txt index c82442ff..95759bbf 100644 --- a/libraries/plugins/witness/CMakeLists.txt +++ b/libraries/plugins/witness/CMakeLists.txt @@ -4,7 +4,7 @@ add_library( graphene_witness witness.cpp ) -target_link_libraries( graphene_witness graphene_chain graphene_app graphene_time ) +target_link_libraries( graphene_witness graphene_chain graphene_app ) target_include_directories( graphene_witness PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include" ) diff --git a/libraries/plugins/witness/witness.cpp b/libraries/plugins/witness/witness.cpp index 01160272..6c661e2d 100644 --- a/libraries/plugins/witness/witness.cpp +++ b/libraries/plugins/witness/witness.cpp @@ -25,7 +25,6 @@ #include #include -#include #include @@ -51,7 +50,7 @@ void new_chain_banner( const graphene::chain::database& db ) "* *\n" "********************************\n" "\n"; - if( db.get_slot_at_time( graphene::time::now() ) > 200 ) + if( db.get_slot_at_time( fc::time_point::now() ) > 200 ) { std::cerr << "Your genesis seems to have an old timestamp\n" "Please consider using the --genesis-timestamp option to give your genesis a recent timestamp\n" @@ -122,8 +121,6 @@ void witness_plugin::plugin_startup() { try { ilog("witness plugin: plugin_startup() begin"); chain::database& d = database(); - //Start NTP time client - graphene::time::now(); if( !_witnesses.empty() ) { @@ -143,7 +140,6 @@ void witness_plugin::plugin_startup() void witness_plugin::plugin_shutdown() { - graphene::time::shutdown_ntp_time(); return; } @@ -151,13 +147,12 @@ void witness_plugin::schedule_production_loop() { //Schedule for the next second's tick regardless of chain state // If we would wait less than 50ms, wait for the whole second. - fc::time_point ntp_now = graphene::time::now(); - fc::time_point fc_now = fc::time_point::now(); - int64_t time_to_next_second = 1000000 - (ntp_now.time_since_epoch().count() % 1000000); + fc::time_point now = fc::time_point::now(); + int64_t time_to_next_second = 1000000 - (now.time_since_epoch().count() % 1000000); if( time_to_next_second < 50000 ) // we must sleep for at least 50ms time_to_next_second += 1000000; - fc::time_point next_wakeup( fc_now + fc::microseconds( time_to_next_second ) ); + fc::time_point next_wakeup( now + fc::microseconds( time_to_next_second ) ); //wdump( (now.time_since_epoch().count())(next_wakeup.time_since_epoch().count()) ); _block_production_task = fc::schedule([this]{block_production_loop();}, @@ -221,7 +216,7 @@ block_production_condition::block_production_condition_enum witness_plugin::bloc block_production_condition::block_production_condition_enum witness_plugin::maybe_produce_block( fc::mutable_variant_object& capture ) { chain::database& db = database(); - fc::time_point now_fine = graphene::time::now(); + fc::time_point now_fine = fc::time_point::now(); fc::time_point_sec now = now_fine + fc::microseconds( 500000 ); // If the next block production opportunity is in the present or future, we're synced. diff --git a/libraries/time/CMakeLists.txt b/libraries/time/CMakeLists.txt deleted file mode 100644 index 4c9b85c1..00000000 --- a/libraries/time/CMakeLists.txt +++ /dev/null @@ -1,18 +0,0 @@ -file(GLOB HEADERS "include/graphene/time/*.hpp") - -add_library( graphene_time - time.cpp - ) - -target_link_libraries( graphene_time fc ) -target_include_directories( graphene_time - PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include" ) - -install( TARGETS - graphene_time - - RUNTIME DESTINATION bin - LIBRARY DESTINATION lib - ARCHIVE DESTINATION lib -) -install( FILES ${HEADERS} DESTINATION "include/graphene/time" ) diff --git a/libraries/time/include/graphene/time/time.hpp b/libraries/time/include/graphene/time/time.hpp deleted file mode 100644 index 2979369c..00000000 --- a/libraries/time/include/graphene/time/time.hpp +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) 2015 Cryptonomex, Inc., and contributors. - * - * 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 time { - - typedef fc::signal time_discontinuity_signal_type; - extern time_discontinuity_signal_type time_discontinuity_signal; - - fc::optional ntp_time(); - fc::time_point now(); - fc::time_point nonblocking_now(); // identical to now() but guaranteed not to block - void update_ntp_time(); - fc::microseconds ntp_error(); - void shutdown_ntp_time(); - - void start_simulated_time( const fc::time_point sim_time ); - void advance_simulated_time_to( const fc::time_point sim_time ); - void advance_time( int32_t delta_seconds ); - -} } // graphene::time diff --git a/libraries/time/time.cpp b/libraries/time/time.cpp deleted file mode 100644 index 6ba0c126..00000000 --- a/libraries/time/time.cpp +++ /dev/null @@ -1,126 +0,0 @@ -/* - * Copyright (c) 2015 Cryptonomex, Inc., and contributors. - * - * 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 - -namespace graphene { namespace time { - -static int32_t simulated_time = 0; -static int32_t adjusted_time_sec = 0; - -time_discontinuity_signal_type time_discontinuity_signal; - -namespace detail -{ - std::atomic ntp_service(nullptr); - fc::mutex ntp_service_initialization_mutex; -} - -fc::optional ntp_time() -{ - fc::ntp* actual_ntp_service = detail::ntp_service.load(); - if (!actual_ntp_service) - { - fc::scoped_lock lock(detail::ntp_service_initialization_mutex); - actual_ntp_service = detail::ntp_service.load(); - if (!actual_ntp_service) - { - actual_ntp_service = new fc::ntp; - detail::ntp_service.store(actual_ntp_service); - } - } - return actual_ntp_service->get_time(); -} - -void shutdown_ntp_time() -{ - fc::ntp* actual_ntp_service = detail::ntp_service.exchange(nullptr); - delete actual_ntp_service; -} - -fc::time_point now() -{ - if( simulated_time ) - return fc::time_point() + fc::seconds( simulated_time + adjusted_time_sec ); - - fc::optional current_ntp_time = ntp_time(); - if( current_ntp_time.valid() ) - return *current_ntp_time + fc::seconds( adjusted_time_sec ); - else - return fc::time_point::now() + fc::seconds( adjusted_time_sec ); -} - -fc::time_point nonblocking_now() -{ - if (simulated_time) - return fc::time_point() + fc::seconds(simulated_time + adjusted_time_sec); - - fc::ntp* actual_ntp_service = detail::ntp_service.load(); - fc::optional current_ntp_time; - if (actual_ntp_service) - current_ntp_time = actual_ntp_service->get_time(); - - if (current_ntp_time) - return *current_ntp_time + fc::seconds(adjusted_time_sec); - else - return fc::time_point::now() + fc::seconds(adjusted_time_sec); -} - -void update_ntp_time() -{ - detail::ntp_service.load()->request_now(); -} - -fc::microseconds ntp_error() -{ - fc::optional current_ntp_time = ntp_time(); - FC_ASSERT( current_ntp_time, "We don't have NTP time!" ); - return *current_ntp_time - fc::time_point::now(); -} - -void start_simulated_time( const fc::time_point sim_time ) -{ - simulated_time = sim_time.sec_since_epoch(); - adjusted_time_sec = 0; -} -void advance_simulated_time_to( const fc::time_point sim_time ) -{ - simulated_time = sim_time.sec_since_epoch(); - adjusted_time_sec = 0; -} - -void advance_time( int32_t delta_seconds ) -{ - adjusted_time_sec += delta_seconds; - time_discontinuity_signal(); -} - -} } // graphene::time diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 827bdb1b..7edc54bd 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -19,11 +19,11 @@ target_link_libraries( performance_test graphene_chain graphene_app graphene_acc file(GLOB BENCH_MARKS "benchmarks/*.cpp") add_executable( chain_bench ${BENCH_MARKS} ${COMMON_SOURCES} ) -target_link_libraries( chain_bench graphene_chain graphene_app graphene_account_history graphene_time graphene_egenesis_none fc ${PLATFORM_SPECIFIC_LIBS} ) +target_link_libraries( chain_bench graphene_chain graphene_app graphene_account_history graphene_egenesis_none fc ${PLATFORM_SPECIFIC_LIBS} ) file(GLOB APP_SOURCES "app/*.cpp") add_executable( app_test ${APP_SOURCES} ) -target_link_libraries( app_test graphene_app graphene_account_history graphene_net graphene_chain graphene_time graphene_egenesis_none fc ${PLATFORM_SPECIFIC_LIBS} ) +target_link_libraries( app_test graphene_app graphene_account_history graphene_net graphene_chain graphene_egenesis_none fc ${PLATFORM_SPECIFIC_LIBS} ) file(GLOB INTENSE_SOURCES "intense/*.cpp") add_executable( intense_test ${INTENSE_SOURCES} ${COMMON_SOURCES} ) diff --git a/tests/app/main.cpp b/tests/app/main.cpp index 50ed9f07..20f140ee 100644 --- a/tests/app/main.cpp +++ b/tests/app/main.cpp @@ -26,8 +26,6 @@ #include -#include - #include #include diff --git a/tests/benchmarks/genesis_allocation.cpp b/tests/benchmarks/genesis_allocation.cpp index 470d586d..61a3b1b8 100644 --- a/tests/benchmarks/genesis_allocation.cpp +++ b/tests/benchmarks/genesis_allocation.cpp @@ -25,8 +25,6 @@ #include #include -#include - #include #include From 15066260f251b0f2e7992323dfee082962297a36 Mon Sep 17 00:00:00 2001 From: Thomas Freedman Date: Fri, 17 Mar 2017 16:02:11 -0500 Subject: [PATCH 7/8] Updated definition of Thom seed nodes --- libraries/app/application.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libraries/app/application.cpp b/libraries/app/application.cpp index 0b42c6b0..f579ac85 100644 --- a/libraries/app/application.cpp +++ b/libraries/app/application.cpp @@ -171,10 +171,10 @@ namespace detail { "seed.blocktrades.us:1776", // BlockTrades (USA) "seed.cubeconnex.com:1777", // cube (USA) "seed.roelandp.nl:1776", // roelandp (Canada) - "seed04.bitsharesnodes.com:1776", // Thom (Australia) - "seed05.bitsharesnodes.com:1776", // Thom (USA) - "seed06.bitsharesnodes.com:1776", // Thom (USA) - "seed07.bitsharesnodes.com:1776", // Thom (Singapore) + "seed04.bts-nodes.net:1776", // Thom (Australia) + "seed05.bts-nodes.net:1776", // Thom (USA) + "seed06.bts-nodes.net:1776", // Thom (USA) + "seed07.bts-nodes.net:1776", // Thom (Singapore) "seeds.bitshares.eu:1776" // pc (http://seeds.quisquis.de/bitshares.html) }; for( const string& endpoint_string : seeds ) From 9bbbefd3913ccfe01b8e8ef2007ca3eb74ab9d81 Mon Sep 17 00:00:00 2001 From: Vikram Rajkumar Date: Sat, 18 Mar 2017 11:52:06 -0500 Subject: [PATCH 8/8] Update fc submodule --- libraries/app/application.cpp | 6 +++--- libraries/fc | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/libraries/app/application.cpp b/libraries/app/application.cpp index f579ac85..9cf07b01 100644 --- a/libraries/app/application.cpp +++ b/libraries/app/application.cpp @@ -172,9 +172,9 @@ namespace detail { "seed.cubeconnex.com:1777", // cube (USA) "seed.roelandp.nl:1776", // roelandp (Canada) "seed04.bts-nodes.net:1776", // Thom (Australia) - "seed05.bts-nodes.net:1776", // Thom (USA) - "seed06.bts-nodes.net:1776", // Thom (USA) - "seed07.bts-nodes.net:1776", // Thom (Singapore) + "seed05.bts-nodes.net:1776", // Thom (USA) + "seed06.bts-nodes.net:1776", // Thom (USA) + "seed07.bts-nodes.net:1776", // Thom (Singapore) "seeds.bitshares.eu:1776" // pc (http://seeds.quisquis.de/bitshares.html) }; for( const string& endpoint_string : seeds ) diff --git a/libraries/fc b/libraries/fc index 0d0b485f..1f41494f 160000 --- a/libraries/fc +++ b/libraries/fc @@ -1 +1 @@ -Subproject commit 0d0b485f3ab76d46da1bbe5d85c60a6d95e06bd4 +Subproject commit 1f41494f360a1800fc967d647631cf64fdc549ee