[SON-363] - Remove son deletion (#359)
* [SON-363] - Remove son deletion * Fix the tests
This commit is contained in:
parent
be538614a9
commit
6797cdc3d3
18 changed files with 62 additions and 138 deletions
|
|
@ -201,7 +201,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_deregister_operation son_dereg_op;
|
||||
son_dereg_op.payer = get_global_properties().parameters.son_account();
|
||||
son_dereg_op.son_id = son_id;
|
||||
|
||||
|
|
|
|||
|
|
@ -256,7 +256,7 @@ void database::initialize_evaluators()
|
|||
register_evaluator<sweeps_vesting_claim_evaluator>();
|
||||
register_evaluator<create_son_evaluator>();
|
||||
register_evaluator<update_son_evaluator>();
|
||||
register_evaluator<delete_son_evaluator>();
|
||||
register_evaluator<deregister_son_evaluator>();
|
||||
register_evaluator<son_heartbeat_evaluator>();
|
||||
register_evaluator<son_report_down_evaluator>();
|
||||
register_evaluator<son_maintenance_evaluator>();
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ vector<std::reference_wrapper<const son_object>> database::sort_votable_objects<
|
|||
std::vector<std::reference_wrapper<const son_object>> refs;
|
||||
for( auto& son : all_sons )
|
||||
{
|
||||
if(son.has_valid_config())
|
||||
if(son.has_valid_config() && son.status != son_status::deregistered)
|
||||
{
|
||||
refs.push_back(std::cref(son));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -299,8 +299,8 @@ struct get_impacted_account_visitor
|
|||
void operator()( const son_update_operation& op ) {
|
||||
_impacted.insert( op.owner_account );
|
||||
}
|
||||
void operator()( const son_delete_operation& op ) {
|
||||
_impacted.insert( op.owner_account );
|
||||
void operator()( const son_deregister_operation& op ) {
|
||||
_impacted.insert( op.payer);
|
||||
}
|
||||
void operator()( const son_heartbeat_operation& op ) {
|
||||
_impacted.insert( op.owner_account );
|
||||
|
|
|
|||
|
|
@ -709,7 +709,7 @@ void database::update_betting_markets(fc::time_point_sec current_block_time)
|
|||
void database::remove_son_proposal( const proposal_object& proposal )
|
||||
{ try {
|
||||
if( proposal.proposed_transaction.operations.size() == 1 &&
|
||||
( proposal.proposed_transaction.operations.back().which() == operation::tag<son_delete_operation>::value ||
|
||||
( proposal.proposed_transaction.operations.back().which() == operation::tag<son_deregister_operation>::value ||
|
||||
proposal.proposed_transaction.operations.back().which() == operation::tag<son_report_down_operation>::value) )
|
||||
{
|
||||
const auto& son_proposal_idx = get_index_type<son_proposal_index>().indices().get<by_proposal>();
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ namespace graphene { namespace chain {
|
|||
template<typename T>
|
||||
void operator()( const T &v ) const {}
|
||||
|
||||
void operator()( const son_delete_operation &v );
|
||||
void operator()( const son_deregister_operation &v );
|
||||
void operator()( const son_report_down_operation &v );
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -144,7 +144,7 @@ namespace graphene { namespace chain {
|
|||
sweeps_vesting_claim_operation,
|
||||
son_create_operation,
|
||||
son_update_operation,
|
||||
son_delete_operation,
|
||||
son_deregister_operation,
|
||||
son_heartbeat_operation,
|
||||
son_report_down_operation,
|
||||
son_maintenance_operation,
|
||||
|
|
|
|||
|
|
@ -37,14 +37,13 @@ namespace graphene { namespace chain {
|
|||
share_type calculate_fee(const fee_parameters_type& k)const { return 0; }
|
||||
};
|
||||
|
||||
struct son_delete_operation : public base_operation
|
||||
struct son_deregister_operation : public base_operation
|
||||
{
|
||||
struct fee_parameters_type { uint64_t fee = 0; };
|
||||
|
||||
asset fee;
|
||||
son_id_type son_id;
|
||||
account_id_type payer;
|
||||
account_id_type owner_account;
|
||||
|
||||
account_id_type fee_payer()const { return payer; }
|
||||
share_type calculate_fee(const fee_parameters_type& k)const { return 0; }
|
||||
|
|
@ -106,8 +105,8 @@ FC_REFLECT(graphene::chain::son_update_operation::fee_parameters_type, (fee) )
|
|||
FC_REFLECT(graphene::chain::son_update_operation, (fee)(son_id)(owner_account)(new_url)(new_deposit)
|
||||
(new_signing_key)(new_sidechain_public_keys)(new_pay_vb) )
|
||||
|
||||
FC_REFLECT(graphene::chain::son_delete_operation::fee_parameters_type, (fee) )
|
||||
FC_REFLECT(graphene::chain::son_delete_operation, (fee)(son_id)(payer)(owner_account) )
|
||||
FC_REFLECT(graphene::chain::son_deregister_operation::fee_parameters_type, (fee) )
|
||||
FC_REFLECT(graphene::chain::son_deregister_operation, (fee)(son_id)(payer) )
|
||||
|
||||
FC_REFLECT(graphene::chain::son_heartbeat_operation::fee_parameters_type, (fee) )
|
||||
FC_REFLECT(graphene::chain::son_heartbeat_operation, (fee)(son_id)(owner_account)(ts) )
|
||||
|
|
|
|||
|
|
@ -22,13 +22,13 @@ public:
|
|||
object_id_type do_apply(const son_update_operation& o);
|
||||
};
|
||||
|
||||
class delete_son_evaluator : public evaluator<delete_son_evaluator>
|
||||
class deregister_son_evaluator : public evaluator<deregister_son_evaluator>
|
||||
{
|
||||
public:
|
||||
typedef son_delete_operation operation_type;
|
||||
typedef son_deregister_operation operation_type;
|
||||
|
||||
void_result do_evaluate(const son_delete_operation& o);
|
||||
void_result do_apply(const son_delete_operation& o);
|
||||
void_result do_evaluate(const son_deregister_operation& o);
|
||||
void_result do_apply(const son_deregister_operation& o);
|
||||
};
|
||||
|
||||
class son_heartbeat_evaluator : public evaluator<son_heartbeat_evaluator>
|
||||
|
|
|
|||
|
|
@ -44,6 +44,8 @@ namespace graphene { namespace chain {
|
|||
fc::time_point_sec last_down_timestamp;
|
||||
// Last Active heartbeat timestamp
|
||||
fc::time_point_sec last_active_timestamp;
|
||||
// Deregistered Timestamp
|
||||
fc::time_point_sec deregistered_timestamp;
|
||||
// Total sidechain transactions reported by SON network while SON was active
|
||||
uint64_t total_sidechain_txs_reported = 0;
|
||||
// Sidechain transactions reported by this SON
|
||||
|
|
@ -125,6 +127,7 @@ FC_REFLECT_DERIVED( graphene::chain::son_statistics_object,
|
|||
(current_interval_downtime)
|
||||
(last_down_timestamp)
|
||||
(last_active_timestamp)
|
||||
(deregistered_timestamp)
|
||||
(total_sidechain_txs_reported)
|
||||
(sidechain_txs_reported)
|
||||
)
|
||||
|
|
|
|||
|
|
@ -136,8 +136,8 @@ struct proposal_operation_hardfork_visitor
|
|||
FC_ASSERT( block_time >= HARDFORK_SON_TIME, "son_update_operation not allowed yet!" );
|
||||
}
|
||||
|
||||
void operator()(const son_delete_operation &v) const {
|
||||
FC_ASSERT( block_time >= HARDFORK_SON_TIME, "son_delete_operation not allowed yet!" );
|
||||
void operator()(const son_deregister_operation &v) const {
|
||||
FC_ASSERT( block_time >= HARDFORK_SON_TIME, "son_deregister_operation not allowed yet!" );
|
||||
}
|
||||
|
||||
void operator()(const son_heartbeat_operation &v) const {
|
||||
|
|
@ -164,7 +164,7 @@ struct proposal_operation_hardfork_visitor
|
|||
}
|
||||
};
|
||||
|
||||
void son_hardfork_visitor::operator()( const son_delete_operation &v )
|
||||
void son_hardfork_visitor::operator()( const son_deregister_operation &v )
|
||||
{
|
||||
db.create<son_proposal_object>([&]( son_proposal_object& son_prop ) {
|
||||
son_prop.proposal_type = son_proposal_type::son_deregister_proposal;
|
||||
|
|
|
|||
|
|
@ -63,17 +63,17 @@ object_id_type update_son_evaluator::do_apply(const son_update_operation& op)
|
|||
return op.son_id;
|
||||
} FC_CAPTURE_AND_RETHROW( (op) ) }
|
||||
|
||||
void_result delete_son_evaluator::do_evaluate(const son_delete_operation& op)
|
||||
void_result deregister_son_evaluator::do_evaluate(const son_deregister_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 == db().get_global_properties().parameters.son_account()));
|
||||
// Only son account can deregister
|
||||
FC_ASSERT(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();
|
||||
} FC_CAPTURE_AND_RETHROW( (op) ) }
|
||||
|
||||
void_result delete_son_evaluator::do_apply(const son_delete_operation& op)
|
||||
void_result deregister_son_evaluator::do_apply(const son_deregister_operation& op)
|
||||
{ try {
|
||||
const auto& idx = db().get_index_type<son_index>().indices().get<by_id>();
|
||||
const auto& ss_idx = db().get_index_type<son_stats_index>().indices().get<by_id>();
|
||||
|
|
@ -89,10 +89,16 @@ void_result delete_son_evaluator::do_apply(const son_delete_operation& op)
|
|||
vbo.policy = new_vesting_policy;
|
||||
});
|
||||
|
||||
db().modify(*son, [&op](son_object &so) {
|
||||
so.status = son_status::deregistered;
|
||||
});
|
||||
|
||||
auto stats_obj = ss_idx.find(son->statistics);
|
||||
if(stats_obj != ss_idx.end())
|
||||
db().remove(*stats_obj);
|
||||
db().remove(*son);
|
||||
if(stats_obj != ss_idx.end()) {
|
||||
db().modify(*stats_obj, [&]( son_statistics_object& sso) {
|
||||
sso.deregistered_timestamp = db().head_block_time();
|
||||
});
|
||||
}
|
||||
}
|
||||
return void_result();
|
||||
} FC_CAPTURE_AND_RETHROW( (op) ) }
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ public:
|
|||
const son_object get_current_son_object();
|
||||
const son_object get_son_object(son_id_type son_id);
|
||||
bool is_active_son(son_id_type son_id);
|
||||
bool is_son_deleted(son_id_type son_id);
|
||||
bool is_son_deregistered(son_id_type son_id);
|
||||
fc::ecc::private_key get_private_key(son_id_type son_id);
|
||||
fc::ecc::private_key get_private_key(chain::public_key_type public_key);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -37,8 +37,8 @@ public:
|
|||
const son_object get_current_son_object();
|
||||
const son_object get_son_object(son_id_type son_id);
|
||||
bool is_active_son(son_id_type son_id);
|
||||
bool is_son_deleted(son_id_type son_id);
|
||||
bool is_son_delete_op_valid(const chain::operation &op);
|
||||
bool is_son_deregistered(son_id_type son_id);
|
||||
bool is_son_deregister_op_valid(const chain::operation &op);
|
||||
bool is_son_down_op_valid(const chain::operation &op);
|
||||
bool is_valid_son_proposal(const chain::proposal_object &proposal);
|
||||
fc::ecc::private_key get_private_key(son_id_type son_id);
|
||||
|
|
@ -272,18 +272,22 @@ bool peerplays_sidechain_plugin_impl::is_active_son(son_id_type son_id) {
|
|||
return (it != active_son_ids.end());
|
||||
}
|
||||
|
||||
bool peerplays_sidechain_plugin_impl::is_son_deleted(son_id_type son_id) {
|
||||
bool peerplays_sidechain_plugin_impl::is_son_deregistered(son_id_type son_id) {
|
||||
const auto &idx = plugin.database().get_index_type<chain::son_index>().indices().get<by_id>();
|
||||
auto son_obj = idx.find(son_id);
|
||||
if (son_obj == idx.end())
|
||||
return true;
|
||||
|
||||
if(son_obj->status == chain::son_status::deregistered) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool peerplays_sidechain_plugin_impl::is_son_delete_op_valid(const chain::operation &op) {
|
||||
son_delete_operation delete_op = op.get<son_delete_operation>();
|
||||
return plugin.database().is_son_dereg_valid(delete_op.son_id);
|
||||
bool peerplays_sidechain_plugin_impl::is_son_deregister_op_valid(const chain::operation &op) {
|
||||
son_deregister_operation deregister_op = op.get<son_deregister_operation>();
|
||||
return plugin.database().is_son_dereg_valid(deregister_op.son_id);
|
||||
}
|
||||
|
||||
bool peerplays_sidechain_plugin_impl::is_son_down_op_valid(const chain::operation &op) {
|
||||
|
|
@ -389,7 +393,7 @@ void peerplays_sidechain_plugin_impl::son_processing() {
|
|||
("scheduled_son_id", scheduled_son_id)("now", now));
|
||||
|
||||
for (son_id_type son_id : plugin.get_sons()) {
|
||||
if (plugin.is_son_deleted(son_id)) {
|
||||
if (plugin.is_son_deregistered(son_id)) {
|
||||
continue;
|
||||
}
|
||||
current_son_id = son_id;
|
||||
|
|
@ -434,8 +438,8 @@ bool peerplays_sidechain_plugin_impl::is_valid_son_proposal(const chain::proposa
|
|||
return is_son_down_op_valid(op);
|
||||
}
|
||||
|
||||
if (op_idx_0 == chain::operation::tag<chain::son_delete_operation>::value) {
|
||||
return is_son_delete_op_valid(op);
|
||||
if (op_idx_0 == chain::operation::tag<chain::son_deregister_operation>::value) {
|
||||
return is_son_deregister_op_valid(op);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -672,8 +676,8 @@ bool peerplays_sidechain_plugin::is_active_son(son_id_type son_id) {
|
|||
return my->is_active_son(son_id);
|
||||
}
|
||||
|
||||
bool peerplays_sidechain_plugin::is_son_deleted(son_id_type son_id) {
|
||||
return my->is_son_deleted(son_id);
|
||||
bool peerplays_sidechain_plugin::is_son_deregistered(son_id_type son_id) {
|
||||
return my->is_son_deregistered(son_id);
|
||||
}
|
||||
|
||||
fc::ecc::private_key peerplays_sidechain_plugin::get_private_key(son_id_type son_id) {
|
||||
|
|
|
|||
|
|
@ -1373,18 +1373,6 @@ class wallet_api
|
|||
flat_map<sidechain_type, string> sidechain_public_keys,
|
||||
bool broadcast = false);
|
||||
|
||||
|
||||
/** Deletes a SON object owned by the given account.
|
||||
*
|
||||
* An account can have at most one witness object.
|
||||
*
|
||||
* @param owner_account the name or id of the account which is creating the witness
|
||||
* @param broadcast true to broadcast the transaction on the network
|
||||
* @returns the signed transaction registering a witness
|
||||
*/
|
||||
signed_transaction delete_son(string owner_account,
|
||||
bool broadcast = false);
|
||||
|
||||
/** Modify status of the SON owned by the given account to maintenance.
|
||||
*
|
||||
* @param owner_account the name or id of the account which is owning the SON
|
||||
|
|
@ -2327,7 +2315,6 @@ FC_API( graphene::wallet::wallet_api,
|
|||
(create_son)
|
||||
(try_create_son)
|
||||
(update_son)
|
||||
(delete_son)
|
||||
(list_sons)
|
||||
(list_active_sons)
|
||||
(request_son_maintenance)
|
||||
|
|
|
|||
|
|
@ -1991,24 +1991,6 @@ public:
|
|||
return sign_transaction( tx, broadcast );
|
||||
} FC_CAPTURE_AND_RETHROW( (owner_account)(url)(block_signing_key)(broadcast) ) }
|
||||
|
||||
signed_transaction delete_son(string owner_account,
|
||||
bool broadcast /* = false */)
|
||||
{ try {
|
||||
son_object son = get_son(owner_account);
|
||||
|
||||
son_delete_operation son_delete_op;
|
||||
son_delete_op.son_id = son.id;
|
||||
son_delete_op.owner_account = son.son_account;
|
||||
son_delete_op.payer = son.son_account;
|
||||
|
||||
signed_transaction tx;
|
||||
tx.operations.push_back( son_delete_op );
|
||||
set_operation_fees( tx, _remote_db->get_global_properties().parameters.current_fees );
|
||||
tx.validate();
|
||||
|
||||
return sign_transaction( tx, broadcast );
|
||||
} FC_CAPTURE_AND_RETHROW( (owner_account)(broadcast) ) }
|
||||
|
||||
signed_transaction request_son_maintenance(string owner_account,
|
||||
bool broadcast)
|
||||
{ try {
|
||||
|
|
@ -2073,7 +2055,7 @@ public:
|
|||
std::inserter(result, result.end()),
|
||||
[](fc::optional<account_object>& acct, fc::optional<son_object> son) {
|
||||
FC_ASSERT(acct, "Invalid active SONs list in global properties.");
|
||||
if (son.valid())
|
||||
if (son.valid() && son->status != son_status::deregistered)
|
||||
return std::make_pair<string, son_id_type>(string(acct->name), std::move(son->id));
|
||||
return std::make_pair<string, son_id_type>(string(acct->name), std::move(son_id_type()));
|
||||
});
|
||||
|
|
@ -4784,12 +4766,6 @@ signed_transaction wallet_api::update_son(string owner_account,
|
|||
return my->update_son(owner_account, url, block_signing_key, sidechain_public_keys, broadcast);
|
||||
}
|
||||
|
||||
signed_transaction wallet_api::delete_son(string owner_account,
|
||||
bool broadcast /* = false */)
|
||||
{
|
||||
return my->delete_son(owner_account, broadcast);
|
||||
}
|
||||
|
||||
signed_transaction wallet_api::request_son_maintenance(string owner_account, bool broadcast)
|
||||
{
|
||||
return my->request_son_maintenance(owner_account, broadcast);
|
||||
|
|
|
|||
|
|
@ -261,40 +261,6 @@ BOOST_AUTO_TEST_CASE( son_voting )
|
|||
BOOST_TEST_MESSAGE("SON Vote cli wallet tests end");
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE( delete_son )
|
||||
{
|
||||
BOOST_TEST_MESSAGE("SON delete cli wallet tests begin");
|
||||
try
|
||||
{
|
||||
flat_map<sidechain_type, string> sidechain_public_keys;
|
||||
|
||||
son_test_helper sth(*this);
|
||||
|
||||
sidechain_public_keys.clear();
|
||||
sidechain_public_keys[sidechain_type::bitcoin] = "bitcoin_address 1";
|
||||
sth.create_son("son1account", "http://son1", sidechain_public_keys);
|
||||
|
||||
sidechain_public_keys.clear();
|
||||
sidechain_public_keys[sidechain_type::bitcoin] = "bitcoin_address 2";
|
||||
sth.create_son("son2account", "http://son2", sidechain_public_keys);
|
||||
|
||||
BOOST_TEST_MESSAGE("Deleting SONs");
|
||||
signed_transaction delete_tx;
|
||||
auto _db = app1->chain_database();
|
||||
BOOST_CHECK(_db->get_index_type<son_index>().indices().size() == 2);
|
||||
delete_tx = con.wallet_api_ptr->delete_son("son1account", "true");
|
||||
delete_tx = con.wallet_api_ptr->delete_son("son2account", "true");
|
||||
BOOST_CHECK(generate_maintenance_block());
|
||||
BOOST_CHECK(_db->get_index_type<son_index>().indices().size() == 0);
|
||||
} catch( fc::exception& e ) {
|
||||
BOOST_TEST_MESSAGE("SON cli wallet tests exception");
|
||||
edump((e.to_detail_string()));
|
||||
throw;
|
||||
}
|
||||
BOOST_TEST_MESSAGE("SON delete cli wallet tests end");
|
||||
}
|
||||
|
||||
|
||||
BOOST_FIXTURE_TEST_CASE( select_top_fifteen_sons, cli_fixture )
|
||||
{
|
||||
BOOST_TEST_MESSAGE("SON cli wallet tests begin");
|
||||
|
|
@ -659,8 +625,6 @@ BOOST_FIXTURE_TEST_CASE( cli_list_active_sons, cli_fixture )
|
|||
BOOST_CHECK(active_sons.find(name) != active_sons.end());
|
||||
}
|
||||
|
||||
// check list_active_son after SON deletion
|
||||
con.wallet_api_ptr->delete_son("sonaccount1", true);
|
||||
BOOST_CHECK_NO_THROW(con.wallet_api_ptr->list_active_sons());
|
||||
} catch( fc::exception& e ) {
|
||||
BOOST_TEST_MESSAGE("SON cli wallet tests exception");
|
||||
|
|
|
|||
|
|
@ -141,7 +141,7 @@ BOOST_AUTO_TEST_CASE( update_son_test ) {
|
|||
BOOST_CHECK( obj->sidechain_public_keys.at(sidechain_type::bitcoin) == "new bitcoin address" );
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE( delete_son_test ) {
|
||||
BOOST_AUTO_TEST_CASE( deregister_son_test ) {
|
||||
try {
|
||||
INVOKE(create_son_test);
|
||||
GET_ACTOR(alice);
|
||||
|
|
@ -151,40 +151,25 @@ try {
|
|||
BOOST_CHECK_EQUAL(deposit_vesting.is_withdraw_allowed(now, asset(50)), false); // cant withdraw
|
||||
|
||||
{
|
||||
son_delete_operation op;
|
||||
op.owner_account = alice_id;
|
||||
son_deregister_operation op;
|
||||
op.son_id = son_id_type(0);
|
||||
op.payer = alice_id;
|
||||
|
||||
trx.operations.push_back(op);
|
||||
sign(trx, alice_private_key);
|
||||
PUSH_TX(db, trx, ~0);
|
||||
GRAPHENE_REQUIRE_THROW(PUSH_TX( db, trx, ~0), fc::exception);
|
||||
}
|
||||
generate_block();
|
||||
|
||||
const auto& idx = db.get_index_type<son_index>().indices().get<by_account>();
|
||||
BOOST_REQUIRE( idx.empty() );
|
||||
|
||||
deposit_vesting = db.get<vesting_balance_object>(vesting_balance_id_type(0));
|
||||
BOOST_CHECK_EQUAL(deposit_vesting.policy.get<linear_vesting_policy>().vesting_cliff_seconds,
|
||||
db.get_global_properties().parameters.son_vesting_period()); // in linear policy
|
||||
|
||||
now = db.head_block_time();
|
||||
BOOST_CHECK_EQUAL(deposit_vesting.is_withdraw_allowed(now, asset(50)), false); // but still cant withdraw
|
||||
|
||||
generate_blocks(now + fc::seconds(db.get_global_properties().parameters.son_vesting_period()));
|
||||
generate_block();
|
||||
|
||||
deposit_vesting = db.get<vesting_balance_object>(vesting_balance_id_type(0));
|
||||
now = db.head_block_time();
|
||||
BOOST_CHECK_EQUAL(deposit_vesting.is_withdraw_allowed(now, asset(50)), true); // after 2 days withdraw is allowed
|
||||
BOOST_REQUIRE( idx.size() == 1);
|
||||
}
|
||||
catch (fc::exception &e) {
|
||||
edump((e.to_detail_string()));
|
||||
throw;
|
||||
} }
|
||||
|
||||
BOOST_AUTO_TEST_CASE( delete_son_test_with_consensus_account ) {
|
||||
BOOST_AUTO_TEST_CASE( deregister_son_test_with_consensus_account ) {
|
||||
try {
|
||||
INVOKE(create_son_test);
|
||||
GET_ACTOR(alice);
|
||||
|
|
@ -217,8 +202,7 @@ try {
|
|||
|
||||
{
|
||||
trx.clear();
|
||||
son_delete_operation op;
|
||||
op.owner_account = alice_id;
|
||||
son_deregister_operation op;
|
||||
op.son_id = son_id_type(0);
|
||||
op.payer = db.get_global_properties().parameters.son_account();
|
||||
|
||||
|
|
@ -228,7 +212,9 @@ try {
|
|||
}
|
||||
generate_block();
|
||||
|
||||
BOOST_REQUIRE( idx.size() == 0 );
|
||||
BOOST_REQUIRE( idx.size() == 1 );
|
||||
BOOST_REQUIRE( obj->status == son_status::deregistered );
|
||||
BOOST_REQUIRE( son_stats_obj->deregistered_timestamp == now );
|
||||
|
||||
deposit_vesting = db.get<vesting_balance_object>(vesting_balance_id_type(0));
|
||||
BOOST_CHECK_EQUAL(deposit_vesting.policy.get<linear_vesting_policy>().vesting_cliff_seconds,
|
||||
|
|
@ -278,10 +264,9 @@ try {
|
|||
// not changing
|
||||
BOOST_CHECK( obj->url == "https://create_son_test" );
|
||||
|
||||
// bob tries to delete a son object he dont own
|
||||
// bob tries to deregister a son object he dont own
|
||||
{
|
||||
son_delete_operation op;
|
||||
op.owner_account = bob_id;
|
||||
son_deregister_operation op;
|
||||
op.son_id = son_id_type(0);
|
||||
op.payer = bob_id;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue