From 95fdfcc0ec393e423a736af0d2a899a1f6cfdd60 Mon Sep 17 00:00:00 2001 From: abitmore Date: Mon, 10 Feb 2020 22:28:32 +0000 Subject: [PATCH 1/3] Only cat .hf files when generating hardfork.hpp --- programs/build_helpers/cat-parts.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/programs/build_helpers/cat-parts.cmake b/programs/build_helpers/cat-parts.cmake index bb85ca50cb..1f65e2045e 100644 --- a/programs/build_helpers/cat-parts.cmake +++ b/programs/build_helpers/cat-parts.cmake @@ -10,7 +10,7 @@ file( MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/include/graphene/chain/" ) set( HARDFORK_REGENERATE TRUE ) -file( GLOB HARDFORKS "${CMAKE_CURRENT_SOURCE_DIR}/hardfork.d/*" ) +file( GLOB HARDFORKS "${CMAKE_CURRENT_SOURCE_DIR}/hardfork.d/*.hf" ) foreach( HF ${HARDFORKS} ) file( READ "${HF}" INCL ) string( CONCAT HARDFORK_CONTENT ${HARDFORK_CONTENT} ${INCL} ) From 1a2763b416276d4e550dab56f6ff776e41d255f6 Mon Sep 17 00:00:00 2001 From: abitmore Date: Mon, 10 Feb 2020 22:33:56 +0000 Subject: [PATCH 2/3] Fix 250M supply issue --- libraries/chain/db_maint.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/libraries/chain/db_maint.cpp b/libraries/chain/db_maint.cpp index c6f2b4902c..1bdcc67d1a 100644 --- a/libraries/chain/db_maint.cpp +++ b/libraries/chain/db_maint.cpp @@ -32,6 +32,7 @@ #include #include +#include #include #include #include @@ -970,6 +971,22 @@ void process_hf_1465( database& db ) } } +/**** + * @brief a one-time data process to correct current_supply of BTS token in the BitShares mainnet + */ +void process_hf_2103( database& db ) +{ + const balance_object* bal = db.find( balance_id_type( HARDFORK_CORE_2103_BALANCE_ID ) ); + if( bal != nullptr && bal->balance.amount < 0 ) + { + const asset_dynamic_data_object& ddo = bal->balance.asset_id(db).dynamic_data(db); + db.modify( ddo, [bal](asset_dynamic_data_object& obj) { + obj.current_supply -= bal->balance.amount; + }); + db.remove( *bal ); + } +} + void update_median_feeds(database& db) { time_point_sec head_time = db.head_block_time(); @@ -1227,6 +1244,10 @@ void database::perform_chain_maintenance(const signed_block& next_block, const g if ( dgpo.next_maintenance_time <= HARDFORK_CORE_1465_TIME && next_maintenance_time > HARDFORK_CORE_1465_TIME ) process_hf_1465(*this); + // Fix supply issue + if ( dgpo.next_maintenance_time <= HARDFORK_CORE_2103_TIME && next_maintenance_time > HARDFORK_CORE_2103_TIME ) + process_hf_2103(*this); + modify(dgpo, [next_maintenance_time](dynamic_global_property_object& d) { d.next_maintenance_time = next_maintenance_time; d.accounts_registered_this_interval = 0; From 0ff68ee244cdec2f6b09fe696bffdf07eaaacc12 Mon Sep 17 00:00:00 2001 From: abitmore Date: Mon, 10 Feb 2020 23:20:18 +0000 Subject: [PATCH 3/3] Add the missing .hf file --- libraries/chain/hardfork.d/CORE_2103.hf | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 libraries/chain/hardfork.d/CORE_2103.hf diff --git a/libraries/chain/hardfork.d/CORE_2103.hf b/libraries/chain/hardfork.d/CORE_2103.hf new file mode 100644 index 0000000000..579354f71d --- /dev/null +++ b/libraries/chain/hardfork.d/CORE_2103.hf @@ -0,0 +1,5 @@ +// bitshares-core issue #2103 250M BTS supply +#ifndef HARDFORK_CORE_2103_TIME +#define HARDFORK_CORE_2103_TIME (fc::time_point_sec( 1600000000 ) ) // Sep 2020 +#define HARDFORK_CORE_2103_BALANCE_ID 56720 // 1.15.56720 +#endif