Skip to content
Snippets Groups Projects

Mt 0.24 restore balances

Merged Mariusz Trela requested to merge mt-0.24-restore-balances2 into 0.24.0
5 unresolved threads

restore balances

Merge request reports

Checking pipeline status.

Approval is optional

Merged by Bartek WronaBartek Wrona 4 years ago (Mar 31, 2020 8:47am UTC)

Merge details

  • Changes merged into 0.24.0 with 3f288a08 (commits were squashed).
  • Deleted the source branch.

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
87 const fc::variants& items = obj.get_array();
88 for( auto& item : items )
89 res.emplace_back( from_variant( item ) );
90 }
91 }
92 catch ( const std::exception& e )
93 {
94 elog( "Error while dump reading: ${e}", ("e", e.what()) );
95 }
96 catch ( const fc::exception& e )
97 {
98 elog( "Error while dump reading: ${e}", ("e", e.what()) );
99 }
100 catch (...)
101 {
102 elog( "Error while writing dump data to file ${filename}",
  • 16 namespace steem { namespace chain {
    17
    18 class hf23_helper
    19 {
    20 public:
    21
    22 struct hf23_item
    23 {
    24 std::string name;
    25
    26 asset balance;
    27 asset sbd_balance;
    28
    29 bool operator == ( const hf23_item& obj ) const
    30 {
    31 return balance == obj.balance && sbd_balance == obj.sbd_balance;
  • 20 public:
    21
    22 struct hf23_item
    23 {
    24 std::string name;
    25
    26 asset balance;
    27 asset sbd_balance;
    28
    29 bool operator == ( const hf23_item& obj ) const
    30 {
    31 return balance == obj.balance && sbd_balance == obj.sbd_balance;
    32 }
    33
    34 static hf23_item get_balances( const account_object& obj )
    35 {
  • Mariusz Trela added 1 commit

    added 1 commit

    • 563eb153 - Cleaning + refactoring + small fix in `hf23_helper` class

    Compare with previous version

  • Mariusz Trela added 1 commit

    added 1 commit

    Compare with previous version

  • Author Developer

    everything done

    Edited by Mariusz Trela
  • Bartek Wrona
  • 1636 auto zero_sbd = asset( 0 , SBD_SYMBOL );
    1637
    1638 for( auto& name : restored_accounts )
    1639 {
    1640 auto found = balances.find( hf23_helper::hf23_item{ name, zero_steem, zero_sbd } );
    1641
    1642 if( found == balances.end() )
    1643 continue;
    1644
    1645 const auto* account_ptr = find_account( name );
    1646 if( account_ptr == nullptr )
    1647 continue;
    1648
    1649 modify( *account_ptr, [&]( account_object& a )
    1650 {
    1651 a.sbd_balance = found->sbd_balance;
  • Bartek Wrona
  • Bartek Wrona
  • Mariusz Trela added 1 commit

    added 1 commit

    • 6759bfb2 - Serious problems during restoring accounts fixed + saving to internal array instead of file

    Compare with previous version

  • Author Developer

    Everything fixed according to remarks

  • 1641 if( found == balances.end() )
    1642 {
    1643 ilog( "The account ${acc} hadn't removed balances, balances can't be restored", ( "acc", name ) );
    1644 continue;
    1645 }
    1646
    1647 const auto* account_ptr = find_account( name );
    1648 if( account_ptr == nullptr )
    1649 {
    1650 ilog( "The account ${acc} doesn't exist at all, balances can't be restored", ( "acc", name ) );
    1651 continue;
    1652 }
    1653
    1654 FC_ASSERT( treasury_account.sbd_balance >= found->sbd_balance, "The treasury account has ${treasury_asset} but ${req_asset} is required",
    1655 ( "treasury_asset", treasury_account.sbd_balance )( "req_asset", found->sbd_balance ) );
    1656
  • Mariusz Trela added 1 commit

    added 1 commit

    • 81bdfd56 - Redundant assertion was removed

    Compare with previous version

  • merged

  • Bartek Wrona mentioned in commit 3f288a08

    mentioned in commit 3f288a08

  • mentioned in issue #21 (closed)

  • Please register or sign in to reply
    Loading