Skip to content

Commit

Permalink
Setting posting authorities for a few basic accounts is done in `init…
Browse files Browse the repository at this point in the history
…_genesis` method
  • Loading branch information
Mariusz-Trela committed Dec 11, 2024
1 parent c5f98ca commit f1105c3
Showing 1 changed file with 3 additions and 29 deletions.
32 changes: 3 additions & 29 deletions libraries/chain/database.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3621,6 +3621,7 @@ void database::init_genesis()
auth.account = HIVE_MINER_ACCOUNT;
auth.owner.weight_threshold = 1;
auth.active.weight_threshold = 1;
auth.posting.weight_threshold = 1;
});

create< account_object >( HIVE_NULL_ACCOUNT, HIVE_GENESIS_TIME );
Expand All @@ -3629,6 +3630,7 @@ void database::init_genesis()
auth.account = HIVE_NULL_ACCOUNT;
auth.owner.weight_threshold = 1;
auth.active.weight_threshold = 1;
auth.posting.weight_threshold = 1;
});

#if defined(IS_TEST_NET) || defined(HIVE_CONVERTER_ICEBERG_PLUGIN_ENABLED)
Expand Down Expand Up @@ -3656,6 +3658,7 @@ void database::init_genesis()
auth.account = HIVE_TEMP_ACCOUNT;
auth.owner.weight_threshold = 0;
auth.active.weight_threshold = 0;
auth.posting.weight_threshold = 0;
});

const auto init_witness = [&]( const account_name_type& account_name )
Expand Down Expand Up @@ -5995,23 +5998,6 @@ void database::apply_hardfork( uint32_t hardfork )
}
}

modify( get< account_authority_object, by_account >( HIVE_MINER_ACCOUNT ), [&]( account_authority_object& auth )
{
auth.posting = authority();
auth.posting.weight_threshold = 1;
});

modify( get< account_authority_object, by_account >( HIVE_NULL_ACCOUNT ), [&]( account_authority_object& auth )
{
auth.posting = authority();
auth.posting.weight_threshold = 1;
});

modify( get< account_authority_object, by_account >( HIVE_TEMP_ACCOUNT ), [&]( account_authority_object& auth )
{
auth.posting = authority();
auth.posting.weight_threshold = 1;
});
}
break;
case HIVE_HARDFORK_0_13:
Expand Down Expand Up @@ -6322,18 +6308,6 @@ void database::apply_hardfork( uint32_t hardfork )
case HIVE_HARDFORK_1_28:
{
remove_proposal_votes_for_accounts_without_voting_rights();

/*
We want to keep old behaviour, i.e. posting authority for `temp` account should be treated as an open authority.
Since redirection into stronger authorities is not accepted anymore, it is necessary to change a threshold in `posting` authority to 0.
*/
modify( get< account_authority_object, by_account >( "temp" ), [&]( account_authority_object& auth )
{
authority _authority;
_authority.weight_threshold = 0;

auth.posting = _authority;
});
break;
}
case HIVE_SMT_HARDFORK:
Expand Down

0 comments on commit f1105c3

Please sign in to comment.