From d440fa98b93599281a03957a9b8f32c225317c41 Mon Sep 17 00:00:00 2001 From: gladcow Date: Wed, 8 Jan 2020 15:34:25 +0300 Subject: [PATCH] Add stop_son_maintenance CLI call --- .../wallet/include/graphene/wallet/wallet.hpp | 9 +++++++ libraries/wallet/wallet.cpp | 24 +++++++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/libraries/wallet/include/graphene/wallet/wallet.hpp b/libraries/wallet/include/graphene/wallet/wallet.hpp index a158587a..ce2c49a4 100644 --- a/libraries/wallet/include/graphene/wallet/wallet.hpp +++ b/libraries/wallet/include/graphene/wallet/wallet.hpp @@ -1350,6 +1350,15 @@ class wallet_api signed_transaction delete_son(string owner_account, bool broadcast = false); + /** Modify status of the SON owned by the given account back to active. + * + * @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 + */ + signed_transaction stop_son_maintenance(string owner_account, + bool broadcast = false); + /** Lists all SONs in the blockchain. * This returns a list of all account names that own SON, and the associated SON id, * sorted by name. This lists SONs whether they are currently voted in or not. diff --git a/libraries/wallet/wallet.cpp b/libraries/wallet/wallet.cpp index be837940..61d932c3 100644 --- a/libraries/wallet/wallet.cpp +++ b/libraries/wallet/wallet.cpp @@ -1939,6 +1939,25 @@ public: return sign_transaction( tx, broadcast ); } FC_CAPTURE_AND_RETHROW( (owner_account)(broadcast) ) } + signed_transaction stop_son_maintenance(string owner_account, + bool broadcast) + { try { + son_object son = get_son(owner_account); + + son_heartbeat_operation op; + op.owner_account = son.son_account; + op.son_id = son.id; + op.ts = _remote_db->get_dynamic_global_properties().time; // or fc::time_point_sec(fc::time_point::now()) ??? + + signed_transaction tx; + tx.operations.push_back( 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) ) } + + map list_active_sons() { try { global_property_object gpo = get_global_properties(); @@ -4403,6 +4422,11 @@ signed_transaction wallet_api::delete_son(string owner_account, return my->delete_son(owner_account, broadcast); } +signed_transaction wallet_api::stop_son_maintenance(string owner_account, bool broadcast) +{ + return my->stop_son_maintenance(owner_account, broadcast); +} + map wallet_api::list_sons(const string& lowerbound, uint32_t limit) { return my->_remote_db->lookup_son_accounts(lowerbound, limit);