Feature implemented (test)
This commit is contained in:
parent
0fea84b16b
commit
8abd6cd807
4 changed files with 30 additions and 7 deletions
|
|
@ -1,6 +1,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <graphene/chain/protocol/base.hpp>
|
#include <graphene/chain/protocol/base.hpp>
|
||||||
#include <graphene/chain/sidechain_defs.hpp>
|
#include <graphene/chain/sidechain_defs.hpp>
|
||||||
|
#include <graphene/chain/son_object.hpp>
|
||||||
|
|
||||||
namespace graphene { namespace chain {
|
namespace graphene { namespace chain {
|
||||||
|
|
||||||
|
|
@ -32,6 +33,7 @@ namespace graphene { namespace chain {
|
||||||
optional<public_key_type> new_signing_key;
|
optional<public_key_type> new_signing_key;
|
||||||
optional<flat_map<sidechain_type, string>> new_sidechain_public_keys;
|
optional<flat_map<sidechain_type, string>> new_sidechain_public_keys;
|
||||||
optional<vesting_balance_id_type> new_pay_vb;
|
optional<vesting_balance_id_type> new_pay_vb;
|
||||||
|
optional<son_status> status;
|
||||||
|
|
||||||
account_id_type fee_payer()const { return owner_account; }
|
account_id_type fee_payer()const { return owner_account; }
|
||||||
share_type calculate_fee(const fee_parameters_type& k)const { return 0; }
|
share_type calculate_fee(const fee_parameters_type& k)const { return 0; }
|
||||||
|
|
|
||||||
|
|
@ -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,
|
FC_ASSERT(vbo.policy.which() == vesting_policy::tag<linear_vesting_policy>::value,
|
||||||
"Payment balance must have linear vesting policy");
|
"Payment balance must have linear vesting policy");
|
||||||
}
|
}
|
||||||
|
if(op.status.valid()) {
|
||||||
|
FC_ASSERT(db().get(op.son_id).status == son_status::deregistered, "SON must be in deregistered state");
|
||||||
|
}
|
||||||
return void_result();
|
return void_result();
|
||||||
} FC_CAPTURE_AND_RETHROW( (op) ) }
|
} 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_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_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_pay_vb.valid()) so.pay_vb = *op.new_pay_vb;
|
||||||
|
if(op.status.valid()) so.status = son_status::inactive;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return op.son_id;
|
return op.son_id;
|
||||||
|
|
|
||||||
|
|
@ -1425,7 +1425,7 @@ class wallet_api
|
||||||
flat_map<sidechain_type, string> sidechain_public_keys,
|
flat_map<sidechain_type, string> sidechain_public_keys,
|
||||||
bool broadcast = false);
|
bool broadcast = false);
|
||||||
|
|
||||||
string activate_deregistered_son(const string& id);
|
signed_transaction activate_deregistered_son(const string & owner_account, bool broadcast /* = false */);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -2114,7 +2114,24 @@ public:
|
||||||
return sign_transaction( tx, broadcast );
|
return sign_transaction( tx, broadcast );
|
||||||
} FC_CAPTURE_AND_RETHROW( (owner_account)(url)(block_signing_key)(broadcast) ) }
|
} FC_CAPTURE_AND_RETHROW( (owner_account)(url)(block_signing_key)(broadcast) ) }
|
||||||
|
|
||||||
signed_transaction update_son_vesting_balances(string owner_account,
|
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.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)(url)(block_signing_key)(broadcast) ) }
|
||||||
|
|
||||||
|
signed_transaction update_son_vesting_balances(string owner_account,
|
||||||
optional<vesting_balance_id_type> new_deposit,
|
optional<vesting_balance_id_type> new_deposit,
|
||||||
optional<vesting_balance_id_type> new_pay_vb,
|
optional<vesting_balance_id_type> new_pay_vb,
|
||||||
bool broadcast /* = false */)
|
bool broadcast /* = false */)
|
||||||
|
|
@ -4391,11 +4408,6 @@ vector<asset_object> wallet_api::list_assets(const string& lowerbound, uint32_t
|
||||||
return my->_remote_db->list_assets( lowerbound, limit );
|
return my->_remote_db->list_assets( lowerbound, limit );
|
||||||
}
|
}
|
||||||
|
|
||||||
string wallet_api::activate_deregistered_son(const string& id)
|
|
||||||
{
|
|
||||||
return string("stub for activate_deregistered_son for ( ") + id + " ) ";
|
|
||||||
}
|
|
||||||
|
|
||||||
uint64_t wallet_api::get_asset_count()const
|
uint64_t wallet_api::get_asset_count()const
|
||||||
{
|
{
|
||||||
return my->_remote_db->get_asset_count();
|
return my->_remote_db->get_asset_count();
|
||||||
|
|
@ -5058,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);
|
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->_remote_db->activate_deregistered_son(owner_account, broadcast);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
signed_transaction wallet_api::update_son_vesting_balances(string owner_account,
|
signed_transaction wallet_api::update_son_vesting_balances(string owner_account,
|
||||||
optional<vesting_balance_id_type> new_deposit,
|
optional<vesting_balance_id_type> new_deposit,
|
||||||
optional<vesting_balance_id_type> new_pay_vb,
|
optional<vesting_balance_id_type> new_pay_vb,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue