diff --git a/gui_version b/gui_version index d1ce3978..6fb2bbde 100644 --- a/gui_version +++ b/gui_version @@ -1 +1 @@ -2.0.160314 +2.0.160829 diff --git a/libraries/app/CMakeLists.txt b/libraries/app/CMakeLists.txt index 2dd91f63..29d76fe8 100644 --- a/libraries/app/CMakeLists.txt +++ b/libraries/app/CMakeLists.txt @@ -28,3 +28,4 @@ INSTALL( TARGETS LIBRARY DESTINATION lib ARCHIVE DESTINATION lib ) +INSTALL( FILES ${HEADERS} DESTINATION "include/graphene/app" ) diff --git a/libraries/app/application.cpp b/libraries/app/application.cpp index 04cf4145..2f962414 100644 --- a/libraries/app/application.cpp +++ b/libraries/app/application.cpp @@ -125,12 +125,17 @@ namespace detail { auto seeds = _options->at("seed-node").as>(); for( const string& endpoint_string : seeds ) { - std::vector endpoints = resolve_string_to_ip_endpoints(endpoint_string); - for (const fc::ip::endpoint& endpoint : endpoints) - { - ilog("Adding seed node ${endpoint}", ("endpoint", endpoint)); - _p2p_network->add_node(endpoint); - _p2p_network->connect_to_endpoint(endpoint); + try { + std::vector endpoints = resolve_string_to_ip_endpoints(endpoint_string); + for (const fc::ip::endpoint& endpoint : endpoints) + { + ilog("Adding seed node ${endpoint}", ("endpoint", endpoint)); + _p2p_network->add_node(endpoint); + _p2p_network->connect_to_endpoint(endpoint); + } + } catch( const fc::exception& e ) { + wlog( "caught exception ${e} while adding seed node ${endpoint}", + ("e", e.to_detail_string())("endpoint", endpoint_string) ); } } } @@ -141,11 +146,16 @@ namespace detail { auto seeds = fc::json::from_string(seeds_str).as>(); for( const string& endpoint_string : seeds ) { - std::vector endpoints = resolve_string_to_ip_endpoints(endpoint_string); - for (const fc::ip::endpoint& endpoint : endpoints) - { - ilog("Adding seed node ${endpoint}", ("endpoint", endpoint)); - _p2p_network->add_node(endpoint); + try { + std::vector endpoints = resolve_string_to_ip_endpoints(endpoint_string); + for (const fc::ip::endpoint& endpoint : endpoints) + { + ilog("Adding seed node ${endpoint}", ("endpoint", endpoint)); + _p2p_network->add_node(endpoint); + } + } catch( const fc::exception& e ) { + wlog( "caught exception ${e} while adding seed node ${endpoint}", + ("e", e.to_detail_string())("endpoint", endpoint_string) ); } } } @@ -154,8 +164,9 @@ namespace detail { vector seeds = { "faucet.bitshares.org:1776", "bitshares.openledger.info:1776", - "114.92.236.175:62015", // abit + "bts-seed1.abit-more.com:62015", // abit "seed.blocktrades.us:1776", + "seed.bitsharesnodes.com:1776", // wackou "seed04.bitsharesnodes.com:1776", // thom "seed05.bitsharesnodes.com:1776", // thom "seed06.bitsharesnodes.com:1776", // thom @@ -165,17 +176,22 @@ namespace detail { "104.236.144.84:1777", // puppies "40.127.190.171:1777", // betax "185.25.22.21:1776", // liondani (greece) - "23.95.43.126:50696", // iHashFury - "109.73.172.144:50696", // iHashFury + "212.47.249.84:50696", // iHashFury (France) + "104.168.154.160:50696", // iHashFury (USA) "128.199.143.47:2015" // Harvey }; for( const string& endpoint_string : seeds ) { - std::vector endpoints = resolve_string_to_ip_endpoints(endpoint_string); - for (const fc::ip::endpoint& endpoint : endpoints) - { - ilog("Adding seed node ${endpoint}", ("endpoint", endpoint)); - _p2p_network->add_node(endpoint); + try { + std::vector endpoints = resolve_string_to_ip_endpoints(endpoint_string); + for (const fc::ip::endpoint& endpoint : endpoints) + { + ilog("Adding seed node ${endpoint}", ("endpoint", endpoint)); + _p2p_network->add_node(endpoint); + } + } catch( const fc::exception& e ) { + wlog( "caught exception ${e} while adding seed node ${endpoint}", + ("e", e.to_detail_string())("endpoint", endpoint_string) ); } } } @@ -508,6 +524,7 @@ namespace detail { { try { auto latency = graphene::time::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) { const auto& witness = blk_msg.block.witness(*_chain_db); diff --git a/libraries/app/database_api.cpp b/libraries/app/database_api.cpp index 46fcc83a..89feb8a6 100644 --- a/libraries/app/database_api.cpp +++ b/libraries/app/database_api.cpp @@ -1094,39 +1094,42 @@ market_ticker database_api_impl::get_ticker( const string& base, const string& q uint32_t day = 86400; auto now = fc::time_point_sec( fc::time_point::now() ); - auto orders = get_order_book( base, quote, 1 ); auto trades = get_trade_history( base, quote, now, fc::time_point_sec( now.sec_since_epoch() - day ), 100 ); - result.latest = trades[0].price; - - for ( market_trade t: trades ) + if ( trades.size() ) { - result.base_volume += t.value; - result.quote_volume += t.amount; - } - - while (trades.size() == 100) - { - trades = get_trade_history( base, quote, trades[99].date, fc::time_point_sec( now.sec_since_epoch() - day ), 100 ); + result.latest = trades[0].price; for ( market_trade t: trades ) { result.base_volume += t.value; result.quote_volume += t.amount; } + + while (trades.size() == 100) + { + trades = get_trade_history( base, quote, trades[99].date, fc::time_point_sec( now.sec_since_epoch() - day ), 100 ); + + for ( market_trade t: trades ) + { + result.base_volume += t.value; + result.quote_volume += t.amount; + } + } + + trades = get_trade_history( base, quote, trades.back().date, fc::time_point_sec(), 1 ); + result.percent_change = trades.size() > 0 ? ( ( result.latest / trades.back().price ) - 1 ) * 100 : 0; } - trades = get_trade_history( base, quote, trades.back().date, fc::time_point_sec(), 1 ); - result.percent_change = trades.size() > 0 ? ( ( result.latest / trades.back().price ) - 1 ) * 100 : 0; - - //if (assets[0]->id == base_id) - { + auto orders = get_order_book( base, quote, 1 ); + if( orders.asks.size() ) result.lowest_ask = orders.asks[0].price; + if( orders.bids.size() ) result.highest_bid = orders.bids[0].price; - } - return result; } FC_CAPTURE_AND_RETHROW( (base)(quote) ) + + return result; } market_volume database_api::get_24_volume( const string& base, const string& quote )const diff --git a/libraries/chain/CMakeLists.txt b/libraries/chain/CMakeLists.txt index 78d785c3..90846a9b 100644 --- a/libraries/chain/CMakeLists.txt +++ b/libraries/chain/CMakeLists.txt @@ -6,6 +6,7 @@ set_source_files_properties( "${CMAKE_CURRENT_BINARY_DIR}/include/graphene/chain add_dependencies( build_hardfork_hpp cat-parts ) file(GLOB HEADERS "include/graphene/chain/*.hpp") +file(GLOB PROTOCOL_HEADERS "include/graphene/chain/protocol/*.hpp") if( GRAPHENE_DISABLE_UNITY_BUILD ) set( GRAPHENE_DB_FILES @@ -104,6 +105,7 @@ add_library( graphene_chain db_bet.cpp ${HEADERS} + ${PROTOCOL_HEADERS} "${CMAKE_CURRENT_BINARY_DIR}/include/graphene/chain/hardfork.hpp" ) @@ -123,3 +125,5 @@ INSTALL( TARGETS LIBRARY DESTINATION lib ARCHIVE DESTINATION lib ) +INSTALL( FILES ${HEADERS} DESTINATION "include/graphene/chain" ) +INSTALL( FILES ${PROTOCOL_HEADERS} DESTINATION "include/graphene/chain/protocol" ) diff --git a/libraries/chain/hardfork.d/599.hf b/libraries/chain/hardfork.d/599.hf index f92dbf04..6249101d 100644 --- a/libraries/chain/hardfork.d/599.hf +++ b/libraries/chain/hardfork.d/599.hf @@ -1,4 +1,4 @@ // #599 Unpacking of extension is incorrect #ifndef HARDFORK_599_TIME -#define HARDFORK_599_TIME (fc::time_point_sec( 1458752400 )) +#define HARDFORK_599_TIME (fc::time_point_sec( 1459789200 )) #endif diff --git a/libraries/chain/include/graphene/chain/protocol/ext.hpp b/libraries/chain/include/graphene/chain/protocol/ext.hpp index 7e8636f5..ac775535 100644 --- a/libraries/chain/include/graphene/chain/protocol/ext.hpp +++ b/libraries/chain/include/graphene/chain/protocol/ext.hpp @@ -82,6 +82,8 @@ void operator<<( Stream& stream, const graphene::chain::extension& value ) fc::reflector::visit( read_vtor ); } + + template< typename Stream, typename T > struct graphene_extension_unpack_visitor { @@ -108,7 +110,7 @@ struct graphene_extension_unpack_visitor { if( (count_left > 0) && (which == next_which) ) { - Member temp; + typename Member::value_type temp; fc::raw::unpack( stream, temp ); (value.*member) = temp; --count_left; diff --git a/libraries/chain/protocol/transaction.cpp b/libraries/chain/protocol/transaction.cpp index 5de878ea..5faf1c0a 100644 --- a/libraries/chain/protocol/transaction.cpp +++ b/libraries/chain/protocol/transaction.cpp @@ -193,7 +193,7 @@ struct sign_state if( approved_by.find(a.first) == approved_by.end() ) { if( depth == max_recursion ) - return false; + continue; if( check_authority( get_active( a.first ), depth+1 ) ) { approved_by.insert( a.first ); diff --git a/libraries/chain/vesting_balance_object.cpp b/libraries/chain/vesting_balance_object.cpp index 8414840c..73448e04 100644 --- a/libraries/chain/vesting_balance_object.cpp +++ b/libraries/chain/vesting_balance_object.cpp @@ -64,7 +64,7 @@ asset linear_vesting_policy::get_allowed_withdraw( const vesting_policy_context& } } - return asset( allowed_withdraw, ctx.amount.asset_id ); + return asset( allowed_withdraw, ctx.balance.asset_id ); } void linear_vesting_policy::on_deposit(const vesting_policy_context& ctx) diff --git a/libraries/db/CMakeLists.txt b/libraries/db/CMakeLists.txt index 986fe9cb..6feb985c 100644 --- a/libraries/db/CMakeLists.txt +++ b/libraries/db/CMakeLists.txt @@ -10,3 +10,4 @@ install( TARGETS LIBRARY DESTINATION lib ARCHIVE DESTINATION lib ) +install( FILES ${HEADERS} DESTINATION "include/graphene/db" ) diff --git a/libraries/deterministic_openssl_rand/CMakeLists.txt b/libraries/deterministic_openssl_rand/CMakeLists.txt index 13ef69a0..1d9c5870 100644 --- a/libraries/deterministic_openssl_rand/CMakeLists.txt +++ b/libraries/deterministic_openssl_rand/CMakeLists.txt @@ -25,3 +25,4 @@ install( TARGETS LIBRARY DESTINATION lib ARCHIVE DESTINATION lib ) +install( FILES ${headers} DESTINATION "include/graphene/deterministic_openssl_rand" ) diff --git a/libraries/fc b/libraries/fc index 2c8cdf84..7a44b21a 160000 --- a/libraries/fc +++ b/libraries/fc @@ -1 +1 @@ -Subproject commit 2c8cdf84b75fe07f75e49dd43ae9ad5c3d5a129c +Subproject commit 7a44b21acfea6728367a0cf56b1f3f7f8104aa63 diff --git a/libraries/net/CMakeLists.txt b/libraries/net/CMakeLists.txt index 5fde5373..39f9cd05 100644 --- a/libraries/net/CMakeLists.txt +++ b/libraries/net/CMakeLists.txt @@ -32,3 +32,4 @@ install( TARGETS LIBRARY DESTINATION lib ARCHIVE DESTINATION lib ) +install( FILES ${HEADERS} DESTINATION "include/graphene/net" ) diff --git a/libraries/p2p/CMakeLists.txt b/libraries/p2p/CMakeLists.txt index 6b5918d5..5aa8d1f7 100644 --- a/libraries/p2p/CMakeLists.txt +++ b/libraries/p2p/CMakeLists.txt @@ -30,3 +30,4 @@ install( TARGETS LIBRARY DESTINATION lib ARCHIVE DESTINATION lib ) +install( FILES ${HEADERS} DESTINATION "include/graphene/p2p" ) diff --git a/libraries/time/CMakeLists.txt b/libraries/time/CMakeLists.txt index cc8a909d..4c9b85c1 100644 --- a/libraries/time/CMakeLists.txt +++ b/libraries/time/CMakeLists.txt @@ -15,3 +15,4 @@ install( TARGETS LIBRARY DESTINATION lib ARCHIVE DESTINATION lib ) +install( FILES ${HEADERS} DESTINATION "include/graphene/time" ) diff --git a/libraries/utilities/CMakeLists.txt b/libraries/utilities/CMakeLists.txt index cce16644..cc78f997 100644 --- a/libraries/utilities/CMakeLists.txt +++ b/libraries/utilities/CMakeLists.txt @@ -37,3 +37,4 @@ install( TARGETS LIBRARY DESTINATION lib ARCHIVE DESTINATION lib ) +install( FILES ${HEADERS} DESTINATION "include/graphene/utilities" ) diff --git a/libraries/wallet/CMakeLists.txt b/libraries/wallet/CMakeLists.txt index 3d66c48e..53e75abd 100644 --- a/libraries/wallet/CMakeLists.txt +++ b/libraries/wallet/CMakeLists.txt @@ -8,7 +8,7 @@ if( PERL_FOUND AND DOXYGEN_FOUND AND NOT "${CMAKE_GENERATOR}" STREQUAL "Ninja" ) add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/doxygen/perlmod/DoxyDocs.pm WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMAND ${DOXYGEN_EXECUTABLE} - DEPENDS Doxyfile include/graphene/wallet/wallet.hpp ) + DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile include/graphene/wallet/wallet.hpp ) add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/api_documentation.cpp COMMAND ${PERL_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/generate_api_documentation.pl ${CMAKE_CURRENT_BINARY_DIR}/api_documentation.cpp.new @@ -37,3 +37,4 @@ install( TARGETS LIBRARY DESTINATION lib ARCHIVE DESTINATION lib ) +install( FILES ${HEADERS} DESTINATION "include/graphene/wallet" ) diff --git a/tests/common/database_fixture.cpp b/tests/common/database_fixture.cpp index adf684c9..fef247ab 100644 --- a/tests/common/database_fixture.cpp +++ b/tests/common/database_fixture.cpp @@ -195,15 +195,15 @@ void database_fixture::verify_asset_supplies( const database& db ) } for( const asset_object& asset_obj : db.get_index_type().indices() ) { - total_balances[asset_obj.id] += asset_obj.dynamic_asset_data_id(db).accumulated_fees; - if( asset_obj.id != asset_id_type() ) - BOOST_CHECK_EQUAL(total_balances[asset_obj.id].value, asset_obj.dynamic_asset_data_id(db).current_supply.value); - total_balances[asset_id_type()] += asset_obj.dynamic_asset_data_id(db).fee_pool; + const auto& dasset_obj = asset_obj.dynamic_asset_data_id(db); + total_balances[asset_obj.id] += dasset_obj.accumulated_fees; + total_balances[asset_id_type()] += dasset_obj.fee_pool; if( asset_obj.is_market_issued() ) { const auto& bad = asset_obj.bitasset_data(db); total_balances[bad.options.short_backing_asset] += bad.settlement_fund; } + total_balances[asset_obj.id] += dasset_obj.confidential_supply.value; } for( const vesting_balance_object& vbo : db.get_index_type< vesting_balance_index >().indices() ) total_balances[ vbo.balance.asset_id ] += vbo.balance.amount; @@ -229,8 +229,12 @@ void database_fixture::verify_asset_supplies( const database& db ) BOOST_CHECK_EQUAL(item.first(db).dynamic_asset_data_id(db).current_supply.value, item.second.value); } + for( const asset_object& asset_obj : db.get_index_type().indices() ) + { + BOOST_CHECK_EQUAL(total_balances[asset_obj.id].value, asset_obj.dynamic_asset_data_id(db).current_supply.value); + } + BOOST_CHECK_EQUAL( core_in_orders.value , reported_core_in_orders.value ); - BOOST_CHECK_EQUAL( total_balances[asset_id_type()].value , core_asset_data.current_supply.value - core_asset_data.confidential_supply.value); // wlog("*** End asset supply verification ***"); } diff --git a/tests/tests/operation_tests2.cpp b/tests/tests/operation_tests2.cpp index 86e24bbc..14749d2a 100644 --- a/tests/tests/operation_tests2.cpp +++ b/tests/tests/operation_tests2.cpp @@ -1337,6 +1337,79 @@ BOOST_AUTO_TEST_CASE(zero_second_vbo) } FC_LOG_AND_RETHROW() } +BOOST_AUTO_TEST_CASE( vbo_withdraw_different ) +{ + try + { + ACTORS((alice)(izzy)); + // don't pay witnesses so we have some worker budget to work with + + // transfer(account_id_type(), alice_id, asset(1000)); + + asset_id_type stuff_id = create_user_issued_asset( "STUFF", izzy_id(db), 0 ).id; + issue_uia( alice_id, asset( 1000, stuff_id ) ); + + // deposit STUFF with linear vesting policy + vesting_balance_id_type vbid; + { + linear_vesting_policy_initializer pinit; + pinit.begin_timestamp = db.head_block_time(); + pinit.vesting_cliff_seconds = 30; + pinit.vesting_duration_seconds = 30; + + vesting_balance_create_operation create_op; + create_op.creator = alice_id; + create_op.owner = alice_id; + create_op.amount = asset(100, stuff_id); + create_op.policy = pinit; + + signed_transaction create_tx; + create_tx.operations.push_back( create_op ); + set_expiration( db, create_tx ); + sign(create_tx, alice_private_key); + + processed_transaction ptx = PUSH_TX( db, create_tx ); + vbid = ptx.operation_results[0].get(); + } + + // wait for VB to mature + generate_blocks( 30 ); + + BOOST_CHECK( vbid(db).get_allowed_withdraw( db.head_block_time() ) == asset(100, stuff_id) ); + + // bad withdrawal op (wrong asset) + { + vesting_balance_withdraw_operation op; + + op.vesting_balance = vbid; + op.amount = asset(100); + op.owner = alice_id; + + signed_transaction withdraw_tx; + withdraw_tx.operations.push_back(op); + set_expiration( db, withdraw_tx ); + sign( withdraw_tx, alice_private_key ); + GRAPHENE_CHECK_THROW( PUSH_TX( db, withdraw_tx ), fc::exception ); + } + + // good withdrawal op + { + vesting_balance_withdraw_operation op; + + op.vesting_balance = vbid; + op.amount = asset(100, stuff_id); + op.owner = alice_id; + + signed_transaction withdraw_tx; + withdraw_tx.operations.push_back(op); + set_expiration( db, withdraw_tx ); + sign( withdraw_tx, alice_private_key ); + PUSH_TX( db, withdraw_tx ); + } + } + FC_LOG_AND_RETHROW() +} + // TODO: Write linear VBO tests BOOST_AUTO_TEST_CASE( top_n_special ) diff --git a/tests/tests/serialization_tests.cpp b/tests/tests/serialization_tests.cpp index 84fced8e..fb87c4c4 100644 --- a/tests/tests/serialization_tests.cpp +++ b/tests/tests/serialization_tests.cpp @@ -122,4 +122,30 @@ BOOST_AUTO_TEST_CASE( extended_public_key_type_test ) } } +BOOST_AUTO_TEST_CASE( extension_serialization_test ) +{ + try + { + buyback_account_options bbo; + bbo.asset_to_buy = asset_id_type(1000); + bbo.asset_to_buy_issuer = account_id_type(2000); + bbo.markets.emplace( asset_id_type() ); + bbo.markets.emplace( asset_id_type(777) ); + account_create_operation create_op = make_account( "rex" ); + create_op.registrar = account_id_type(1234); + create_op.extensions.value.buyback_options = bbo; + + auto packed = fc::raw::pack( create_op ); + account_create_operation unpacked = fc::raw::unpack(packed); + + ilog( "original: ${x}", ("x", create_op) ); + ilog( "unpacked: ${x}", ("x", unpacked) ); + } + catch ( const fc::exception& e ) + { + edump((e.to_detail_string())); + throw; + } +} + BOOST_AUTO_TEST_SUITE_END()