cli wallet command to reactivate deregistered SON #617
4 changed files with 40 additions and 1 deletions
|
|
@ -1,6 +1,7 @@
|
|||
#pragma once
|
||||
#include <graphene/chain/protocol/base.hpp>
|
||||
#include <graphene/chain/sidechain_defs.hpp>
|
||||
#include <graphene/chain/son_object.hpp>
|
||||
|
||||
namespace graphene { namespace chain {
|
||||
|
||||
|
|
@ -32,6 +33,7 @@ namespace graphene { namespace chain {
|
|||
optional<public_key_type> new_signing_key;
|
||||
optional<flat_map<sidechain_type, string>> new_sidechain_public_keys;
|
||||
optional<vesting_balance_id_type> new_pay_vb;
|
||||
optional<son_status> new_status;
|
||||
|
||||
account_id_type fee_payer()const { return owner_account; }
|
||||
share_type calculate_fee(const fee_parameters_type& k)const { return 0; }
|
||||
|
|
@ -103,7 +105,7 @@ FC_REFLECT(graphene::chain::son_create_operation, (fee)(owner_account)(url)(depo
|
|||
|
||||
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) )
|
||||
(new_signing_key)(new_sidechain_public_keys)(new_pay_vb)(new_status) )
|
||||
|
||||
FC_REFLECT(graphene::chain::son_deregister_operation::fee_parameters_type, (fee) )
|
||||
FC_REFLECT(graphene::chain::son_deregister_operation, (fee)(son_id)(payer) )
|
||||
|
|
|
|||
|
|
@ -79,6 +79,9 @@ void_result update_son_evaluator::do_evaluate(const son_update_operation& op)
|
|||
FC_ASSERT(vbo.policy.which() == vesting_policy::tag<linear_vesting_policy>::value,
|
||||
"Payment balance must have linear vesting policy");
|
||||
}
|
||||
if(op.new_status.valid()) {
|
||||
FC_ASSERT(db().get(op.son_id).status == son_status::deregistered, "SON must be in deregistered state");
|
||||
}
|
||||
return void_result();
|
||||
} FC_CAPTURE_AND_RETHROW( (op) ) }
|
||||
|
||||
|
|
@ -94,6 +97,7 @@ object_id_type update_son_evaluator::do_apply(const son_update_operation& op)
|
|||
if(op.new_signing_key.valid()) so.signing_key = *op.new_signing_key;
|
||||
if(op.new_sidechain_public_keys.valid()) so.sidechain_public_keys = *op.new_sidechain_public_keys;
|
||||
if(op.new_pay_vb.valid()) so.pay_vb = *op.new_pay_vb;
|
||||
if(op.new_status.valid()) so.status = son_status::inactive;
|
||||
});
|
||||
}
|
||||
return op.son_id;
|
||||
|
|
|
|||
|
|
@ -1425,6 +1425,16 @@ class wallet_api
|
|||
flat_map<sidechain_type, string> sidechain_public_keys,
|
||||
bool broadcast = false);
|
||||
|
||||
/**
|
||||
* Activate deregistered SON object owned by the given account.
|
||||
*
|
||||
* @param owner_account The name of the SON's owner account. Also accepts the ID of the owner account or the ID of the SON.
|
||||
* @param broadcast true if you wish to broadcast the transaction.
|
||||
*/
|
||||
signed_transaction activate_deregistered_son(const string & owner_account,
|
||||
bool broadcast /* = false */);
|
||||
|
||||
|
||||
/**
|
||||
* Updates vesting balances of the SON object owned by the given account.
|
||||
*
|
||||
|
|
@ -2622,6 +2632,7 @@ FC_API( graphene::wallet::wallet_api,
|
|||
(try_create_son)
|
||||
(update_son)
|
||||
(update_son_vesting_balances)
|
||||
(activate_deregistered_son)
|
||||
(list_sons)
|
||||
(list_active_sons)
|
||||
(get_son_network_status)
|
||||
|
|
|
|||
|
|
@ -2114,6 +2114,23 @@ public:
|
|||
return sign_transaction( tx, broadcast );
|
||||
} FC_CAPTURE_AND_RETHROW( (owner_account)(url)(block_signing_key)(broadcast) ) }
|
||||
|
||||
signed_transaction activate_deregistered_son(const string & owner_account,
|
||||
bool broadcast /* = false */)
|
||||
{ try {
|
||||
son_object son = get_son(owner_account);
|
||||
|
||||
son_update_operation son_update_op;
|
||||
son_update_op.son_id = son.id;
|
||||
son_update_op.owner_account = son.son_account;
|
||||
son_update_op.new_status = son_status::inactive;
|
||||
signed_transaction tx;
|
||||
tx.operations.push_back( son_update_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 update_son_vesting_balances(string owner_account,
|
||||
optional<vesting_balance_id_type> new_deposit,
|
||||
optional<vesting_balance_id_type> new_pay_vb,
|
||||
|
|
@ -5053,6 +5070,11 @@ 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::activate_deregistered_son(const string & owner_account, bool broadcast) {
|
||||
return my->activate_deregistered_son(owner_account, broadcast);
|
||||
}
|
||||
|
||||
|
||||
signed_transaction wallet_api::update_son_vesting_balances(string owner_account,
|
||||
optional<vesting_balance_id_type> new_deposit,
|
||||
optional<vesting_balance_id_type> new_pay_vb,
|
||||
|
|
|
|||
Loading…
Reference in a new issue