Compare commits
1 commit
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6d4444242f |
20 changed files with 123 additions and 84 deletions
|
|
@ -197,7 +197,7 @@ std::set<son_id_type> database::get_sons_being_reported_down()
|
|||
fc::optional<operation> database::create_son_deregister_proposal( son_id_type son_id, account_id_type paying_son )
|
||||
{
|
||||
son_delete_operation son_dereg_op;
|
||||
son_dereg_op.payer = GRAPHENE_SON_ACCOUNT;
|
||||
son_dereg_op.payer = get_global_properties().parameters.son_account();
|
||||
son_dereg_op.son_id = son_id;
|
||||
|
||||
proposal_create_operation proposal_op;
|
||||
|
|
|
|||
|
|
@ -458,16 +458,6 @@ void database::init_genesis(const genesis_state_type& genesis_state)
|
|||
a.network_fee_percentage = 0;
|
||||
a.lifetime_referrer_fee_percentage = GRAPHENE_100_PERCENT;
|
||||
}).get_id() == GRAPHENE_RAKE_FEE_ACCOUNT_ID);
|
||||
FC_ASSERT(create<account_object>([this](account_object& a) {
|
||||
a.name = "son-account";
|
||||
a.statistics = create<account_statistics_object>([&](account_statistics_object& s){s.owner = a.id;}).id;
|
||||
a.owner.weight_threshold = 1;
|
||||
a.active.weight_threshold = 0;
|
||||
a.registrar = a.lifetime_referrer = a.referrer = GRAPHENE_SON_ACCOUNT;
|
||||
a.membership_expiration_date = time_point_sec::maximum();
|
||||
a.network_fee_percentage = GRAPHENE_DEFAULT_NETWORK_PERCENT_OF_FEE;
|
||||
a.lifetime_referrer_fee_percentage = GRAPHENE_100_PERCENT - GRAPHENE_DEFAULT_NETWORK_PERCENT_OF_FEE;
|
||||
}).get_id() == GRAPHENE_SON_ACCOUNT);
|
||||
// Create more special accounts
|
||||
while( true )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -138,7 +138,8 @@ void database::pay_sons()
|
|||
if(s.txs_signed > 0){
|
||||
auto son_params = get_global_properties().parameters;
|
||||
share_type pay = (s.txs_signed * son_budget.value)/total_txs_signed;
|
||||
|
||||
// TODO: Remove me after QA
|
||||
ilog( "pay ${p} to ${s} for ${t} transactions signed", ("p", pay.value)("s", s.id)("t",s.txs_signed) );
|
||||
const auto& idx = get_index_type<son_index>().indices().get<by_id>();
|
||||
auto son_obj = idx.find( s.owner );
|
||||
modify( *son_obj, [&]( son_object& _son_obj)
|
||||
|
|
@ -166,16 +167,30 @@ void database::pay_sons()
|
|||
}
|
||||
}
|
||||
|
||||
void database::update_son_metrics()
|
||||
void database::update_son_metrics(const vector<son_info>& curr_active_sons)
|
||||
{
|
||||
vector<son_id_type> current_sons;
|
||||
|
||||
current_sons.reserve(curr_active_sons.size());
|
||||
std::transform(curr_active_sons.begin(), curr_active_sons.end(),
|
||||
std::inserter(current_sons, current_sons.end()),
|
||||
[](const son_info &swi) {
|
||||
return swi.son_id;
|
||||
});
|
||||
|
||||
const auto& son_idx = get_index_type<son_index>().indices().get< by_id >();
|
||||
for( auto& son : son_idx )
|
||||
{
|
||||
auto& stats = son.statistics(*this);
|
||||
modify( stats, [&]( son_statistics_object& _stats)
|
||||
bool is_active_son = (std::find(current_sons.begin(), current_sons.end(), son.id) != current_sons.end());
|
||||
modify( stats, [&]( son_statistics_object& _stats )
|
||||
{
|
||||
_stats.total_downtime += _stats.current_interval_downtime;
|
||||
_stats.current_interval_downtime = 0;
|
||||
if(is_active_son)
|
||||
{
|
||||
_stats.total_voted_time = _stats.total_voted_time + get_global_properties().parameters.maintenance_interval;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -555,44 +570,48 @@ void database::update_active_sons()
|
|||
}
|
||||
|
||||
// Update SON authority
|
||||
modify( get(GRAPHENE_SON_ACCOUNT), [&]( account_object& a )
|
||||
if( gpo.parameters.son_account() != GRAPHENE_NULL_ACCOUNT )
|
||||
{
|
||||
if( head_block_time() < HARDFORK_533_TIME )
|
||||
modify( get(gpo.parameters.son_account()), [&]( account_object& a )
|
||||
{
|
||||
uint64_t total_votes = 0;
|
||||
map<account_id_type, uint64_t> weights;
|
||||
a.active.weight_threshold = 0;
|
||||
a.active.account_auths.clear();
|
||||
|
||||
for( const son_object& son : sons )
|
||||
if( head_block_time() < HARDFORK_533_TIME )
|
||||
{
|
||||
weights.emplace(son.son_account, _vote_tally_buffer[son.vote_id]);
|
||||
total_votes += _vote_tally_buffer[son.vote_id];
|
||||
}
|
||||
uint64_t total_votes = 0;
|
||||
map<account_id_type, uint64_t> weights;
|
||||
a.active.weight_threshold = 0;
|
||||
a.active.account_auths.clear();
|
||||
|
||||
// total_votes is 64 bits. Subtract the number of leading low bits from 64 to get the number of useful bits,
|
||||
// then I want to keep the most significant 16 bits of what's left.
|
||||
int8_t bits_to_drop = std::max(int(boost::multiprecision::detail::find_msb(total_votes)) - 15, 0);
|
||||
for( const auto& weight : weights )
|
||||
{
|
||||
// Ensure that everyone has at least one vote. Zero weights aren't allowed.
|
||||
uint16_t votes = std::max((weight.second >> bits_to_drop), uint64_t(1) );
|
||||
a.active.account_auths[weight.first] += votes;
|
||||
a.active.weight_threshold += votes;
|
||||
for( const son_object& son : sons )
|
||||
{
|
||||
weights.emplace(son.son_account, _vote_tally_buffer[son.vote_id]);
|
||||
total_votes += _vote_tally_buffer[son.vote_id];
|
||||
}
|
||||
|
||||
// total_votes is 64 bits. Subtract the number of leading low bits from 64 to get the number of useful bits,
|
||||
// then I want to keep the most significant 16 bits of what's left.
|
||||
int8_t bits_to_drop = std::max(int(boost::multiprecision::detail::find_msb(total_votes)) - 15, 0);
|
||||
for( const auto& weight : weights )
|
||||
{
|
||||
// Ensure that everyone has at least one vote. Zero weights aren't allowed.
|
||||
uint16_t votes = std::max((weight.second >> bits_to_drop), uint64_t(1) );
|
||||
a.active.account_auths[weight.first] += votes;
|
||||
a.active.weight_threshold += votes;
|
||||
}
|
||||
|
||||
a.active.weight_threshold *= 2;
|
||||
a.active.weight_threshold /= 3;
|
||||
a.active.weight_threshold += 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
vote_counter vc;
|
||||
for( const son_object& son : sons )
|
||||
vc.add( son.son_account, std::max(_vote_tally_buffer[son.vote_id], UINT64_C(1)) );
|
||||
vc.finish_2_3( a.active );
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
||||
a.active.weight_threshold *= 2;
|
||||
a.active.weight_threshold /= 3;
|
||||
a.active.weight_threshold += 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
vote_counter vc;
|
||||
for( const son_object& son : sons )
|
||||
vc.add( son.son_account, std::max(_vote_tally_buffer[son.vote_id], UINT64_C(1)) );
|
||||
vc.finish_2_3( a.active );
|
||||
}
|
||||
} );
|
||||
|
||||
// Compare current and to-be lists of active sons
|
||||
auto cur_active_sons = gpo.active_sons;
|
||||
|
|
@ -622,6 +641,9 @@ void database::update_active_sons()
|
|||
update_son_statuses(cur_active_sons, new_active_sons);
|
||||
}
|
||||
|
||||
// Update son performance metrics
|
||||
update_son_metrics(cur_active_sons);
|
||||
|
||||
modify(gpo, [&]( global_property_object& gp ){
|
||||
gp.active_sons.clear();
|
||||
gp.active_sons.reserve(new_active_sons.size());
|
||||
|
|
@ -640,9 +662,6 @@ void database::update_active_sons()
|
|||
});
|
||||
_sso.scheduler.update(active_sons);
|
||||
});
|
||||
|
||||
update_son_metrics();
|
||||
|
||||
} FC_CAPTURE_AND_RETHROW() }
|
||||
|
||||
void database::initialize_budget_record( fc::time_point_sec now, budget_record& rec )const
|
||||
|
|
@ -1558,6 +1577,30 @@ void process_dividend_assets(database& db)
|
|||
}
|
||||
} FC_CAPTURE_AND_RETHROW() }
|
||||
|
||||
void perform_son_tasks(database& db)
|
||||
{
|
||||
const global_property_object& gpo = db.get_global_properties();
|
||||
if(gpo.parameters.son_account() == GRAPHENE_NULL_ACCOUNT && db.head_block_time() >= HARDFORK_SON_TIME)
|
||||
{
|
||||
const auto& son_account = db.create<account_object>([&](account_object& a) {
|
||||
a.name = "son-account";
|
||||
a.statistics = db.create<account_statistics_object>([&](account_statistics_object& s){s.owner = a.id;}).id;
|
||||
a.owner.weight_threshold = 1;
|
||||
a.active.weight_threshold = 0;
|
||||
a.registrar = a.lifetime_referrer = a.referrer = a.id;
|
||||
a.membership_expiration_date = time_point_sec::maximum();
|
||||
a.network_fee_percentage = GRAPHENE_DEFAULT_NETWORK_PERCENT_OF_FEE;
|
||||
a.lifetime_referrer_fee_percentage = GRAPHENE_100_PERCENT - GRAPHENE_DEFAULT_NETWORK_PERCENT_OF_FEE;
|
||||
});
|
||||
|
||||
db.modify( gpo, [&]( global_property_object& gpo ) {
|
||||
gpo.parameters.extensions.value.son_account = son_account.get_id();
|
||||
if( gpo.pending_parameters )
|
||||
gpo.pending_parameters->extensions.value.son_account = son_account.get_id();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
void database::perform_chain_maintenance(const signed_block& next_block, const global_property_object& global_props)
|
||||
{ try {
|
||||
const auto& gpo = get_global_properties();
|
||||
|
|
@ -1566,6 +1609,7 @@ void database::perform_chain_maintenance(const signed_block& next_block, const g
|
|||
create_buyback_orders(*this);
|
||||
|
||||
process_dividend_assets(*this);
|
||||
perform_son_tasks(*this);
|
||||
|
||||
struct vote_tally_helper {
|
||||
database& d;
|
||||
|
|
|
|||
|
|
@ -110,7 +110,6 @@ fc::variant_object get_config()
|
|||
result[ "GRAPHENE_TEMP_ACCOUNT" ] = fc::variant(GRAPHENE_TEMP_ACCOUNT, GRAPHENE_MAX_NESTED_OBJECTS);
|
||||
result[ "GRAPHENE_PROXY_TO_SELF_ACCOUNT" ] = fc::variant(GRAPHENE_TEMP_ACCOUNT, GRAPHENE_MAX_NESTED_OBJECTS);
|
||||
result[ "GRAPHENE_RAKE_FEE_ACCOUNT_ID" ] = fc::variant(GRAPHENE_TEMP_ACCOUNT, GRAPHENE_MAX_NESTED_OBJECTS);
|
||||
result[ "GRAPHENE_SON_ACCOUNT" ] = fc::variant(GRAPHENE_TEMP_ACCOUNT, GRAPHENE_MAX_NESTED_OBJECTS);
|
||||
result[ "GRAPHENE_NULL_WITNESS" ] = fc::variant(GRAPHENE_TEMP_ACCOUNT, GRAPHENE_MAX_NESTED_OBJECTS);
|
||||
result[ "GRAPHENE_FBA_STEALTH_DESIGNATED_ASSET" ] = fc::variant(GRAPHENE_TEMP_ACCOUNT, GRAPHENE_MAX_NESTED_OBJECTS);
|
||||
result[ "GRAPHENE_DEFAULT_RAKE_FEE_PERCENTAGE" ] = fc::variant(GRAPHENE_TEMP_ACCOUNT, GRAPHENE_MAX_NESTED_OBJECTS);
|
||||
|
|
|
|||
|
|
@ -175,8 +175,6 @@
|
|||
#define GRAPHENE_PROXY_TO_SELF_ACCOUNT (graphene::chain::account_id_type(5))
|
||||
///
|
||||
#define GRAPHENE_RAKE_FEE_ACCOUNT_ID (graphene::chain::account_id_type(6))
|
||||
///
|
||||
#define GRAPHENE_SON_ACCOUNT (graphene::chain::account_id_type(7))
|
||||
/// Sentinel value used in the scheduler.
|
||||
#define GRAPHENE_NULL_WITNESS (graphene::chain::witness_id_type(0))
|
||||
///@}
|
||||
|
|
|
|||
|
|
@ -546,7 +546,7 @@ namespace graphene { namespace chain {
|
|||
void perform_chain_maintenance(const signed_block& next_block, const global_property_object& global_props);
|
||||
void update_active_witnesses();
|
||||
void update_active_committee_members();
|
||||
void update_son_metrics();
|
||||
void update_son_metrics( const vector<son_info>& curr_active_sons );
|
||||
void update_active_sons();
|
||||
void remove_son_proposal( const proposal_object& proposal );
|
||||
void remove_inactive_son_down_proposals( const vector<son_id_type>& son_ids_to_remove );
|
||||
|
|
|
|||
|
|
@ -50,6 +50,7 @@ namespace graphene { namespace chain {
|
|||
optional < uint32_t > son_deregister_time;
|
||||
optional < uint32_t > son_heartbeat_frequency;
|
||||
optional < uint32_t > son_down_time;
|
||||
optional < account_id_type > son_account;
|
||||
};
|
||||
|
||||
struct chain_parameters
|
||||
|
|
@ -154,6 +155,9 @@ namespace graphene { namespace chain {
|
|||
inline uint16_t son_down_time()const {
|
||||
return extensions.value.son_down_time.valid() ? *extensions.value.son_down_time : SON_DOWN_TIME;
|
||||
}
|
||||
inline account_id_type son_account() const {
|
||||
return extensions.value.son_account.valid() ? *extensions.value.son_account : GRAPHENE_NULL_ACCOUNT;
|
||||
}
|
||||
};
|
||||
|
||||
} } // graphene::chain
|
||||
|
|
@ -175,6 +179,7 @@ FC_REFLECT( graphene::chain::parameter_extension,
|
|||
(son_deregister_time)
|
||||
(son_heartbeat_frequency)
|
||||
(son_down_time)
|
||||
(son_account)
|
||||
)
|
||||
|
||||
FC_REFLECT( graphene::chain::chain_parameters,
|
||||
|
|
|
|||
|
|
@ -34,6 +34,8 @@ namespace graphene { namespace chain {
|
|||
uint64_t total_txs_signed = 0;
|
||||
// Transactions signed since the last son payouts
|
||||
uint64_t txs_signed = 0;
|
||||
// Total Voted Active time i.e. duration selected as part of voted active SONs
|
||||
uint64_t total_voted_time = 0;
|
||||
// Total Downtime barring the current down time in seconds, used for stats to present to user
|
||||
uint64_t total_downtime = 0;
|
||||
// Current Interval Downtime since last maintenance
|
||||
|
|
@ -117,6 +119,7 @@ FC_REFLECT_DERIVED( graphene::chain::son_statistics_object,
|
|||
(owner)
|
||||
(total_txs_signed)
|
||||
(txs_signed)
|
||||
(total_voted_time)
|
||||
(total_downtime)
|
||||
(current_interval_downtime)
|
||||
(last_down_timestamp)
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ void_result bitcoin_transaction_send_evaluator::do_evaluate(const bitcoin_transa
|
|||
try
|
||||
{
|
||||
FC_ASSERT(db().head_block_time() >= HARDFORK_SON_TIME, "Not allowed until SON HARDFORK");
|
||||
FC_ASSERT( op.payer == GRAPHENE_SON_ACCOUNT, "SON paying account must be set as payer." );
|
||||
FC_ASSERT( op.payer == db().get_global_properties().parameters.son_account(), "SON paying account must be set as payer." );
|
||||
return void_result();
|
||||
}
|
||||
FC_CAPTURE_AND_RETHROW((op))
|
||||
|
|
@ -109,7 +109,7 @@ void_result bitcoin_send_transaction_process_evaluator::do_evaluate(const bitcoi
|
|||
try
|
||||
{
|
||||
FC_ASSERT(db().head_block_time() >= HARDFORK_SON_TIME, "Not allowed until SON HARDFORK");
|
||||
FC_ASSERT( op.payer == GRAPHENE_SON_ACCOUNT, "SON paying account must be set as payer." );
|
||||
FC_ASSERT( op.payer == db().get_global_properties().parameters.son_account(), "SON paying account must be set as payer." );
|
||||
const auto& btidx = db().get_index_type<bitcoin_transaction_index>().indices().get<by_id>();
|
||||
const auto btobj = btidx.find(op.bitcoin_transaction_id);
|
||||
FC_ASSERT(btobj != btidx.end(), "Bitcoin Transaction Object not found");
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ void_result delete_son_evaluator::do_evaluate(const son_delete_operation& op)
|
|||
{ try {
|
||||
FC_ASSERT(db().head_block_time() >= HARDFORK_SON_TIME, "Not allowed until SON_HARDFORK"); // can be removed after HF date pass
|
||||
// Either owner can remove or consensus son account
|
||||
FC_ASSERT(op.payer == db().get(op.son_id).son_account || (db().is_son_dereg_valid(op.son_id) && op.payer == GRAPHENE_SON_ACCOUNT));
|
||||
FC_ASSERT(op.payer == db().get(op.son_id).son_account || (db().is_son_dereg_valid(op.son_id) && op.payer == db().get_global_properties().parameters.son_account()));
|
||||
const auto& idx = db().get_index_type<son_index>().indices().get<by_id>();
|
||||
FC_ASSERT( idx.find(op.son_id) != idx.end() );
|
||||
return void_result();
|
||||
|
|
@ -167,7 +167,7 @@ object_id_type son_heartbeat_evaluator::do_apply(const son_heartbeat_operation&
|
|||
void_result son_report_down_evaluator::do_evaluate(const son_report_down_operation& op)
|
||||
{ try {
|
||||
FC_ASSERT(db().head_block_time() >= HARDFORK_SON_TIME, "Not allowed until SON HARDFORK"); // can be removed after HF date pass
|
||||
FC_ASSERT(op.payer == GRAPHENE_SON_ACCOUNT, "SON paying account must be set as payer.");
|
||||
FC_ASSERT(op.payer == db().get_global_properties().parameters.son_account(), "SON paying account must be set as payer.");
|
||||
const auto& idx = db().get_index_type<son_index>().indices().get<by_id>();
|
||||
FC_ASSERT( idx.find(op.son_id) != idx.end() );
|
||||
auto itr = idx.find(op.son_id);
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ namespace graphene { namespace chain {
|
|||
void_result create_son_wallet_deposit_evaluator::do_evaluate(const son_wallet_deposit_create_operation& op)
|
||||
{ try{
|
||||
FC_ASSERT(db().head_block_time() >= HARDFORK_SON_TIME, "Not allowed until SON HARDFORK");
|
||||
FC_ASSERT( op.payer == GRAPHENE_SON_ACCOUNT, "SON paying account must be set as payer." );
|
||||
FC_ASSERT( op.payer == db().get_global_properties().parameters.son_account(), "SON paying account must be set as payer." );
|
||||
|
||||
const auto &idx = db().get_index_type<son_stats_index>().indices().get<by_owner>();
|
||||
FC_ASSERT(idx.find(op.son_id) != idx.end(), "Statistic object for a given SON ID does not exists");
|
||||
|
|
@ -68,7 +68,7 @@ object_id_type create_son_wallet_deposit_evaluator::do_apply(const son_wallet_de
|
|||
void_result process_son_wallet_deposit_evaluator::do_evaluate(const son_wallet_deposit_process_operation& op)
|
||||
{ try{
|
||||
FC_ASSERT(db().head_block_time() >= HARDFORK_SON_TIME, "Not allowed until SON HARDFORK");
|
||||
FC_ASSERT( op.payer == GRAPHENE_SON_ACCOUNT, "SON paying account must be set as payer." );
|
||||
FC_ASSERT( op.payer == db().get_global_properties().parameters.son_account(), "SON paying account must be set as payer." );
|
||||
|
||||
const auto& idx = db().get_index_type<son_wallet_deposit_index>().indices().get<by_id>();
|
||||
const auto& itr = idx.find(op.son_wallet_deposit_id);
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ namespace graphene { namespace chain {
|
|||
void_result recreate_son_wallet_evaluator::do_evaluate(const son_wallet_recreate_operation& op)
|
||||
{ try{
|
||||
FC_ASSERT(db().head_block_time() >= HARDFORK_SON_TIME, "Not allowed until SON HARDFORK");
|
||||
FC_ASSERT( op.payer == GRAPHENE_SON_ACCOUNT, "SON paying account must be set as payer." );
|
||||
FC_ASSERT( op.payer == db().get_global_properties().parameters.son_account(), "SON paying account must be set as payer." );
|
||||
|
||||
const auto& idx = db().get_index_type<son_wallet_index>().indices().get<by_id>();
|
||||
auto itr = idx.rbegin();
|
||||
|
|
@ -53,7 +53,7 @@ object_id_type recreate_son_wallet_evaluator::do_apply(const son_wallet_recreate
|
|||
void_result update_son_wallet_evaluator::do_evaluate(const son_wallet_update_operation& op)
|
||||
{ try{
|
||||
FC_ASSERT(db().head_block_time() >= HARDFORK_SON_TIME, "Not allowed until SON HARDFORK");
|
||||
FC_ASSERT( op.payer == GRAPHENE_SON_ACCOUNT, "SON paying account must be set as payer." );
|
||||
FC_ASSERT( op.payer == db().get_global_properties().parameters.son_account(), "SON paying account must be set as payer." );
|
||||
|
||||
const auto& idx = db().get_index_type<son_wallet_index>().indices().get<by_id>();
|
||||
FC_ASSERT( idx.find(op.son_wallet_id) != idx.end() );
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ namespace graphene { namespace chain {
|
|||
void_result create_son_wallet_withdraw_evaluator::do_evaluate(const son_wallet_withdraw_create_operation& op)
|
||||
{ try{
|
||||
FC_ASSERT(db().head_block_time() >= HARDFORK_SON_TIME, "Not allowed until SON HARDFORK");
|
||||
FC_ASSERT( op.payer == GRAPHENE_SON_ACCOUNT, "SON paying account must be set as payer." );
|
||||
FC_ASSERT( op.payer == db().get_global_properties().parameters.son_account(), "SON paying account must be set as payer." );
|
||||
|
||||
const auto &idx = db().get_index_type<son_stats_index>().indices().get<by_owner>();
|
||||
FC_ASSERT(idx.find(op.son_id) != idx.end(), "Statistic object for a given SON ID does not exists");
|
||||
|
|
@ -68,7 +68,7 @@ object_id_type create_son_wallet_withdraw_evaluator::do_apply(const son_wallet_w
|
|||
void_result process_son_wallet_withdraw_evaluator::do_evaluate(const son_wallet_withdraw_process_operation& op)
|
||||
{ try{
|
||||
FC_ASSERT(db().head_block_time() >= HARDFORK_SON_TIME, "Not allowed until SON HARDFORK");
|
||||
FC_ASSERT( op.payer == GRAPHENE_SON_ACCOUNT, "SON paying account must be set as payer." );
|
||||
FC_ASSERT( op.payer == db().get_global_properties().parameters.son_account(), "SON paying account must be set as payer." );
|
||||
|
||||
const auto& idx = db().get_index_type<son_wallet_withdraw_index>().indices().get<by_id>();
|
||||
const auto& itr = idx.find(op.son_wallet_withdraw_id);
|
||||
|
|
|
|||
|
|
@ -438,7 +438,7 @@ void peerplays_sidechain_plugin_impl::create_son_down_proposals() {
|
|||
const chain::global_property_object &gpo = d.get_global_properties();
|
||||
|
||||
chain::son_report_down_operation son_down_op;
|
||||
son_down_op.payer = GRAPHENE_SON_ACCOUNT;
|
||||
son_down_op.payer = d.get_global_properties().parameters.son_account();
|
||||
son_down_op.son_id = son_id;
|
||||
son_down_op.down_ts = last_active_ts;
|
||||
|
||||
|
|
|
|||
|
|
@ -71,9 +71,9 @@ void sidechain_net_handler::sidechain_event_data_received(const sidechain_event_
|
|||
const chain::global_property_object &gpo = database.get_global_properties();
|
||||
|
||||
// Deposit request
|
||||
if ((sed.peerplays_to == GRAPHENE_SON_ACCOUNT) && (sed.sidechain_currency.compare("1.3.0") != 0)) {
|
||||
if ((sed.peerplays_to == gpo.parameters.son_account()) && (sed.sidechain_currency.compare("1.3.0") != 0)) {
|
||||
son_wallet_deposit_create_operation op;
|
||||
op.payer = GRAPHENE_SON_ACCOUNT;
|
||||
op.payer = gpo.parameters.son_account();
|
||||
//op.son_id = ; // to be filled for each son
|
||||
op.timestamp = sed.timestamp;
|
||||
op.sidechain = sed.sidechain;
|
||||
|
|
@ -112,7 +112,7 @@ void sidechain_net_handler::sidechain_event_data_received(const sidechain_event_
|
|||
}
|
||||
|
||||
// Withdrawal request
|
||||
if ((sed.peerplays_to == GRAPHENE_SON_ACCOUNT) && (sed.sidechain_currency.compare("1.3.0") == 0)) {
|
||||
if ((sed.peerplays_to == gpo.parameters.son_account()) && (sed.sidechain_currency.compare("1.3.0") == 0)) {
|
||||
// BTC Payout only (for now)
|
||||
const auto &sidechain_addresses_idx = database.get_index_type<sidechain_address_index>().indices().get<by_account_and_sidechain>();
|
||||
const auto &addr_itr = sidechain_addresses_idx.find(std::make_tuple(sed.peerplays_from, sidechain_type::bitcoin));
|
||||
|
|
@ -120,7 +120,7 @@ void sidechain_net_handler::sidechain_event_data_received(const sidechain_event_
|
|||
return;
|
||||
|
||||
son_wallet_withdraw_create_operation op;
|
||||
op.payer = GRAPHENE_SON_ACCOUNT;
|
||||
op.payer = gpo.parameters.son_account();
|
||||
//op.son_id = ; // to be filled for each son
|
||||
op.timestamp = sed.timestamp;
|
||||
op.sidechain = sed.sidechain;
|
||||
|
|
@ -173,7 +173,7 @@ void sidechain_net_handler::process_deposits() {
|
|||
const chain::global_property_object &gpo = plugin.database().get_global_properties();
|
||||
|
||||
son_wallet_deposit_process_operation p_op;
|
||||
p_op.payer = GRAPHENE_SON_ACCOUNT;
|
||||
p_op.payer = gpo.parameters.son_account();
|
||||
p_op.son_wallet_deposit_id = swdo.id;
|
||||
|
||||
proposal_create_operation proposal_op;
|
||||
|
|
@ -207,7 +207,7 @@ void sidechain_net_handler::process_withdrawals() {
|
|||
const chain::global_property_object &gpo = plugin.database().get_global_properties();
|
||||
|
||||
son_wallet_withdraw_process_operation p_op;
|
||||
p_op.payer = GRAPHENE_SON_ACCOUNT;
|
||||
p_op.payer = gpo.parameters.son_account();
|
||||
p_op.son_wallet_withdraw_id = swwo.id;
|
||||
|
||||
proposal_create_operation proposal_op;
|
||||
|
|
|
|||
|
|
@ -634,7 +634,7 @@ void sidechain_net_handler_bitcoin::recreate_primary_wallet() {
|
|||
boost::property_tree::json_parser::write_json(res, active_pw_pt.get_child("result"));
|
||||
|
||||
son_wallet_update_operation op;
|
||||
op.payer = GRAPHENE_SON_ACCOUNT;
|
||||
op.payer = gpo.parameters.son_account();
|
||||
op.son_wallet_id = (*active_sw).id;
|
||||
op.sidechain = sidechain_type::bitcoin;
|
||||
op.address = res.str();
|
||||
|
|
@ -876,7 +876,7 @@ void sidechain_net_handler_bitcoin::handle_event(const std::string &event_data)
|
|||
sed.sidechain_currency = "BTC";
|
||||
sed.sidechain_amount = v.out.amount;
|
||||
sed.peerplays_from = addr_itr->sidechain_address_account;
|
||||
sed.peerplays_to = GRAPHENE_SON_ACCOUNT;
|
||||
sed.peerplays_to = database.get_global_properties().parameters.son_account();
|
||||
sed.peerplays_asset = asset(sed.sidechain_amount / 1000); // For Bitcoin, the exchange rate is 1:1, for others, get the exchange rate from market
|
||||
sidechain_event_data_received(sed);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ void sidechain_net_handler_peerplays::on_applied_block(const signed_block &b) {
|
|||
operation_index = operation_index + 1;
|
||||
if (op.which() == operation::tag<transfer_operation>::value) {
|
||||
transfer_operation transfer_op = op.get<transfer_operation>();
|
||||
if (transfer_op.to != GRAPHENE_SON_ACCOUNT) {
|
||||
if (transfer_op.to != plugin.database().get_global_properties().parameters.son_account()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -151,7 +151,7 @@ BOOST_AUTO_TEST_CASE(bitcoin_transaction_send_test)
|
|||
generate_block();
|
||||
|
||||
const auto& acc_idx = db.get_index_type<account_index>().indices().get<by_id>();
|
||||
auto acc_itr = acc_idx.find(GRAPHENE_SON_ACCOUNT);
|
||||
auto acc_itr = acc_idx.find(db.get_global_properties().parameters.son_account());
|
||||
BOOST_REQUIRE(acc_itr != acc_idx.end());
|
||||
db.modify(*acc_itr, [&](account_object &obj) {
|
||||
obj.active.account_auths.clear();
|
||||
|
|
@ -195,7 +195,7 @@ BOOST_AUTO_TEST_CASE(bitcoin_transaction_send_test)
|
|||
|
||||
bitcoin_transaction_send_operation send_op;
|
||||
|
||||
send_op.payer = GRAPHENE_SON_ACCOUNT;
|
||||
send_op.payer = gpo.parameters.son_account();
|
||||
|
||||
proposal_create_operation proposal_op;
|
||||
proposal_op.fee_paying_account = alice_id;
|
||||
|
|
@ -317,7 +317,7 @@ BOOST_AUTO_TEST_CASE(bitcoin_transaction_send_test)
|
|||
|
||||
bitcoin_send_transaction_process_operation process_op;
|
||||
process_op.bitcoin_transaction_id = bitcoin_transaction_id_type(0);
|
||||
process_op.payer = GRAPHENE_SON_ACCOUNT;
|
||||
process_op.payer = db.get_global_properties().parameters.son_account();
|
||||
|
||||
proposal_create_operation proposal_op;
|
||||
proposal_op.fee_paying_account = alice_id;
|
||||
|
|
|
|||
|
|
@ -220,7 +220,7 @@ try {
|
|||
son_delete_operation op;
|
||||
op.owner_account = alice_id;
|
||||
op.son_id = son_id_type(0);
|
||||
op.payer = GRAPHENE_SON_ACCOUNT;
|
||||
op.payer = db.get_global_properties().parameters.son_account();
|
||||
|
||||
trx.operations.push_back(op);
|
||||
sign(trx, bob_private_key);
|
||||
|
|
@ -729,7 +729,7 @@ BOOST_AUTO_TEST_CASE( son_report_down_test ) {
|
|||
generate_block();
|
||||
// Send Report Down Operation for an active status SON
|
||||
son_report_down_operation op;
|
||||
op.payer = GRAPHENE_SON_ACCOUNT;
|
||||
op.payer = db.get_global_properties().parameters.son_account();
|
||||
op.son_id = son_id_type(0);
|
||||
op.down_ts = fc::time_point_sec(son_stats_obj->last_active_timestamp - fc::seconds(1));
|
||||
|
||||
|
|
@ -742,7 +742,7 @@ BOOST_AUTO_TEST_CASE( son_report_down_test ) {
|
|||
}
|
||||
|
||||
{
|
||||
// Check that transaction fails if payer is not GRAPHENE_SON_ACCOUNT.
|
||||
// Check that transaction fails if payer is not db.get_global_properties().parameters.son_account().
|
||||
generate_block();
|
||||
// Send Report Down Operation for an active status SON
|
||||
son_report_down_operation op;
|
||||
|
|
@ -759,11 +759,11 @@ BOOST_AUTO_TEST_CASE( son_report_down_test ) {
|
|||
}
|
||||
|
||||
{
|
||||
// Check that transaction succeeds after getting enough approvals on GRAPHENE_SON_ACCOUNT.
|
||||
// Check that transaction succeeds after getting enough approvals on db.get_global_properties().parameters.son_account().
|
||||
generate_block();
|
||||
// Send Report Down Operation for an active status SON
|
||||
son_report_down_operation op;
|
||||
op.payer = GRAPHENE_SON_ACCOUNT;
|
||||
op.payer = db.get_global_properties().parameters.son_account();
|
||||
op.son_id = son_id_type(0);
|
||||
op.down_ts = son_stats_obj->last_active_timestamp;
|
||||
|
||||
|
|
@ -783,7 +783,7 @@ BOOST_AUTO_TEST_CASE( son_report_down_test ) {
|
|||
generate_block();
|
||||
// Send Report Down Operation for an active status SON
|
||||
son_report_down_operation op;
|
||||
op.payer = GRAPHENE_SON_ACCOUNT;
|
||||
op.payer = db.get_global_properties().parameters.son_account();
|
||||
op.son_id = son_id_type(0);
|
||||
op.down_ts = son_stats_obj->last_active_timestamp;
|
||||
|
||||
|
|
|
|||
|
|
@ -152,7 +152,7 @@ BOOST_AUTO_TEST_CASE( son_wallet_recreate_test ) {
|
|||
|
||||
son_wallet_recreate_operation op;
|
||||
|
||||
op.payer = GRAPHENE_SON_ACCOUNT;
|
||||
op.payer = db.get_global_properties().parameters.son_account();
|
||||
|
||||
{
|
||||
son_info si;
|
||||
|
|
@ -199,7 +199,7 @@ BOOST_AUTO_TEST_CASE( son_wallet_update_test ) {
|
|||
|
||||
son_wallet_update_operation op;
|
||||
|
||||
op.payer = GRAPHENE_SON_ACCOUNT;
|
||||
op.payer = db.get_global_properties().parameters.son_account();
|
||||
op.son_wallet_id = son_wallet_id_type(0);
|
||||
op.sidechain = graphene::peerplays_sidechain::sidechain_type::bitcoin;
|
||||
op.address = "bitcoin address";
|
||||
|
|
|
|||
Loading…
Reference in a new issue