Full Peerplays listener, use GRAPHENE_SON_ACCOUNT instead son_btc_account
This commit is contained in:
parent
188a412143
commit
4b01d8064f
20 changed files with 99 additions and 174 deletions
|
|
@ -458,7 +458,8 @@ void database::update_active_sons()
|
||||||
a.active.weight_threshold += votes;
|
a.active.weight_threshold += votes;
|
||||||
}
|
}
|
||||||
|
|
||||||
a.active.weight_threshold /= 2;
|
a.active.weight_threshold *= 2;
|
||||||
|
a.active.weight_threshold /= 3;
|
||||||
a.active.weight_threshold += 1;
|
a.active.weight_threshold += 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -466,12 +467,11 @@ void database::update_active_sons()
|
||||||
vote_counter vc;
|
vote_counter vc;
|
||||||
for( const son_object& son : sons )
|
for( const son_object& son : sons )
|
||||||
vc.add( son.son_account, std::max(_vote_tally_buffer[son.vote_id], UINT64_C(1)) );
|
vc.add( son.son_account, std::max(_vote_tally_buffer[son.vote_id], UINT64_C(1)) );
|
||||||
vc.finish( a.active );
|
vc.finish_2_3( a.active );
|
||||||
}
|
}
|
||||||
} );
|
} );
|
||||||
|
|
||||||
// Compare current and to-be lists of active sons
|
// Compare current and to-be lists of active sons
|
||||||
//const global_property_object& gpo = get_global_properties();
|
|
||||||
auto cur_active_sons = gpo.active_sons;
|
auto cur_active_sons = gpo.active_sons;
|
||||||
vector<son_info> new_active_sons;
|
vector<son_info> new_active_sons;
|
||||||
for( const son_object& son : sons ) {
|
for( const son_object& son : sons ) {
|
||||||
|
|
@ -602,83 +602,6 @@ void database::update_active_sons()
|
||||||
|
|
||||||
update_son_metrics();
|
update_son_metrics();
|
||||||
|
|
||||||
if(gpo.active_sons.size() > 0 ) {
|
|
||||||
if(gpo.parameters.get_son_btc_account_id() == GRAPHENE_NULL_ACCOUNT) {
|
|
||||||
const auto& son_btc_account = create<account_object>( [&]( account_object& obj ) {
|
|
||||||
uint64_t total_votes = 0;
|
|
||||||
obj.name = "son_btc_account";
|
|
||||||
obj.statistics = create<account_statistics_object>([&]( account_statistics_object& acc_stat ){ acc_stat.owner = obj.id; }).id;
|
|
||||||
obj.membership_expiration_date = time_point_sec::maximum();
|
|
||||||
obj.network_fee_percentage = GRAPHENE_DEFAULT_NETWORK_PERCENT_OF_FEE;
|
|
||||||
obj.lifetime_referrer_fee_percentage = GRAPHENE_100_PERCENT - GRAPHENE_DEFAULT_NETWORK_PERCENT_OF_FEE;
|
|
||||||
|
|
||||||
for( const auto& son_info : gpo.active_sons )
|
|
||||||
{
|
|
||||||
const son_object& son = get(son_info.son_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& son_info : gpo.active_sons )
|
|
||||||
{
|
|
||||||
// Ensure that everyone has at least one vote. Zero weights aren't allowed.
|
|
||||||
const son_object& son = get(son_info.son_id);
|
|
||||||
uint16_t votes = std::max((_vote_tally_buffer[son.vote_id] >> bits_to_drop), uint64_t(1) );
|
|
||||||
obj.owner.account_auths[son.son_account] += votes;
|
|
||||||
obj.owner.weight_threshold += votes;
|
|
||||||
obj.active.account_auths[son.son_account] += votes;
|
|
||||||
obj.active.weight_threshold += votes;
|
|
||||||
}
|
|
||||||
obj.owner.weight_threshold *= 2;
|
|
||||||
obj.owner.weight_threshold /= 3;
|
|
||||||
obj.owner.weight_threshold += 1;
|
|
||||||
obj.active.weight_threshold *= 2;
|
|
||||||
obj.active.weight_threshold /= 3;
|
|
||||||
obj.active.weight_threshold += 1;
|
|
||||||
});
|
|
||||||
|
|
||||||
modify( gpo, [&]( global_property_object& gpo ) {
|
|
||||||
gpo.parameters.extensions.value.son_btc_account = son_btc_account.get_id();
|
|
||||||
if( gpo.pending_parameters )
|
|
||||||
gpo.pending_parameters->extensions.value.son_btc_account = son_btc_account.get_id();
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
modify( get(gpo.parameters.get_son_btc_account_id()), [&]( account_object& obj )
|
|
||||||
{
|
|
||||||
uint64_t total_votes = 0;
|
|
||||||
obj.owner.weight_threshold = 0;
|
|
||||||
obj.owner.account_auths.clear();
|
|
||||||
obj.active.weight_threshold = 0;
|
|
||||||
obj.active.account_auths.clear();
|
|
||||||
for( const auto& son_info : gpo.active_sons )
|
|
||||||
{
|
|
||||||
const son_object& son = get(son_info.son_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& son_info : gpo.active_sons )
|
|
||||||
{
|
|
||||||
// Ensure that everyone has at least one vote. Zero weights aren't allowed.
|
|
||||||
const son_object& son = get(son_info.son_id);
|
|
||||||
uint16_t votes = std::max((_vote_tally_buffer[son.vote_id] >> bits_to_drop), uint64_t(1) );
|
|
||||||
obj.owner.account_auths[son.son_account] += votes;
|
|
||||||
obj.owner.weight_threshold += votes;
|
|
||||||
obj.active.account_auths[son.son_account] += votes;
|
|
||||||
obj.active.weight_threshold += votes;
|
|
||||||
}
|
|
||||||
obj.owner.weight_threshold *= 2;
|
|
||||||
obj.owner.weight_threshold /= 3;
|
|
||||||
obj.owner.weight_threshold += 1;
|
|
||||||
obj.active.weight_threshold *= 2;
|
|
||||||
obj.active.weight_threshold /= 3;
|
|
||||||
obj.active.weight_threshold += 1;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} FC_CAPTURE_AND_RETHROW() }
|
} FC_CAPTURE_AND_RETHROW() }
|
||||||
|
|
||||||
void database::initialize_budget_record( fc::time_point_sec now, budget_record& rec )const
|
void database::initialize_budget_record( fc::time_point_sec now, budget_record& rec )const
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,6 @@ namespace graphene { namespace chain {
|
||||||
optional < uint32_t > son_vesting_amount;
|
optional < uint32_t > son_vesting_amount;
|
||||||
optional < uint32_t > son_vesting_period;
|
optional < uint32_t > son_vesting_period;
|
||||||
optional < uint32_t > son_pay_daily_max;
|
optional < uint32_t > son_pay_daily_max;
|
||||||
optional < account_id_type > son_btc_account;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct chain_parameters
|
struct chain_parameters
|
||||||
|
|
@ -139,9 +138,6 @@ namespace graphene { namespace chain {
|
||||||
inline uint16_t son_pay_daily_max()const {
|
inline uint16_t son_pay_daily_max()const {
|
||||||
return extensions.value.son_pay_daily_max.valid() ? *extensions.value.son_pay_daily_max : MIN_SON_PAY_DAILY_MAX;
|
return extensions.value.son_pay_daily_max.valid() ? *extensions.value.son_pay_daily_max : MIN_SON_PAY_DAILY_MAX;
|
||||||
}
|
}
|
||||||
inline account_id_type get_son_btc_account_id() const {
|
|
||||||
return extensions.value.son_btc_account.valid() ? *extensions.value.son_btc_account : GRAPHENE_NULL_ACCOUNT;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} } // graphene::chain
|
} } // graphene::chain
|
||||||
|
|
@ -159,7 +155,6 @@ FC_REFLECT( graphene::chain::parameter_extension,
|
||||||
(son_vesting_amount)
|
(son_vesting_amount)
|
||||||
(son_vesting_period)
|
(son_vesting_period)
|
||||||
(son_pay_daily_max)
|
(son_pay_daily_max)
|
||||||
(son_btc_account)
|
|
||||||
)
|
)
|
||||||
|
|
||||||
FC_REFLECT( graphene::chain::chain_parameters,
|
FC_REFLECT( graphene::chain::chain_parameters,
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <graphene/chain/protocol/base.hpp>
|
#include <graphene/chain/protocol/base.hpp>
|
||||||
|
|
||||||
|
#include <fc/safe.hpp>
|
||||||
|
|
||||||
namespace graphene { namespace chain {
|
namespace graphene { namespace chain {
|
||||||
|
|
||||||
struct son_wallet_transfer_create_operation : public base_operation
|
struct son_wallet_transfer_create_operation : public base_operation
|
||||||
|
|
@ -16,10 +18,11 @@ namespace graphene { namespace chain {
|
||||||
std::string sidechain_transaction_id;
|
std::string sidechain_transaction_id;
|
||||||
std::string sidechain_from;
|
std::string sidechain_from;
|
||||||
std::string sidechain_to;
|
std::string sidechain_to;
|
||||||
int64_t sidechain_amount;
|
std::string sidechain_currency;
|
||||||
|
fc::safe<int64_t> sidechain_amount;
|
||||||
chain::account_id_type peerplays_from;
|
chain::account_id_type peerplays_from;
|
||||||
chain::account_id_type peerplays_to;
|
chain::account_id_type peerplays_to;
|
||||||
chain::asset peerplays_amount;
|
chain::asset peerplays_asset;
|
||||||
|
|
||||||
account_id_type fee_payer()const { return payer; }
|
account_id_type fee_payer()const { return payer; }
|
||||||
share_type calculate_fee(const fee_parameters_type& k)const { return 0; }
|
share_type calculate_fee(const fee_parameters_type& k)const { return 0; }
|
||||||
|
|
@ -42,7 +45,7 @@ namespace graphene { namespace chain {
|
||||||
|
|
||||||
FC_REFLECT(graphene::chain::son_wallet_transfer_create_operation::fee_parameters_type, (fee) )
|
FC_REFLECT(graphene::chain::son_wallet_transfer_create_operation::fee_parameters_type, (fee) )
|
||||||
FC_REFLECT(graphene::chain::son_wallet_transfer_create_operation, (fee)(payer)
|
FC_REFLECT(graphene::chain::son_wallet_transfer_create_operation, (fee)(payer)
|
||||||
(timestamp) (sidechain) (sidechain_uid) (sidechain_transaction_id) (sidechain_from) (sidechain_to) (sidechain_amount) (peerplays_from) (peerplays_to) (peerplays_amount))
|
(timestamp) (sidechain) (sidechain_uid) (sidechain_transaction_id) (sidechain_from) (sidechain_to) (sidechain_currency) (sidechain_amount) (peerplays_from) (peerplays_to) (peerplays_asset))
|
||||||
FC_REFLECT(graphene::chain::son_wallet_transfer_process_operation::fee_parameters_type, (fee) )
|
FC_REFLECT(graphene::chain::son_wallet_transfer_process_operation::fee_parameters_type, (fee) )
|
||||||
FC_REFLECT(graphene::chain::son_wallet_transfer_process_operation, (fee)(payer)
|
FC_REFLECT(graphene::chain::son_wallet_transfer_process_operation, (fee)(payer)
|
||||||
(son_wallet_transfer_id))
|
(son_wallet_transfer_id))
|
||||||
|
|
|
||||||
|
|
@ -23,10 +23,11 @@ namespace graphene { namespace chain {
|
||||||
std::string sidechain_transaction_id;
|
std::string sidechain_transaction_id;
|
||||||
std::string sidechain_from;
|
std::string sidechain_from;
|
||||||
std::string sidechain_to;
|
std::string sidechain_to;
|
||||||
int64_t sidechain_amount;
|
std::string sidechain_currency;
|
||||||
|
safe<int64_t> sidechain_amount;
|
||||||
chain::account_id_type peerplays_from;
|
chain::account_id_type peerplays_from;
|
||||||
chain::account_id_type peerplays_to;
|
chain::account_id_type peerplays_to;
|
||||||
chain::asset peerplays_amount;
|
chain::asset peerplays_asset;
|
||||||
|
|
||||||
bool processed;
|
bool processed;
|
||||||
};
|
};
|
||||||
|
|
@ -63,6 +64,6 @@ namespace graphene { namespace chain {
|
||||||
|
|
||||||
FC_REFLECT_DERIVED( graphene::chain::son_wallet_transfer_object, (graphene::db::object),
|
FC_REFLECT_DERIVED( graphene::chain::son_wallet_transfer_object, (graphene::db::object),
|
||||||
(timestamp) (sidechain) (confirmations)
|
(timestamp) (sidechain) (confirmations)
|
||||||
(sidechain_uid) (sidechain_transaction_id) (sidechain_from) (sidechain_to) (sidechain_amount)
|
(sidechain_uid) (sidechain_transaction_id) (sidechain_from) (sidechain_to) (sidechain_currency) (sidechain_amount)
|
||||||
(peerplays_from) (peerplays_to) (peerplays_amount)
|
(peerplays_from) (peerplays_to) (peerplays_asset)
|
||||||
(processed) )
|
(processed) )
|
||||||
|
|
|
||||||
|
|
@ -63,6 +63,17 @@ struct vote_counter
|
||||||
out_auth = auth;
|
out_auth = auth;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void finish_2_3( authority& out_auth )
|
||||||
|
{
|
||||||
|
if( total_votes == 0 )
|
||||||
|
return;
|
||||||
|
assert( total_votes <= std::numeric_limits<uint32_t>::max() );
|
||||||
|
uint32_t weight = uint32_t( total_votes );
|
||||||
|
weight = (weight * 2 / 3) + 1;
|
||||||
|
auth.weight_threshold = weight;
|
||||||
|
out_auth = auth;
|
||||||
|
}
|
||||||
|
|
||||||
bool is_empty()const
|
bool is_empty()const
|
||||||
{
|
{
|
||||||
return (total_votes == 0);
|
return (total_votes == 0);
|
||||||
|
|
|
||||||
|
|
@ -166,7 +166,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)
|
void_result son_report_down_evaluator::do_evaluate(const son_report_down_operation& op)
|
||||||
{ try {
|
{ try {
|
||||||
FC_ASSERT(db().head_block_time() >= HARDFORK_SON_TIME, "Not allowed until SON HARDFORK"); // can be removed after HF date pass
|
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 == db().get_global_properties().parameters.get_son_btc_account_id(), "Payer should be the son btc account");
|
FC_ASSERT(op.payer == GRAPHENE_SON_ACCOUNT, "SON paying account must be set as payer.");
|
||||||
const auto& idx = db().get_index_type<son_index>().indices().get<by_id>();
|
const auto& idx = db().get_index_type<son_index>().indices().get<by_id>();
|
||||||
FC_ASSERT( idx.find(op.son_id) != idx.end() );
|
FC_ASSERT( idx.find(op.son_id) != idx.end() );
|
||||||
auto itr = idx.find(op.son_id);
|
auto itr = idx.find(op.son_id);
|
||||||
|
|
|
||||||
|
|
@ -8,8 +8,7 @@ namespace graphene { namespace chain {
|
||||||
void_result recreate_son_wallet_evaluator::do_evaluate(const son_wallet_recreate_operation& op)
|
void_result recreate_son_wallet_evaluator::do_evaluate(const son_wallet_recreate_operation& op)
|
||||||
{ try{
|
{ try{
|
||||||
FC_ASSERT(db().head_block_time() >= HARDFORK_SON_TIME, "Not allowed until SON HARDFORK");
|
FC_ASSERT(db().head_block_time() >= HARDFORK_SON_TIME, "Not allowed until SON HARDFORK");
|
||||||
//FC_ASSERT(db().get_global_properties().parameters.get_son_btc_account_id() != GRAPHENE_NULL_ACCOUNT, "SON paying account not set.");
|
FC_ASSERT( op.payer == GRAPHENE_SON_ACCOUNT, "SON paying account must be set as payer." );
|
||||||
FC_ASSERT( op.payer == db().get_global_properties().parameters.get_son_btc_account_id(), "SON paying account must be set as payer." );
|
|
||||||
|
|
||||||
const auto& idx = db().get_index_type<son_wallet_index>().indices().get<by_id>();
|
const auto& idx = db().get_index_type<son_wallet_index>().indices().get<by_id>();
|
||||||
auto itr = idx.rbegin();
|
auto itr = idx.rbegin();
|
||||||
|
|
@ -54,8 +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)
|
void_result update_son_wallet_evaluator::do_evaluate(const son_wallet_update_operation& op)
|
||||||
{ try{
|
{ try{
|
||||||
FC_ASSERT(db().head_block_time() >= HARDFORK_SON_TIME, "Not allowed until SON HARDFORK");
|
FC_ASSERT(db().head_block_time() >= HARDFORK_SON_TIME, "Not allowed until SON HARDFORK");
|
||||||
//FC_ASSERT(db().get_global_properties().parameters.get_son_btc_account_id() != GRAPHENE_NULL_ACCOUNT, "SON paying account not set.");
|
FC_ASSERT( op.payer == GRAPHENE_SON_ACCOUNT, "SON paying account must be set as payer." );
|
||||||
FC_ASSERT( op.payer == db().get_global_properties().parameters.get_son_btc_account_id(), "SON paying account must be set as payer." );
|
|
||||||
|
|
||||||
const auto& idx = db().get_index_type<son_wallet_index>().indices().get<by_id>();
|
const auto& idx = db().get_index_type<son_wallet_index>().indices().get<by_id>();
|
||||||
FC_ASSERT( idx.find(op.son_wallet_id) != idx.end() );
|
FC_ASSERT( idx.find(op.son_wallet_id) != idx.end() );
|
||||||
|
|
|
||||||
|
|
@ -9,8 +9,7 @@ namespace graphene { namespace chain {
|
||||||
void_result create_son_wallet_transfer_evaluator::do_evaluate(const son_wallet_transfer_create_operation& op)
|
void_result create_son_wallet_transfer_evaluator::do_evaluate(const son_wallet_transfer_create_operation& op)
|
||||||
{ try{
|
{ try{
|
||||||
FC_ASSERT(db().head_block_time() >= HARDFORK_SON_TIME, "Not allowed until SON HARDFORK");
|
FC_ASSERT(db().head_block_time() >= HARDFORK_SON_TIME, "Not allowed until SON HARDFORK");
|
||||||
//FC_ASSERT(db().get_global_properties().parameters.get_son_btc_account_id() != GRAPHENE_NULL_ACCOUNT, "SON paying account not set.");
|
FC_ASSERT( op.payer == GRAPHENE_SON_ACCOUNT, "SON paying account must be set as payer." );
|
||||||
FC_ASSERT( op.payer == db().get_global_properties().parameters.get_son_btc_account_id(), "SON paying account must be set as payer." );
|
|
||||||
|
|
||||||
//const auto& idx = db().get_index_type<son_wallet_transfer_index>().indices().get<by_sidechain_uid>();
|
//const auto& idx = db().get_index_type<son_wallet_transfer_index>().indices().get<by_sidechain_uid>();
|
||||||
//FC_ASSERT(idx.find(op.sidechain_uid) == idx.end(), "Already registered " + op.sidechain_uid);
|
//FC_ASSERT(idx.find(op.sidechain_uid) == idx.end(), "Already registered " + op.sidechain_uid);
|
||||||
|
|
@ -33,7 +32,7 @@ object_id_type create_son_wallet_transfer_evaluator::do_apply(const son_wallet_t
|
||||||
swto.sidechain_amount = op.sidechain_amount;
|
swto.sidechain_amount = op.sidechain_amount;
|
||||||
swto.peerplays_from = op.peerplays_from;
|
swto.peerplays_from = op.peerplays_from;
|
||||||
swto.peerplays_to = op.peerplays_to;
|
swto.peerplays_to = op.peerplays_to;
|
||||||
swto.peerplays_amount = op.peerplays_amount;
|
swto.peerplays_asset = op.peerplays_asset;
|
||||||
swto.processed = false;
|
swto.processed = false;
|
||||||
});
|
});
|
||||||
return new_son_wallet_transfer_object.id;
|
return new_son_wallet_transfer_object.id;
|
||||||
|
|
@ -48,8 +47,7 @@ object_id_type create_son_wallet_transfer_evaluator::do_apply(const son_wallet_t
|
||||||
void_result process_son_wallet_transfer_evaluator::do_evaluate(const son_wallet_transfer_process_operation& op)
|
void_result process_son_wallet_transfer_evaluator::do_evaluate(const son_wallet_transfer_process_operation& op)
|
||||||
{ try{
|
{ try{
|
||||||
FC_ASSERT(db().head_block_time() >= HARDFORK_SON_TIME, "Not allowed until SON HARDFORK");
|
FC_ASSERT(db().head_block_time() >= HARDFORK_SON_TIME, "Not allowed until SON HARDFORK");
|
||||||
//FC_ASSERT(db().get_global_properties().parameters.get_son_btc_account_id() != GRAPHENE_NULL_ACCOUNT, "SON paying account not set.");
|
FC_ASSERT( op.payer == GRAPHENE_SON_ACCOUNT, "SON paying account must be set as payer." );
|
||||||
FC_ASSERT( op.payer == db().get_global_properties().parameters.get_son_btc_account_id(), "SON paying account must be set as payer." );
|
|
||||||
|
|
||||||
const auto& idx = db().get_index_type<son_wallet_transfer_index>().indices().get<by_id>();
|
const auto& idx = db().get_index_type<son_wallet_transfer_index>().indices().get<by_id>();
|
||||||
const auto& itr = idx.find(op.son_wallet_transfer_id);
|
const auto& itr = idx.find(op.son_wallet_transfer_id);
|
||||||
|
|
@ -60,7 +58,7 @@ void_result process_son_wallet_transfer_evaluator::do_evaluate(const son_wallet_
|
||||||
|
|
||||||
const account_object& from_account = itr->peerplays_to(d); // reversed, for deposit
|
const account_object& from_account = itr->peerplays_to(d); // reversed, for deposit
|
||||||
const account_object& to_account = itr->peerplays_from(d); // reversed, for deposit
|
const account_object& to_account = itr->peerplays_from(d); // reversed, for deposit
|
||||||
const asset_object& asset_type = itr->peerplays_amount.asset_id(d);
|
const asset_object& asset_type = itr->peerplays_asset.asset_id(d);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
|
|
@ -69,14 +67,14 @@ void_result process_son_wallet_transfer_evaluator::do_evaluate(const son_wallet_
|
||||||
transfer_from_account_not_whitelisted,
|
transfer_from_account_not_whitelisted,
|
||||||
"'from' account ${from} is not whitelisted for asset ${asset}",
|
"'from' account ${from} is not whitelisted for asset ${asset}",
|
||||||
("from",from_account.id)
|
("from",from_account.id)
|
||||||
("asset",itr->peerplays_amount.asset_id)
|
("asset",itr->peerplays_asset.asset_id)
|
||||||
);
|
);
|
||||||
GRAPHENE_ASSERT(
|
GRAPHENE_ASSERT(
|
||||||
is_authorized_asset( d, to_account, asset_type ),
|
is_authorized_asset( d, to_account, asset_type ),
|
||||||
transfer_to_account_not_whitelisted,
|
transfer_to_account_not_whitelisted,
|
||||||
"'to' account ${to} is not whitelisted for asset ${asset}",
|
"'to' account ${to} is not whitelisted for asset ${asset}",
|
||||||
("to",to_account.id)
|
("to",to_account.id)
|
||||||
("asset",itr->peerplays_amount.asset_id)
|
("asset",itr->peerplays_asset.asset_id)
|
||||||
);
|
);
|
||||||
|
|
||||||
if( asset_type.is_transfer_restricted() )
|
if( asset_type.is_transfer_restricted() )
|
||||||
|
|
@ -85,17 +83,17 @@ void_result process_son_wallet_transfer_evaluator::do_evaluate(const son_wallet_
|
||||||
from_account.id == asset_type.issuer || to_account.id == asset_type.issuer,
|
from_account.id == asset_type.issuer || to_account.id == asset_type.issuer,
|
||||||
transfer_restricted_transfer_asset,
|
transfer_restricted_transfer_asset,
|
||||||
"Asset {asset} has transfer_restricted flag enabled",
|
"Asset {asset} has transfer_restricted flag enabled",
|
||||||
("asset", itr->peerplays_amount.asset_id)
|
("asset", itr->peerplays_asset.asset_id)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool insufficient_balance = d.get_balance( from_account, asset_type ).amount >= itr->peerplays_amount.amount;
|
bool insufficient_balance = d.get_balance( from_account, asset_type ).amount >= itr->peerplays_asset.amount;
|
||||||
FC_ASSERT( insufficient_balance,
|
FC_ASSERT( insufficient_balance,
|
||||||
"Insufficient Balance: ${balance}, unable to transfer '${total_transfer}' from account '${a}' to '${t}'",
|
"Insufficient Balance: ${balance}, unable to transfer '${total_transfer}' from account '${a}' to '${t}'",
|
||||||
("a",from_account.name)("t",to_account.name)("total_transfer",d.to_pretty_string(itr->peerplays_amount))("balance",d.to_pretty_string(d.get_balance(from_account, asset_type))) );
|
("a",from_account.name)("t",to_account.name)("total_transfer",d.to_pretty_string(itr->peerplays_asset))("balance",d.to_pretty_string(d.get_balance(from_account, asset_type))) );
|
||||||
|
|
||||||
return void_result();
|
return void_result();
|
||||||
} FC_RETHROW_EXCEPTIONS( error, "Unable to transfer ${a} from ${f} to ${t}", ("a",d.to_pretty_string(itr->peerplays_amount))("f",from_account.name)("t",to_account.name) );
|
} FC_RETHROW_EXCEPTIONS( error, "Unable to transfer ${a} from ${f} to ${t}", ("a",d.to_pretty_string(itr->peerplays_asset))("f",from_account.name)("t",to_account.name) );
|
||||||
} FC_CAPTURE_AND_RETHROW( (op) ) }
|
} FC_CAPTURE_AND_RETHROW( (op) ) }
|
||||||
|
|
||||||
object_id_type process_son_wallet_transfer_evaluator::do_apply(const son_wallet_transfer_process_operation& op)
|
object_id_type process_son_wallet_transfer_evaluator::do_apply(const son_wallet_transfer_process_operation& op)
|
||||||
|
|
@ -112,8 +110,8 @@ object_id_type process_son_wallet_transfer_evaluator::do_apply(const son_wallet_
|
||||||
const account_id_type from_account = itr->peerplays_to; // reversed, for deposit
|
const account_id_type from_account = itr->peerplays_to; // reversed, for deposit
|
||||||
const account_id_type to_account = itr->peerplays_from; // reversed, for deposit
|
const account_id_type to_account = itr->peerplays_from; // reversed, for deposit
|
||||||
|
|
||||||
db().adjust_balance( from_account, -itr->peerplays_amount );
|
db().adjust_balance( from_account, -itr->peerplays_asset );
|
||||||
db().adjust_balance( to_account, itr->peerplays_amount );
|
db().adjust_balance( to_account, itr->peerplays_asset );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return op.son_wallet_transfer_id;
|
return op.son_wallet_transfer_id;
|
||||||
|
|
|
||||||
|
|
@ -4,9 +4,11 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
#include <fc/safe.hpp>
|
||||||
#include <fc/time.hpp>
|
#include <fc/time.hpp>
|
||||||
#include <fc/crypto/sha256.hpp>
|
#include <fc/crypto/sha256.hpp>
|
||||||
|
|
||||||
|
#include <graphene/chain/protocol/asset.hpp>
|
||||||
#include <graphene/chain/protocol/types.hpp>
|
#include <graphene/chain/protocol/types.hpp>
|
||||||
|
|
||||||
namespace graphene { namespace peerplays_sidechain {
|
namespace graphene { namespace peerplays_sidechain {
|
||||||
|
|
@ -70,9 +72,11 @@ struct sidechain_event_data {
|
||||||
std::string sidechain_transaction_id;
|
std::string sidechain_transaction_id;
|
||||||
std::string sidechain_from;
|
std::string sidechain_from;
|
||||||
std::string sidechain_to;
|
std::string sidechain_to;
|
||||||
int64_t sidechain_amount;
|
std::string sidechain_currency;
|
||||||
|
fc::safe<int64_t> sidechain_amount;
|
||||||
chain::account_id_type peerplays_from;
|
chain::account_id_type peerplays_from;
|
||||||
chain::account_id_type peerplays_to;
|
chain::account_id_type peerplays_to;
|
||||||
|
chain::asset peerplays_asset;
|
||||||
};
|
};
|
||||||
|
|
||||||
} } // graphene::peerplays_sidechain
|
} } // graphene::peerplays_sidechain
|
||||||
|
|
|
||||||
|
|
@ -32,8 +32,6 @@ protected:
|
||||||
virtual std::string sign_transaction( const std::string& transaction ) = 0;
|
virtual std::string sign_transaction( const std::string& transaction ) = 0;
|
||||||
virtual std::string send_transaction( const std::string& transaction ) = 0;
|
virtual std::string send_transaction( const std::string& transaction ) = 0;
|
||||||
|
|
||||||
virtual void handle_event( const std::string& event_data ) = 0;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
||||||
0
libraries/plugins/peerplays_sidechain/include/graphene/peerplays_sidechain/sidechain_net_handler_bitcoin.hpp
Executable file → Normal file
0
libraries/plugins/peerplays_sidechain/include/graphene/peerplays_sidechain/sidechain_net_handler_bitcoin.hpp
Executable file → Normal file
2
libraries/plugins/peerplays_sidechain/include/graphene/peerplays_sidechain/sidechain_net_handler_peerplays.hpp
Executable file → Normal file
2
libraries/plugins/peerplays_sidechain/include/graphene/peerplays_sidechain/sidechain_net_handler_peerplays.hpp
Executable file → Normal file
|
|
@ -22,9 +22,7 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
void handle_event( const std::string& event_data );
|
|
||||||
void on_block_applied(const signed_block& b);
|
void on_block_applied(const signed_block& b);
|
||||||
void on_changed_objects(const vector<object_id_type>& changed_object_ids);
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
4
libraries/plugins/peerplays_sidechain/peerplays_sidechain_plugin.cpp
Executable file → Normal file
4
libraries/plugins/peerplays_sidechain/peerplays_sidechain_plugin.cpp
Executable file → Normal file
|
|
@ -322,7 +322,7 @@ void peerplays_sidechain_plugin_impl::create_son_down_proposals()
|
||||||
auto son_obj = idx.find( my_son_id );
|
auto son_obj = idx.find( my_son_id );
|
||||||
|
|
||||||
chain::son_report_down_operation son_down_op;
|
chain::son_report_down_operation son_down_op;
|
||||||
son_down_op.payer = gpo.parameters.get_son_btc_account_id();
|
son_down_op.payer = GRAPHENE_SON_ACCOUNT;
|
||||||
son_down_op.son_id = son_id;
|
son_down_op.son_id = son_id;
|
||||||
son_down_op.down_ts = last_active_ts;
|
son_down_op.down_ts = last_active_ts;
|
||||||
|
|
||||||
|
|
@ -389,7 +389,7 @@ void peerplays_sidechain_plugin_impl::process_deposits() {
|
||||||
if (plugin.is_active_son(son_id)) {
|
if (plugin.is_active_son(son_id)) {
|
||||||
|
|
||||||
son_wallet_transfer_process_operation p_op;
|
son_wallet_transfer_process_operation p_op;
|
||||||
p_op.payer = gpo.parameters.get_son_btc_account_id();
|
p_op.payer = GRAPHENE_SON_ACCOUNT;
|
||||||
p_op.son_wallet_transfer_id = swto.id;
|
p_op.son_wallet_transfer_id = swto.id;
|
||||||
|
|
||||||
proposal_create_operation proposal_op;
|
proposal_create_operation proposal_op;
|
||||||
|
|
|
||||||
|
|
@ -49,24 +49,27 @@ void sidechain_net_handler::sidechain_event_data_received(const sidechain_event_
|
||||||
ilog( " sidechain_transaction_id: ${transaction_id}", ( "transaction_id", sed.sidechain_transaction_id ) );
|
ilog( " sidechain_transaction_id: ${transaction_id}", ( "transaction_id", sed.sidechain_transaction_id ) );
|
||||||
ilog( " sidechain_from: ${from}", ( "from", sed.sidechain_from ) );
|
ilog( " sidechain_from: ${from}", ( "from", sed.sidechain_from ) );
|
||||||
ilog( " sidechain_to: ${to}", ( "to", sed.sidechain_to ) );
|
ilog( " sidechain_to: ${to}", ( "to", sed.sidechain_to ) );
|
||||||
|
ilog( " sidechain_currency: ${currency}", ( "currency", sed.sidechain_currency ) );
|
||||||
ilog( " sidechain_amount: ${amount}", ( "amount", sed.sidechain_amount ) );
|
ilog( " sidechain_amount: ${amount}", ( "amount", sed.sidechain_amount ) );
|
||||||
ilog( " peerplays_from: ${peerplays_from}", ( "peerplays_from", sed.peerplays_from ) );
|
ilog( " peerplays_from: ${peerplays_from}", ( "peerplays_from", sed.peerplays_from ) );
|
||||||
ilog( " peerplays_to: ${peerplays_to}", ( "peerplays_to", sed.peerplays_to ) );
|
ilog( " peerplays_to: ${peerplays_to}", ( "peerplays_to", sed.peerplays_to ) );
|
||||||
|
ilog( " peerplays_asset: ${peerplays_asset}", ( "peerplays_asset", sed.peerplays_asset ) );
|
||||||
|
|
||||||
const chain::global_property_object& gpo = database.get_global_properties();
|
const chain::global_property_object& gpo = database.get_global_properties();
|
||||||
|
|
||||||
son_wallet_transfer_create_operation op;
|
son_wallet_transfer_create_operation op;
|
||||||
op.payer = gpo.parameters.get_son_btc_account_id();
|
op.payer = GRAPHENE_SON_ACCOUNT;
|
||||||
op.timestamp = sed.timestamp;
|
op.timestamp = sed.timestamp;
|
||||||
op.sidechain = sed.sidechain;
|
op.sidechain = sed.sidechain;
|
||||||
op.sidechain_uid = sed.sidechain_uid;
|
op.sidechain_uid = sed.sidechain_uid;
|
||||||
op.sidechain_transaction_id = sed.sidechain_transaction_id;
|
op.sidechain_transaction_id = sed.sidechain_transaction_id;
|
||||||
op.sidechain_from = sed.sidechain_from;
|
op.sidechain_from = sed.sidechain_from;
|
||||||
op.sidechain_to = sed.sidechain_to;
|
op.sidechain_to = sed.sidechain_to;
|
||||||
|
op.sidechain_currency = sed.sidechain_currency;
|
||||||
op.sidechain_amount = sed.sidechain_amount;
|
op.sidechain_amount = sed.sidechain_amount;
|
||||||
op.peerplays_from = sed.peerplays_from;
|
op.peerplays_from = sed.peerplays_from;
|
||||||
op.peerplays_to = sed.peerplays_to;
|
op.peerplays_to = sed.peerplays_to;
|
||||||
op.peerplays_amount = asset(sed.sidechain_amount / 1000); // For Bitcoin, the exchange rate is 1:1, for others, get the exchange rate from market
|
op.peerplays_asset = sed.peerplays_asset;
|
||||||
|
|
||||||
for (son_id_type son_id : plugin.get_sons()) {
|
for (son_id_type son_id : plugin.get_sons()) {
|
||||||
if (plugin.is_active_son(son_id)) {
|
if (plugin.is_active_son(son_id)) {
|
||||||
|
|
|
||||||
7
libraries/plugins/peerplays_sidechain/sidechain_net_handler_bitcoin.cpp
Executable file → Normal file
7
libraries/plugins/peerplays_sidechain/sidechain_net_handler_bitcoin.cpp
Executable file → Normal file
|
|
@ -282,7 +282,7 @@ void sidechain_net_handler_bitcoin::recreate_primary_wallet() {
|
||||||
boost::property_tree::json_parser::write_json(res, pt.get_child("result"));
|
boost::property_tree::json_parser::write_json(res, pt.get_child("result"));
|
||||||
|
|
||||||
son_wallet_update_operation op;
|
son_wallet_update_operation op;
|
||||||
op.payer = gpo.parameters.get_son_btc_account_id();
|
op.payer = GRAPHENE_SON_ACCOUNT;
|
||||||
op.son_wallet_id = (*obj).id;
|
op.son_wallet_id = (*obj).id;
|
||||||
op.sidechain = sidechain_type::bitcoin;
|
op.sidechain = sidechain_type::bitcoin;
|
||||||
op.address = res.str();
|
op.address = res.str();
|
||||||
|
|
@ -329,9 +329,6 @@ std::string sidechain_net_handler_bitcoin::send_transaction( const std::string&
|
||||||
}
|
}
|
||||||
|
|
||||||
void sidechain_net_handler_bitcoin::handle_event( const std::string& event_data ) {
|
void sidechain_net_handler_bitcoin::handle_event( const std::string& event_data ) {
|
||||||
ilog("peerplays sidechain plugin: sidechain_net_handler_bitcoin::handle_event");
|
|
||||||
ilog(" event_data: ${event_data}", ("event_data", event_data));
|
|
||||||
|
|
||||||
std::string block = bitcoin_client->receive_full_block( event_data );
|
std::string block = bitcoin_client->receive_full_block( event_data );
|
||||||
if( block != "" ) {
|
if( block != "" ) {
|
||||||
const auto& vins = extract_info_from_block( block );
|
const auto& vins = extract_info_from_block( block );
|
||||||
|
|
@ -354,9 +351,11 @@ void sidechain_net_handler_bitcoin::handle_event( const std::string& event_data
|
||||||
sed.sidechain_transaction_id = v.out.hash_tx;
|
sed.sidechain_transaction_id = v.out.hash_tx;
|
||||||
sed.sidechain_from = "";
|
sed.sidechain_from = "";
|
||||||
sed.sidechain_to = v.address;
|
sed.sidechain_to = v.address;
|
||||||
|
sed.sidechain_currency = "BTC";
|
||||||
sed.sidechain_amount = v.out.amount;
|
sed.sidechain_amount = v.out.amount;
|
||||||
sed.peerplays_from = addr_itr->sidechain_address_account;
|
sed.peerplays_from = addr_itr->sidechain_address_account;
|
||||||
sed.peerplays_to = GRAPHENE_SON_ACCOUNT;
|
sed.peerplays_to = GRAPHENE_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);
|
sidechain_event_data_received(sed);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
51
libraries/plugins/peerplays_sidechain/sidechain_net_handler_peerplays.cpp
Executable file → Normal file
51
libraries/plugins/peerplays_sidechain/sidechain_net_handler_peerplays.cpp
Executable file → Normal file
|
|
@ -23,7 +23,6 @@ sidechain_net_handler_peerplays::sidechain_net_handler_peerplays(peerplays_sidec
|
||||||
sidechain_net_handler(_plugin, options) {
|
sidechain_net_handler(_plugin, options) {
|
||||||
sidechain = sidechain_type::peerplays;
|
sidechain = sidechain_type::peerplays;
|
||||||
plugin.database().applied_block.connect( [&] (const signed_block& b) { on_block_applied(b); } );
|
plugin.database().applied_block.connect( [&] (const signed_block& b) { on_block_applied(b); } );
|
||||||
plugin.database().changed_objects.connect( [&] (const vector<object_id_type>& ids, const flat_set<account_id_type>& impacted_accounts) { on_changed_objects(ids); } );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sidechain_net_handler_peerplays::~sidechain_net_handler_peerplays() {
|
sidechain_net_handler_peerplays::~sidechain_net_handler_peerplays() {
|
||||||
|
|
@ -48,27 +47,45 @@ std::string sidechain_net_handler_peerplays::send_transaction( const std::string
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
void sidechain_net_handler_peerplays::handle_event( const std::string& event_data ) {
|
|
||||||
ilog("peerplays sidechain plugin: sidechain_net_handler_peerplays::handle_event");
|
|
||||||
ilog(" event_data: ${event_data}", ("event_data", event_data));
|
|
||||||
}
|
|
||||||
|
|
||||||
void sidechain_net_handler_peerplays::on_block_applied(const signed_block& b) {
|
void sidechain_net_handler_peerplays::on_block_applied(const signed_block& b) {
|
||||||
for (const auto& trx: b.transactions) {
|
for (const auto& trx: b.transactions) {
|
||||||
|
size_t operation_index = -1;
|
||||||
for (auto op: trx.operations) {
|
for (auto op: trx.operations) {
|
||||||
ilog("sidechain_net_handler_peerplays: operation detected ${op}", ("op", op));
|
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) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
void sidechain_net_handler_peerplays::on_changed_objects(const vector<object_id_type>& changed_object_ids) {
|
std::stringstream ss;
|
||||||
for (auto object_id: changed_object_ids) {
|
ss << "peerplays" << "-" << trx.id().str() << "-" << operation_index;
|
||||||
const object* obj = plugin.database().find_object(object_id);
|
std::string sidechain_uid = ss.str();
|
||||||
|
|
||||||
const chain::account_balance_object * abo = dynamic_cast<const chain::account_balance_object*>(obj);
|
sidechain_event_data sed;
|
||||||
if (abo != nullptr) {
|
sed.timestamp = plugin.database().head_block_time();
|
||||||
ilog("sidechain_net_handler_peerplays: account_balance_object changed, id ${id}", ("id", abo->id));
|
sed.sidechain = sidechain_type::peerplays;
|
||||||
continue;
|
sed.sidechain_uid = sidechain_uid;
|
||||||
|
sed.sidechain_transaction_id = trx.id().str();
|
||||||
|
sed.sidechain_from = fc::to_string(transfer_op.from.space_id) + "." + fc::to_string(transfer_op.from.type_id) + "." + fc::to_string((uint64_t)transfer_op.from.instance);
|
||||||
|
sed.sidechain_to = fc::to_string(transfer_op.to.space_id) + "." + fc::to_string(transfer_op.to.type_id) + "." + fc::to_string((uint64_t)transfer_op.to.instance);
|
||||||
|
sed.sidechain_currency = transfer_op.amount.asset_id(plugin.database()).symbol;
|
||||||
|
sed.sidechain_amount = transfer_op.amount.amount;
|
||||||
|
if (transfer_op.amount.asset_id == asset_id_type(0)) {
|
||||||
|
// User is returning CORE/TEST to the SON wallet
|
||||||
|
// This is start of withdrawal process
|
||||||
|
// We need to return BTC
|
||||||
|
|
||||||
|
} else {
|
||||||
|
// User deposits other Peerplays asset
|
||||||
|
// We need to pay CORE/TEST
|
||||||
|
sed.peerplays_from = transfer_op.from;
|
||||||
|
sed.peerplays_to = transfer_op.to;
|
||||||
|
// We should calculate exchange rate between CORE/TEST and other Peerplays asset
|
||||||
|
sed.peerplays_asset = asset(transfer_op.amount.amount); // It i 1:1 for now
|
||||||
|
}
|
||||||
|
sidechain_event_data_received(sed);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
0
libraries/plugins/peerplays_sidechain/sidechain_net_manager.cpp
Executable file → Normal file
0
libraries/plugins/peerplays_sidechain/sidechain_net_manager.cpp
Executable file → Normal file
0
tests/tests/history_api_tests.cpp
Executable file → Normal file
0
tests/tests/history_api_tests.cpp
Executable file → Normal file
|
|
@ -843,35 +843,12 @@ BOOST_AUTO_TEST_CASE( son_report_down_test ) {
|
||||||
|
|
||||||
BOOST_CHECK( obj->status == son_status::active);
|
BOOST_CHECK( obj->status == son_status::active);
|
||||||
|
|
||||||
const auto& son_btc_account = db.create<account_object>( [&]( account_object& obj ) {
|
|
||||||
obj.name = "son_btc_account";
|
|
||||||
obj.statistics = db.create<account_statistics_object>([&]( account_statistics_object& acc_stat ){ acc_stat.owner = obj.id; }).id;
|
|
||||||
obj.membership_expiration_date = time_point_sec::maximum();
|
|
||||||
obj.network_fee_percentage = GRAPHENE_DEFAULT_NETWORK_PERCENT_OF_FEE;
|
|
||||||
obj.lifetime_referrer_fee_percentage = GRAPHENE_100_PERCENT - GRAPHENE_DEFAULT_NETWORK_PERCENT_OF_FEE;
|
|
||||||
|
|
||||||
obj.owner.add_authority( bob_id, 1 );
|
|
||||||
obj.active.add_authority( bob_id, 1 );
|
|
||||||
obj.active.weight_threshold = 1;
|
|
||||||
obj.owner.weight_threshold = 1;
|
|
||||||
});
|
|
||||||
|
|
||||||
db.modify( db.get_global_properties(), [&]( global_property_object& _gpo )
|
|
||||||
{
|
|
||||||
_gpo.parameters.extensions.value.son_pay_daily_max = 200;
|
|
||||||
_gpo.parameters.witness_pay_per_block = 0;
|
|
||||||
|
|
||||||
_gpo.parameters.extensions.value.son_btc_account = son_btc_account.get_id();
|
|
||||||
if( _gpo.pending_parameters )
|
|
||||||
_gpo.pending_parameters->extensions.value.son_btc_account = son_btc_account.get_id();
|
|
||||||
});
|
|
||||||
|
|
||||||
{
|
{
|
||||||
// Check that transaction fails if down_ts < last_active_timestamp
|
// Check that transaction fails if down_ts < last_active_timestamp
|
||||||
generate_block();
|
generate_block();
|
||||||
// Send Report Down Operation for an active status SON
|
// Send Report Down Operation for an active status SON
|
||||||
son_report_down_operation op;
|
son_report_down_operation op;
|
||||||
op.payer = db.get_global_properties().parameters.get_son_btc_account_id();
|
op.payer = GRAPHENE_SON_ACCOUNT;
|
||||||
op.son_id = son_id_type(0);
|
op.son_id = son_id_type(0);
|
||||||
op.down_ts = fc::time_point_sec(son_stats_obj->last_active_timestamp - fc::seconds(1));
|
op.down_ts = fc::time_point_sec(son_stats_obj->last_active_timestamp - fc::seconds(1));
|
||||||
|
|
||||||
|
|
@ -884,7 +861,7 @@ BOOST_AUTO_TEST_CASE( son_report_down_test ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
// Check that transaction fails if payer is not son_btc_account.
|
// Check that transaction fails if payer is not GRAPHENE_SON_ACCOUNT.
|
||||||
generate_block();
|
generate_block();
|
||||||
// Send Report Down Operation for an active status SON
|
// Send Report Down Operation for an active status SON
|
||||||
son_report_down_operation op;
|
son_report_down_operation op;
|
||||||
|
|
@ -901,11 +878,11 @@ BOOST_AUTO_TEST_CASE( son_report_down_test ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
// Check that transaction succeeds after getting enough approvals on son_btc_account.
|
// Check that transaction succeeds after getting enough approvals on GRAPHENE_SON_ACCOUNT.
|
||||||
generate_block();
|
generate_block();
|
||||||
// Send Report Down Operation for an active status SON
|
// Send Report Down Operation for an active status SON
|
||||||
son_report_down_operation op;
|
son_report_down_operation op;
|
||||||
op.payer = db.get_global_properties().parameters.get_son_btc_account_id();
|
op.payer = GRAPHENE_SON_ACCOUNT;
|
||||||
op.son_id = son_id_type(0);
|
op.son_id = son_id_type(0);
|
||||||
op.down_ts = son_stats_obj->last_active_timestamp;
|
op.down_ts = son_stats_obj->last_active_timestamp;
|
||||||
|
|
||||||
|
|
@ -925,7 +902,7 @@ BOOST_AUTO_TEST_CASE( son_report_down_test ) {
|
||||||
generate_block();
|
generate_block();
|
||||||
// Send Report Down Operation for an active status SON
|
// Send Report Down Operation for an active status SON
|
||||||
son_report_down_operation op;
|
son_report_down_operation op;
|
||||||
op.payer = db.get_global_properties().parameters.get_son_btc_account_id();
|
op.payer = GRAPHENE_SON_ACCOUNT;
|
||||||
op.son_id = son_id_type(0);
|
op.son_id = son_id_type(0);
|
||||||
op.down_ts = son_stats_obj->last_active_timestamp;
|
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;
|
son_wallet_recreate_operation op;
|
||||||
|
|
||||||
op.payer = db.get_global_properties().parameters.get_son_btc_account_id();
|
op.payer = GRAPHENE_SON_ACCOUNT;
|
||||||
|
|
||||||
{
|
{
|
||||||
son_info si;
|
son_info si;
|
||||||
|
|
@ -199,7 +199,7 @@ BOOST_AUTO_TEST_CASE( son_wallet_update_test ) {
|
||||||
|
|
||||||
son_wallet_update_operation op;
|
son_wallet_update_operation op;
|
||||||
|
|
||||||
op.payer = db.get_global_properties().parameters.get_son_btc_account_id();
|
op.payer = GRAPHENE_SON_ACCOUNT;
|
||||||
op.son_wallet_id = son_wallet_id_type(0);
|
op.son_wallet_id = son_wallet_id_type(0);
|
||||||
op.sidechain = graphene::peerplays_sidechain::sidechain_type::bitcoin;
|
op.sidechain = graphene::peerplays_sidechain::sidechain_type::bitcoin;
|
||||||
op.address = "bitcoin address";
|
op.address = "bitcoin address";
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue