From 61b102d11ee081663edb2a2cc858e5740a46ff9c Mon Sep 17 00:00:00 2001 From: Matt Date: Wed, 10 Jun 2020 12:39:41 +0800 Subject: [PATCH] unittest vesting withdraw route --- libraries/chain/database.cpp | 10 +++++----- libraries/protocol/hardfork.d/0-preamble.hf | 2 +- libraries/protocol/hardfork.d/0_23.hf | 2 -- libraries/protocol/hardfork.d/0_24.hf | 13 +++++++++++++ .../protocol/include/steem/protocol/config.hpp | 2 +- tests/tests/operation_time_tests.cpp | 1 + 6 files changed, 21 insertions(+), 9 deletions(-) create mode 100644 libraries/protocol/hardfork.d/0_24.hf diff --git a/libraries/chain/database.cpp b/libraries/chain/database.cpp index 2e649fd6f8..aa928e5173 100644 --- a/libraries/chain/database.cpp +++ b/libraries/chain/database.cpp @@ -5162,14 +5162,14 @@ void database::init_hardforks() FC_ASSERT( STEEM_HARDFORK_0_22 == 22, "Invalid hardfork configuration" ); _hardfork_versions.times[ STEEM_HARDFORK_0_22 ] = fc::time_point_sec( STEEM_HARDFORK_0_22_TIME ); _hardfork_versions.versions[ STEEM_HARDFORK_0_22 ] = STEEM_HARDFORK_0_22_VERSION; -#ifdef IS_TEST_NET - FC_ASSERT( STEEM_HARDFORK_0_23 == 23, "Invalid hardfork configuration" ); - _hardfork_versions.times[ STEEM_HARDFORK_0_23 ] = fc::time_point_sec( STEEM_HARDFORK_0_23_TIME ); - _hardfork_versions.versions[ STEEM_HARDFORK_0_23 ] = STEEM_HARDFORK_0_23_VERSION; -#endif FC_ASSERT( STEEM_HARDFORK_0_23 == 23, "Invalid hardfork configuration" ); _hardfork_versions.times[ STEEM_HARDFORK_0_23 ] = fc::time_point_sec( STEEM_HARDFORK_0_23_TIME ); _hardfork_versions.versions[ STEEM_HARDFORK_0_23 ] = STEEM_HARDFORK_0_23_VERSION; +#ifdef IS_TEST_NET + FC_ASSERT( STEEM_HARDFORK_0_24 == 24, "Invalid hardfork configuration" ); + _hardfork_versions.times[ STEEM_HARDFORK_0_24 ] = fc::time_point_sec( STEEM_HARDFORK_0_24_TIME ); + _hardfork_versions.versions[ STEEM_HARDFORK_0_24 ] = STEEM_HARDFORK_0_24_VERSION; +#endif const auto& hardforks = get_hardfork_property_object(); FC_ASSERT( hardforks.last_hardfork <= STEEM_NUM_HARDFORKS, "Chain knows of more hardforks than configuration", ("hardforks.last_hardfork",hardforks.last_hardfork)("STEEM_NUM_HARDFORKS",STEEM_NUM_HARDFORKS) ); diff --git a/libraries/protocol/hardfork.d/0-preamble.hf b/libraries/protocol/hardfork.d/0-preamble.hf index 8d60001836..9292475e29 100644 --- a/libraries/protocol/hardfork.d/0-preamble.hf +++ b/libraries/protocol/hardfork.d/0-preamble.hf @@ -13,7 +13,7 @@ #include #ifdef IS_TEST_NET -#define STEEM_NUM_HARDFORKS 23 +#define STEEM_NUM_HARDFORKS 24 #else #define STEEM_NUM_HARDFORKS 23 #endif diff --git a/libraries/protocol/hardfork.d/0_23.hf b/libraries/protocol/hardfork.d/0_23.hf index baad867653..aeb0f13e9d 100644 --- a/libraries/protocol/hardfork.d/0_23.hf +++ b/libraries/protocol/hardfork.d/0_23.hf @@ -1,7 +1,5 @@ #ifndef STEEM_HARDFORK_0_23 #define STEEM_HARDFORK_0_23 23 -// #define STEEM_SMT_HARDFORK STEEM_HARDFORK_0_23 -#define STEEM_SMT_HARDFORK 24 #define STEEM_HARDFORK_0_23_TIME 1589983200 // Wed, 20 May 2020 14:00:00 UTC (10:00:00 EDT) diff --git a/libraries/protocol/hardfork.d/0_24.hf b/libraries/protocol/hardfork.d/0_24.hf new file mode 100644 index 0000000000..99ade74d73 --- /dev/null +++ b/libraries/protocol/hardfork.d/0_24.hf @@ -0,0 +1,13 @@ +#ifndef STEEM_HARDFORK_0_24 +#define STEEM_HARDFORK_0_24 24 +#define STEEM_SMT_HARDFORK STEEM_HARDFORK_0_24 + +#ifdef IS_TEST_NET +#define STEEM_HARDFORK_0_24_TIME 1571065200 // Mon, 14 October 2019 11:00:00 EDT +#else +#define STEEM_HARDFORK_0_24_TIME 1597970800 // Future 2020... +#endif + +#define STEEM_HARDFORK_0_24_VERSION hardfork_version( 0, 24 ) + +#endif diff --git a/libraries/protocol/include/steem/protocol/config.hpp b/libraries/protocol/include/steem/protocol/config.hpp index 7a8fa3b87f..68690db51f 100644 --- a/libraries/protocol/include/steem/protocol/config.hpp +++ b/libraries/protocol/include/steem/protocol/config.hpp @@ -9,7 +9,7 @@ // This is checked by get_config_check.sh called from Dockerfile #ifdef IS_TEST_NET -#define STEEM_BLOCKCHAIN_VERSION ( version(0, 23, 0) ) +#define STEEM_BLOCKCHAIN_VERSION ( version(0, 24, 0) ) #define STEEM_INIT_PRIVATE_KEY (fc::ecc::private_key::regenerate(fc::sha256::hash(std::string("init_key")))) #define STEEM_INIT_PUBLIC_KEY_STR (std::string( steem::protocol::public_key_type(STEEM_INIT_PRIVATE_KEY.get_public_key()) )) diff --git a/tests/tests/operation_time_tests.cpp b/tests/tests/operation_time_tests.cpp index 48b3afae9b..0e83baa207 100644 --- a/tests/tests/operation_time_tests.cpp +++ b/tests/tests/operation_time_tests.cpp @@ -1296,6 +1296,7 @@ BOOST_AUTO_TEST_CASE( vesting_withdraw_route ) vest( "alice", 1040000 ); auto withdraw_amount = alice.vesting_shares - original_vesting; + withdraw_amount.amount /= 10; BOOST_TEST_MESSAGE( "Setup vesting withdraw" ); withdraw_vesting_operation wv;