Cleanup changes for pretier diff

This commit is contained in:
Serki 2020-09-22 18:56:19 +02:00
parent c6c26a7d9f
commit 2264aa0052
11 changed files with 22 additions and 47 deletions

View file

@ -19,7 +19,6 @@ if( GRAPHENE_DISABLE_UNITY_BUILD )
db_maint.cpp
db_management.cpp
db_market.cpp
db_sidechain.cpp
db_update.cpp
db_witness_schedule.cpp
)

View file

@ -31,7 +31,6 @@
#include "db_maint.cpp"
#include "db_management.cpp"
#include "db_market.cpp"
#include "db_sidechain.cpp"
#include "db_update.cpp"
#include "db_witness_schedule.cpp"
#include "db_notify.cpp"

View file

@ -151,6 +151,19 @@ const std::vector<uint32_t> database::get_winner_numbers( asset_id_type for_asse
return result;
}
const account_statistics_object& database::get_account_stats_by_owner( account_id_type owner )const
{
auto& idx = get_index_type<account_stats_index>().indices().get<by_owner>();
auto itr = idx.find( owner );
FC_ASSERT( itr != idx.end(), "Can not find account statistics object for owner ${a}", ("a",owner) );
return *itr;
}
const witness_schedule_object& database::get_witness_schedule_object()const
{
return *_p_witness_schedule_obj;
}
vector<authority> database::get_account_custom_authorities(account_id_type account, const operation& op)const
{
const auto& pindex = get_index_type<custom_permission_index>().indices().get<by_account_and_permission>();
@ -297,17 +310,4 @@ bool database::is_son_active( son_id_type son_id )
return (it_son != active_son_ids.end());
}
const account_statistics_object& database::get_account_stats_by_owner( account_id_type owner )const
{
auto& idx = get_index_type<account_stats_index>().indices().get<by_owner>();
auto itr = idx.find( owner );
FC_ASSERT( itr != idx.end(), "Can not find account statistics object for owner ${a}", ("a",owner) );
return *itr;
}
const witness_schedule_object& database::get_witness_schedule_object()const
{
return *_p_witness_schedule_obj;
}
} }

View file

@ -43,7 +43,6 @@ database::database() :
{
initialize_indexes();
initialize_evaluators();
initialize_db_sidechain();
}
database::~database()

View file

@ -1,10 +0,0 @@
#include <graphene/chain/database.hpp>
namespace graphene { namespace chain {
void database::initialize_db_sidechain()
{
recreate_primary_wallet = false;
}
} }

View file

@ -301,6 +301,7 @@ namespace graphene { namespace chain {
const std::vector<uint32_t> get_winner_numbers( asset_id_type for_asset, uint32_t count_members, uint8_t count_winners ) const;
std::vector<uint32_t> get_seeds( asset_id_type for_asset, uint8_t count_winners )const;
uint64_t get_random_bits( uint64_t bound );
const witness_schedule_object& get_witness_schedule_object()const;
bool item_locked(const nft_id_type& item)const;
std::set<son_id_type> get_sons_being_deregistered();
std::set<son_id_type> get_sons_being_reported_down();
@ -309,7 +310,6 @@ namespace graphene { namespace chain {
signed_transaction create_signed_transaction( const fc::ecc::private_key& signing_private_key, const operation& op );
bool is_son_dereg_valid( son_id_type son_id );
bool is_son_active( son_id_type son_id );
const witness_schedule_object& get_witness_schedule_object()const;
time_point_sec head_block_time()const;
uint32_t head_block_num()const;
@ -633,13 +633,6 @@ namespace graphene { namespace chain {
* database::close() has not been called, or failed during execution.
*/
bool _opened = false;
/////////////////////// db_sidechain.cpp ////////////////////
public:
bool recreate_primary_wallet;
void initialize_db_sidechain();
protected:
private:
/// Tracks assets affected by bitshares-core issue #453 before hard fork #615 in one block
flat_set<asset_id_type> _issue_453_affected_assets;

View file

@ -137,7 +137,7 @@ FC_REFLECT(graphene::chain::cdd_vesting_policy_initializer, (start_claim)(vestin
FC_REFLECT(graphene::chain::dormant_vesting_policy_initializer, )
FC_REFLECT_TYPENAME( graphene::chain::vesting_policy_initializer )
FC_REFLECT_ENUM( graphene::chain::vesting_balance_type, (normal)(gpos)(son))
FC_REFLECT_ENUM( graphene::chain::vesting_balance_type, (normal)(gpos)(son) )
GRAPHENE_EXTERNAL_SERIALIZATION( extern, graphene::chain::vesting_balance_create_operation::fee_parameters_type )
GRAPHENE_EXTERNAL_SERIALIZATION( extern, graphene::chain::vesting_balance_withdraw_operation::fee_parameters_type )

View file

@ -128,6 +128,11 @@ struct proposal_operation_hardfork_visitor
FC_ASSERT( block_time >= HARDFORK_1000_TIME, "event_update_status_operation not allowed yet!" );
}
void operator()(const vesting_balance_create_operation &vbco) const {
if(block_time < HARDFORK_GPOS_TIME)
FC_ASSERT( vbco.balance_type == vesting_balance_type::normal, "balance_type in vesting create not allowed yet!" );
}
void operator()(const custom_permission_create_operation &v) const {
FC_ASSERT( block_time >= HARDFORK_NFT_TIME, "custom_permission_create_operation not allowed yet!" );
}
@ -216,11 +221,6 @@ struct proposal_operation_hardfork_visitor
FC_ASSERT( block_time >= HARDFORK_SON_TIME, "son_maintenance_operation not allowed yet!" );
}
void operator()(const vesting_balance_create_operation &vbco) const {
if(block_time < HARDFORK_GPOS_TIME)
FC_ASSERT( vbco.balance_type == vesting_balance_type::normal, "balance_type in vesting create not allowed yet!" );
}
// loop and self visit in proposals
void operator()(const proposal_create_operation &v) const {
for (const op_wrapper &op : v.proposed_ops)
@ -246,7 +246,7 @@ void son_hardfork_visitor::operator()( const son_report_down_operation &v )
});
}
void_result proposal_create_evaluator::do_evaluate(const proposal_create_operation& o)
void_result proposal_create_evaluator::do_evaluate( const proposal_create_operation& o )
{ try {
const database& d = db();
auto block_time = d.head_block_time();

View file

@ -34,9 +34,6 @@
#include <graphene/accounts_list/accounts_list_plugin.hpp>
#include <graphene/affiliate_stats/affiliate_stats_plugin.hpp>
#include <graphene/market_history/market_history_plugin.hpp>
#include <graphene/witness/witness.hpp>
#include <graphene/market_history/market_history_plugin.hpp>
#include <fc/thread/thread.hpp>
#include <fc/smart_ref_impl.hpp>

View file

@ -188,8 +188,6 @@ database_fixture::database_fixture()
mhplugin->plugin_startup();
bookieplugin->plugin_startup();
affiliateplugin->plugin_startup();
// stats api requests affiliate_stats plugin from app, so add it to app plugin list
app.enable_plugin(affiliateplugin->plugin_name());
generate_block();

View file

@ -1,5 +1,5 @@
#pragma once
#include <boost/filesystem/path.hpp>
/////////
/// @brief forward declaration, using as a hack to generate a genesis.json file
/// for testing