Skip to content

Commit eba093c

Browse files
authored
Merge pull request #2104 from bitshares/pr-2103-supply-fix
Fix supply issue
2 parents d0ed212 + 0ff68ee commit eba093c

File tree

3 files changed

+27
-1
lines changed

3 files changed

+27
-1
lines changed

libraries/chain/db_maint.cpp

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232

3333
#include <graphene/chain/account_object.hpp>
3434
#include <graphene/chain/asset_object.hpp>
35+
#include <graphene/chain/balance_object.hpp>
3536
#include <graphene/chain/budget_record_object.hpp>
3637
#include <graphene/chain/buyback_object.hpp>
3738
#include <graphene/chain/chain_property_object.hpp>
@@ -970,6 +971,22 @@ void process_hf_1465( database& db )
970971
}
971972
}
972973

974+
/****
975+
* @brief a one-time data process to correct current_supply of BTS token in the BitShares mainnet
976+
*/
977+
void process_hf_2103( database& db )
978+
{
979+
const balance_object* bal = db.find( balance_id_type( HARDFORK_CORE_2103_BALANCE_ID ) );
980+
if( bal != nullptr && bal->balance.amount < 0 )
981+
{
982+
const asset_dynamic_data_object& ddo = bal->balance.asset_id(db).dynamic_data(db);
983+
db.modify<asset_dynamic_data_object>( ddo, [bal](asset_dynamic_data_object& obj) {
984+
obj.current_supply -= bal->balance.amount;
985+
});
986+
db.remove( *bal );
987+
}
988+
}
989+
973990
void update_median_feeds(database& db)
974991
{
975992
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
12271244
if ( dgpo.next_maintenance_time <= HARDFORK_CORE_1465_TIME && next_maintenance_time > HARDFORK_CORE_1465_TIME )
12281245
process_hf_1465(*this);
12291246

1247+
// Fix supply issue
1248+
if ( dgpo.next_maintenance_time <= HARDFORK_CORE_2103_TIME && next_maintenance_time > HARDFORK_CORE_2103_TIME )
1249+
process_hf_2103(*this);
1250+
12301251
modify(dgpo, [next_maintenance_time](dynamic_global_property_object& d) {
12311252
d.next_maintenance_time = next_maintenance_time;
12321253
d.accounts_registered_this_interval = 0;
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// bitshares-core issue #2103 250M BTS supply
2+
#ifndef HARDFORK_CORE_2103_TIME
3+
#define HARDFORK_CORE_2103_TIME (fc::time_point_sec( 1600000000 ) ) // Sep 2020
4+
#define HARDFORK_CORE_2103_BALANCE_ID 56720 // 1.15.56720
5+
#endif

programs/build_helpers/cat-parts.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ file( MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/include/graphene/chain/" )
1010

1111
set( HARDFORK_REGENERATE TRUE )
1212

13-
file( GLOB HARDFORKS "${CMAKE_CURRENT_SOURCE_DIR}/hardfork.d/*" )
13+
file( GLOB HARDFORKS "${CMAKE_CURRENT_SOURCE_DIR}/hardfork.d/*.hf" )
1414
foreach( HF ${HARDFORKS} )
1515
file( READ "${HF}" INCL )
1616
string( CONCAT HARDFORK_CONTENT ${HARDFORK_CONTENT} ${INCL} )

0 commit comments

Comments
 (0)