From cbfaefde8324ee84e6339622359534d163691991 Mon Sep 17 00:00:00 2001 From: Srdjan Obucina Date: Thu, 20 Feb 2020 14:37:29 +0100 Subject: [PATCH] Some refactoring --- .../chain/protocol/sidechain_address.hpp | 8 +-- .../chain/sidechain_address_object.hpp | 12 ++-- .../chain/sidechain_address_evaluator.cpp | 4 +- .../sidechain_net_handler.hpp | 4 +- .../sidechain_net_handler_bitcoin.hpp | 2 + .../sidechain_net_handler_peerplays.hpp | 2 + .../sidechain_net_manager.hpp | 2 + .../peerplays_sidechain_plugin.cpp | 7 +- .../sidechain_net_handler.cpp | 68 +++++++++---------- .../sidechain_net_handler_bitcoin.cpp | 25 ++++--- .../sidechain_net_handler_peerplays.cpp | 6 ++ .../sidechain_net_manager.cpp | 12 ++++ .../wallet/include/graphene/wallet/wallet.hpp | 8 +-- libraries/wallet/wallet.cpp | 16 ++--- tests/tests/sidechain_addresses_test.cpp | 10 +-- 15 files changed, 105 insertions(+), 81 deletions(-) diff --git a/libraries/chain/include/graphene/chain/protocol/sidechain_address.hpp b/libraries/chain/include/graphene/chain/protocol/sidechain_address.hpp index 71dfea1e..7418f55e 100644 --- a/libraries/chain/include/graphene/chain/protocol/sidechain_address.hpp +++ b/libraries/chain/include/graphene/chain/protocol/sidechain_address.hpp @@ -13,7 +13,7 @@ namespace graphene { namespace chain { account_id_type sidechain_address_account; graphene::peerplays_sidechain::sidechain_type sidechain; string deposit_address; - string withdrawal_address; + string withdraw_address; account_id_type fee_payer()const { return sidechain_address_account; } share_type calculate_fee(const fee_parameters_type& k)const { return 0; } @@ -28,7 +28,7 @@ namespace graphene { namespace chain { account_id_type sidechain_address_account; graphene::peerplays_sidechain::sidechain_type sidechain; optional deposit_address; - optional withdrawal_address; + optional withdraw_address; account_id_type fee_payer()const { return sidechain_address_account; } share_type calculate_fee(const fee_parameters_type& k)const { return 0; } @@ -51,12 +51,12 @@ namespace graphene { namespace chain { FC_REFLECT(graphene::chain::sidechain_address_add_operation::fee_parameters_type, (fee) ) FC_REFLECT(graphene::chain::sidechain_address_add_operation, (fee) - (sidechain_address_account)(sidechain)(deposit_address)(withdrawal_address) ) + (sidechain_address_account)(sidechain)(deposit_address)(withdraw_address) ) FC_REFLECT(graphene::chain::sidechain_address_update_operation::fee_parameters_type, (fee) ) FC_REFLECT(graphene::chain::sidechain_address_update_operation, (fee) (sidechain_address_id) - (sidechain_address_account)(sidechain)(deposit_address)(withdrawal_address) ) + (sidechain_address_account)(sidechain)(deposit_address)(withdraw_address) ) FC_REFLECT(graphene::chain::sidechain_address_delete_operation::fee_parameters_type, (fee) ) FC_REFLECT(graphene::chain::sidechain_address_delete_operation, (fee) diff --git a/libraries/chain/include/graphene/chain/sidechain_address_object.hpp b/libraries/chain/include/graphene/chain/sidechain_address_object.hpp index 8d45416f..910e5f9c 100644 --- a/libraries/chain/include/graphene/chain/sidechain_address_object.hpp +++ b/libraries/chain/include/graphene/chain/sidechain_address_object.hpp @@ -22,19 +22,19 @@ namespace graphene { namespace chain { account_id_type sidechain_address_account; graphene::peerplays_sidechain::sidechain_type sidechain; string deposit_address; - string withdrawal_address; + string withdraw_address; sidechain_address_object() : sidechain(graphene::peerplays_sidechain::sidechain_type::bitcoin), deposit_address(""), - withdrawal_address("") {} + withdraw_address("") {} }; struct by_account; struct by_sidechain; struct by_account_and_sidechain; struct by_sidechain_and_deposit_address; - struct by_sidechain_and_withdrawal_address; + struct by_sidechain_and_withdraw_address; using sidechain_address_multi_index_type = multi_index_container< sidechain_address_object, indexed_by< @@ -59,10 +59,10 @@ namespace graphene { namespace chain { member > >, - ordered_unique< tag, + ordered_unique< tag, composite_key, - member + member > > > @@ -72,4 +72,4 @@ namespace graphene { namespace chain { } } // graphene::chain FC_REFLECT_DERIVED( graphene::chain::sidechain_address_object, (graphene::db::object), - (sidechain_address_account) (sidechain) (deposit_address) (withdrawal_address) ) + (sidechain_address_account) (sidechain) (deposit_address) (withdraw_address) ) diff --git a/libraries/chain/sidechain_address_evaluator.cpp b/libraries/chain/sidechain_address_evaluator.cpp index dff233b6..5382195d 100644 --- a/libraries/chain/sidechain_address_evaluator.cpp +++ b/libraries/chain/sidechain_address_evaluator.cpp @@ -20,7 +20,7 @@ object_id_type add_sidechain_address_evaluator::do_apply(const sidechain_address obj.sidechain_address_account = op.sidechain_address_account; obj.sidechain = op.sidechain; obj.deposit_address = op.deposit_address; - obj.withdrawal_address = op.withdrawal_address; + obj.withdraw_address = op.withdraw_address; }); return new_sidechain_address_object.id; } FC_CAPTURE_AND_RETHROW( (op) ) } @@ -41,7 +41,7 @@ object_id_type update_sidechain_address_evaluator::do_apply(const sidechain_addr { db().modify(*itr, [&op](sidechain_address_object &sao) { if(op.deposit_address.valid()) sao.deposit_address = *op.deposit_address; - if(op.withdrawal_address.valid()) sao.withdrawal_address = *op.withdrawal_address; + if(op.withdraw_address.valid()) sao.withdraw_address = *op.withdraw_address; }); } return op.sidechain_address_id; diff --git a/libraries/plugins/peerplays_sidechain/include/graphene/peerplays_sidechain/sidechain_net_handler.hpp b/libraries/plugins/peerplays_sidechain/include/graphene/peerplays_sidechain/sidechain_net_handler.hpp index 9c3c0590..537d892d 100644 --- a/libraries/plugins/peerplays_sidechain/include/graphene/peerplays_sidechain/sidechain_net_handler.hpp +++ b/libraries/plugins/peerplays_sidechain/include/graphene/peerplays_sidechain/sidechain_net_handler.hpp @@ -17,11 +17,13 @@ public: graphene::peerplays_sidechain::sidechain_type get_sidechain(); std::vector get_sidechain_deposit_addresses(); - std::vector get_sidechain_withdrawal_addresses(); + std::vector get_sidechain_withdraw_addresses(); void sidechain_event_data_received(const sidechain_event_data& sed); virtual void recreate_primary_wallet() = 0; + virtual void process_deposits() = 0; + virtual void process_withdrawals() = 0; protected: peerplays_sidechain_plugin& plugin; diff --git a/libraries/plugins/peerplays_sidechain/include/graphene/peerplays_sidechain/sidechain_net_handler_bitcoin.hpp b/libraries/plugins/peerplays_sidechain/include/graphene/peerplays_sidechain/sidechain_net_handler_bitcoin.hpp index 3a4e958a..b4ec347e 100644 --- a/libraries/plugins/peerplays_sidechain/include/graphene/peerplays_sidechain/sidechain_net_handler_bitcoin.hpp +++ b/libraries/plugins/peerplays_sidechain/include/graphene/peerplays_sidechain/sidechain_net_handler_bitcoin.hpp @@ -71,6 +71,8 @@ public: virtual ~sidechain_net_handler_bitcoin(); void recreate_primary_wallet(); + void process_deposits(); + void process_withdrawals(); std::string create_multisignature_wallet( const std::vector public_keys ); std::string transfer( const std::string& from, const std::string& to, const uint64_t amount ); diff --git a/libraries/plugins/peerplays_sidechain/include/graphene/peerplays_sidechain/sidechain_net_handler_peerplays.hpp b/libraries/plugins/peerplays_sidechain/include/graphene/peerplays_sidechain/sidechain_net_handler_peerplays.hpp index 2307d328..90b7cb3c 100644 --- a/libraries/plugins/peerplays_sidechain/include/graphene/peerplays_sidechain/sidechain_net_handler_peerplays.hpp +++ b/libraries/plugins/peerplays_sidechain/include/graphene/peerplays_sidechain/sidechain_net_handler_peerplays.hpp @@ -14,6 +14,8 @@ public: virtual ~sidechain_net_handler_peerplays(); void recreate_primary_wallet(); + void process_deposits(); + void process_withdrawals(); std::string create_multisignature_wallet( const std::vector public_keys ); std::string transfer( const std::string& from, const std::string& to, const uint64_t amount ); diff --git a/libraries/plugins/peerplays_sidechain/include/graphene/peerplays_sidechain/sidechain_net_manager.hpp b/libraries/plugins/peerplays_sidechain/include/graphene/peerplays_sidechain/sidechain_net_manager.hpp index bd6f1ab3..b9ae658f 100644 --- a/libraries/plugins/peerplays_sidechain/include/graphene/peerplays_sidechain/sidechain_net_manager.hpp +++ b/libraries/plugins/peerplays_sidechain/include/graphene/peerplays_sidechain/sidechain_net_manager.hpp @@ -17,6 +17,8 @@ public: bool create_handler(peerplays_sidechain::sidechain_type sidechain, const boost::program_options::variables_map& options); void recreate_primary_wallet(); + void process_deposits(); + void process_withdrawals(); private: peerplays_sidechain_plugin& plugin; graphene::chain::database& database; diff --git a/libraries/plugins/peerplays_sidechain/peerplays_sidechain_plugin.cpp b/libraries/plugins/peerplays_sidechain/peerplays_sidechain_plugin.cpp index dfe92bff..01f43972 100644 --- a/libraries/plugins/peerplays_sidechain/peerplays_sidechain_plugin.cpp +++ b/libraries/plugins/peerplays_sidechain/peerplays_sidechain_plugin.cpp @@ -409,7 +409,7 @@ void peerplays_sidechain_plugin_impl::process_deposits() { plugin.app().p2p_node()->broadcast(net::trx_message(trx)); } catch(fc::exception e){ ilog("sidechain_net_handler: sending proposal for transfer operation failed with exception ${e}",("e", e.what())); - } +} } } }); @@ -428,6 +428,7 @@ void peerplays_sidechain_plugin_impl::process_withdrawals() { for (son_id_type son_id : plugin.get_sons()) { if (plugin.is_active_son(son_id)) { + ilog("Withdraw to process: ${swwo}", ("swwo", swwo)); //son_wallet_withdraw_process_operation p_op; //p_op.payer = GRAPHENE_SON_ACCOUNT; //p_op.son_wallet_withdraw_id = swwo.id; @@ -449,7 +450,7 @@ void peerplays_sidechain_plugin_impl::process_withdrawals() { //} catch(fc::exception e){ // ilog("sidechain_net_handler: sending proposal for transfer operation failed with exception ${e}",("e", e.what())); //} - } +} } }); } @@ -475,7 +476,7 @@ void peerplays_sidechain_plugin_impl::on_block_applied( const signed_block& b ) process_deposits(); - //process_withdrawals(); + process_withdrawals(); } } diff --git a/libraries/plugins/peerplays_sidechain/sidechain_net_handler.cpp b/libraries/plugins/peerplays_sidechain/sidechain_net_handler.cpp index a660a2b6..45ace614 100644 --- a/libraries/plugins/peerplays_sidechain/sidechain_net_handler.cpp +++ b/libraries/plugins/peerplays_sidechain/sidechain_net_handler.cpp @@ -22,44 +22,26 @@ graphene::peerplays_sidechain::sidechain_type sidechain_net_handler::get_sidecha std::vector sidechain_net_handler::get_sidechain_deposit_addresses() { std::vector result; - switch (sidechain) { - case sidechain_type::bitcoin: - { - const auto& sidechain_addresses_idx = database.get_index_type(); - const auto& sidechain_addresses_by_sidechain_idx = sidechain_addresses_idx.indices().get(); - const auto& sidechain_addresses_by_sidechain_range = sidechain_addresses_by_sidechain_idx.equal_range(sidechain); - std::for_each(sidechain_addresses_by_sidechain_range.first, sidechain_addresses_by_sidechain_range.second, - [&result] (const sidechain_address_object& sao) { - result.push_back(sao.deposit_address); - }); - break; - } - default: - assert(false); - } - + const auto& sidechain_addresses_idx = database.get_index_type(); + const auto& sidechain_addresses_by_sidechain_idx = sidechain_addresses_idx.indices().get(); + const auto& sidechain_addresses_by_sidechain_range = sidechain_addresses_by_sidechain_idx.equal_range(sidechain); + std::for_each(sidechain_addresses_by_sidechain_range.first, sidechain_addresses_by_sidechain_range.second, + [&result] (const sidechain_address_object& sao) { + result.push_back(sao.deposit_address); + }); return result; } -std::vector sidechain_net_handler::get_sidechain_withdrawal_addresses() { +std::vector sidechain_net_handler::get_sidechain_withdraw_addresses() { std::vector result; - switch (sidechain) { - case sidechain_type::bitcoin: - { - const auto& sidechain_addresses_idx = database.get_index_type(); - const auto& sidechain_addresses_by_sidechain_idx = sidechain_addresses_idx.indices().get(); - const auto& sidechain_addresses_by_sidechain_range = sidechain_addresses_by_sidechain_idx.equal_range(sidechain); - std::for_each(sidechain_addresses_by_sidechain_range.first, sidechain_addresses_by_sidechain_range.second, - [&result] (const sidechain_address_object& sao) { - result.push_back(sao.withdrawal_address); - }); - break; - } - default: - assert(false); - } - + const auto& sidechain_addresses_idx = database.get_index_type(); + const auto& sidechain_addresses_by_sidechain_idx = sidechain_addresses_idx.indices().get(); + const auto& sidechain_addresses_by_sidechain_range = sidechain_addresses_by_sidechain_idx.equal_range(sidechain); + std::for_each(sidechain_addresses_by_sidechain_range.first, sidechain_addresses_by_sidechain_range.second, + [&result] (const sidechain_address_object& sao) { + result.push_back(sao.withdraw_address); + }); return result; } @@ -103,14 +85,14 @@ void sidechain_net_handler::sidechain_event_data_received(const sidechain_event_ uint32_t lifetime = ( gpo.parameters.block_interval * gpo.active_witnesses.size() ) * 3; proposal_op.expiration_time = time_point_sec( database.head_block_time().sec_since_epoch() + lifetime ); - ilog("sidechain_net_handler: sending proposal for son wallet transfer create operation by ${son}", ("son", son_id)); + ilog("sidechain_net_handler: sending proposal for son wallet deposit create operation by ${son}", ("son", son_id)); signed_transaction trx = plugin.database().create_signed_transaction(plugin.get_private_key(son_id), proposal_op); try { database.push_transaction(trx, database::validation_steps::skip_block_size_check); if(plugin.app().p2p_node()) plugin.app().p2p_node()->broadcast(net::trx_message(trx)); } catch(fc::exception e){ - ilog("sidechain_net_handler: sending proposal for son wallet transfer create operation by ${son} failed with exception ${e}", ("son", son_id) ("e", e.what())); + ilog("sidechain_net_handler: sending proposal for son wallet deposit create operation by ${son} failed with exception ${e}", ("son", son_id) ("e", e.what())); } } } @@ -141,14 +123,14 @@ void sidechain_net_handler::sidechain_event_data_received(const sidechain_event_ uint32_t lifetime = ( gpo.parameters.block_interval * gpo.active_witnesses.size() ) * 3; proposal_op.expiration_time = time_point_sec( database.head_block_time().sec_since_epoch() + lifetime ); - ilog("sidechain_net_handler: sending proposal for son wallet transfer create operation by ${son}", ("son", son_id)); + ilog("sidechain_net_handler: sending proposal for son wallet withdraw create operation by ${son}", ("son", son_id)); signed_transaction trx = plugin.database().create_signed_transaction(plugin.get_private_key(son_id), proposal_op); try { database.push_transaction(trx, database::validation_steps::skip_block_size_check); if(plugin.app().p2p_node()) plugin.app().p2p_node()->broadcast(net::trx_message(trx)); } catch(fc::exception e){ - ilog("sidechain_net_handler: sending proposal for son wallet transfer create operation by ${son} failed with exception ${e}", ("son", son_id) ("e", e.what())); + ilog("sidechain_net_handler: sending proposal for son wallet withdraw create operation by ${son} failed with exception ${e}", ("son", son_id) ("e", e.what())); } } } @@ -158,5 +140,17 @@ void sidechain_net_handler::sidechain_event_data_received(const sidechain_event_ FC_ASSERT(false, "Invalid sidechain event"); } +void sidechain_net_handler::recreate_primary_wallet() { + FC_ASSERT(false, "recreate_primary_wallet not implemented"); +} + +void sidechain_net_handler::process_deposits() { + FC_ASSERT(false, "process_deposits not implemented"); +} + +void sidechain_net_handler::process_withdrawals() { + FC_ASSERT(false, "process_withdrawals not implemented"); +} + } } // graphene::peerplays_sidechain diff --git a/libraries/plugins/peerplays_sidechain/sidechain_net_handler_bitcoin.cpp b/libraries/plugins/peerplays_sidechain/sidechain_net_handler_bitcoin.cpp index c2b53130..cf2fefdc 100644 --- a/libraries/plugins/peerplays_sidechain/sidechain_net_handler_bitcoin.cpp +++ b/libraries/plugins/peerplays_sidechain/sidechain_net_handler_bitcoin.cpp @@ -15,6 +15,8 @@ #include #include #include +#include +#include #include namespace graphene { namespace peerplays_sidechain { @@ -422,23 +424,25 @@ void sidechain_net_handler_bitcoin::recreate_primary_wallet() { } } -std::string sidechain_net_handler_bitcoin::create_multisignature_wallet( const std::vector public_keys ) -{ +void sidechain_net_handler_bitcoin::process_deposits() { +} + +void sidechain_net_handler_bitcoin::process_withdrawals() { +} + +std::string sidechain_net_handler_bitcoin::create_multisignature_wallet( const std::vector public_keys ) { return bitcoin_client->add_multisig_address(public_keys); } -std::string sidechain_net_handler_bitcoin::transfer( const std::string& from, const std::string& to, const uint64_t amount ) -{ +std::string sidechain_net_handler_bitcoin::transfer( const std::string& from, const std::string& to, const uint64_t amount ) { return ""; } -std::string sidechain_net_handler_bitcoin::sign_transaction( const std::string& transaction ) -{ +std::string sidechain_net_handler_bitcoin::sign_transaction( const std::string& transaction ) { return ""; } -std::string sidechain_net_handler_bitcoin::send_transaction( const std::string& transaction ) -{ +std::string sidechain_net_handler_bitcoin::send_transaction( const std::string& transaction ) { return ""; } @@ -450,7 +454,7 @@ void sidechain_net_handler_bitcoin::handle_event( const std::string& event_data const auto& sidechain_addresses_idx = database.get_index_type().indices().get(); for( const auto& v : vins ) { - const auto& addr_itr = sidechain_addresses_idx.find(std::make_tuple(sidechain_type::bitcoin, v.address)); + const auto& addr_itr = sidechain_addresses_idx.find(std::make_tuple(sidechain, v.address)); if ( addr_itr == sidechain_addresses_idx.end() ) continue; @@ -475,8 +479,7 @@ void sidechain_net_handler_bitcoin::handle_event( const std::string& event_data } } -std::vector sidechain_net_handler_bitcoin::extract_info_from_block( const std::string& _block ) -{ +std::vector sidechain_net_handler_bitcoin::extract_info_from_block( const std::string& _block ) { std::stringstream ss( _block ); boost::property_tree::ptree block; boost::property_tree::read_json( ss, block ); diff --git a/libraries/plugins/peerplays_sidechain/sidechain_net_handler_peerplays.cpp b/libraries/plugins/peerplays_sidechain/sidechain_net_handler_peerplays.cpp index ae5931e5..0ae5c1c6 100644 --- a/libraries/plugins/peerplays_sidechain/sidechain_net_handler_peerplays.cpp +++ b/libraries/plugins/peerplays_sidechain/sidechain_net_handler_peerplays.cpp @@ -31,6 +31,12 @@ sidechain_net_handler_peerplays::~sidechain_net_handler_peerplays() { void sidechain_net_handler_peerplays::recreate_primary_wallet() { } +void sidechain_net_handler_peerplays::process_deposits() { +} + +void sidechain_net_handler_peerplays::process_withdrawals() { +} + std::string sidechain_net_handler_peerplays::create_multisignature_wallet( const std::vector public_keys ) { return ""; } diff --git a/libraries/plugins/peerplays_sidechain/sidechain_net_manager.cpp b/libraries/plugins/peerplays_sidechain/sidechain_net_manager.cpp index 0d4b7fa2..b9e5dd8d 100644 --- a/libraries/plugins/peerplays_sidechain/sidechain_net_manager.cpp +++ b/libraries/plugins/peerplays_sidechain/sidechain_net_manager.cpp @@ -46,5 +46,17 @@ void sidechain_net_manager::recreate_primary_wallet() { } } +void sidechain_net_manager::process_deposits() { + for ( size_t i = 0; i < net_handlers.size(); i++ ) { + net_handlers.at(i)->process_deposits(); + } +} + +void sidechain_net_manager::process_withdrawals() { + for ( size_t i = 0; i < net_handlers.size(); i++ ) { + net_handlers.at(i)->process_withdrawals(); + } +} + } } // graphene::peerplays_sidechain diff --git a/libraries/wallet/include/graphene/wallet/wallet.hpp b/libraries/wallet/include/graphene/wallet/wallet.hpp index 0f28de61..34fc1885 100644 --- a/libraries/wallet/include/graphene/wallet/wallet.hpp +++ b/libraries/wallet/include/graphene/wallet/wallet.hpp @@ -1417,14 +1417,14 @@ class wallet_api * @param account the name or id of the account who owns the address * @param sidechain a sidechain to whom address belongs * @param deposit_address sidechain address for deposits - * @param withdrawal_address sidechain address for withdrawals + * @param withdraw_address sidechain address for withdrawals * @param broadcast true to broadcast the transaction on the network * @returns the signed transaction adding sidechain address */ signed_transaction add_sidechain_address(string account, peerplays_sidechain::sidechain_type sidechain, string deposit_address, - string withdrawal_address, + string withdraw_address, bool broadcast = false); /** Updates existing sidechain address owned by the given account for a given sidechain. @@ -1434,14 +1434,14 @@ class wallet_api * @param account the name or id of the account who owns the address * @param sidechain a sidechain to whom address belongs * @param deposit_address sidechain address for deposits - * @param withdrawal_address sidechain address for withdrawals + * @param withdraw_address sidechain address for withdrawals * @param broadcast true to broadcast the transaction on the network * @returns the signed transaction updating sidechain address */ signed_transaction update_sidechain_address(string account, peerplays_sidechain::sidechain_type sidechain, string deposit_address, - string withdrawal_address, + string withdraw_address, bool broadcast = false); /** Deletes existing sidechain address owned by the given account for a given sidechain. diff --git a/libraries/wallet/wallet.cpp b/libraries/wallet/wallet.cpp index 195971ec..a263faec 100644 --- a/libraries/wallet/wallet.cpp +++ b/libraries/wallet/wallet.cpp @@ -2023,7 +2023,7 @@ public: signed_transaction add_sidechain_address(string account, peerplays_sidechain::sidechain_type sidechain, string deposit_address, - string withdrawal_address, + string withdraw_address, bool broadcast /* = false */) { try { account_id_type sidechain_address_account_id = get_account_id(account); @@ -2032,7 +2032,7 @@ public: op.sidechain_address_account = sidechain_address_account_id; op.sidechain = sidechain; op.deposit_address = deposit_address; - op.withdrawal_address = withdrawal_address; + op.withdraw_address = withdraw_address; signed_transaction tx; tx.operations.push_back( op ); @@ -2045,7 +2045,7 @@ public: signed_transaction update_sidechain_address(string account, peerplays_sidechain::sidechain_type sidechain, string deposit_address, - string withdrawal_address, + string withdraw_address, bool broadcast /* = false */) { try { account_id_type sidechain_address_account_id = get_account_id(account); @@ -2058,7 +2058,7 @@ public: op.sidechain_address_account = sidechain_address_account_id; op.sidechain = sidechain; op.deposit_address = deposit_address; - op.withdrawal_address = withdrawal_address; + op.withdraw_address = withdraw_address; signed_transaction tx; tx.operations.push_back( op ); @@ -4498,19 +4498,19 @@ vector> wallet_api::get_son_wallets(uint32_t limit) signed_transaction wallet_api::add_sidechain_address(string account, peerplays_sidechain::sidechain_type sidechain, string deposit_address, - string withdrawal_address, + string withdraw_address, bool broadcast /* = false */) { - return my->add_sidechain_address(account, sidechain, deposit_address, withdrawal_address, broadcast); + return my->add_sidechain_address(account, sidechain, deposit_address, withdraw_address, broadcast); } signed_transaction wallet_api::update_sidechain_address(string account, peerplays_sidechain::sidechain_type sidechain, string deposit_address, - string withdrawal_address, + string withdraw_address, bool broadcast /* = false */) { - return my->update_sidechain_address(account, sidechain, deposit_address, withdrawal_address, broadcast); + return my->update_sidechain_address(account, sidechain, deposit_address, withdraw_address, broadcast); } signed_transaction wallet_api::delete_sidechain_address(string account, diff --git a/tests/tests/sidechain_addresses_test.cpp b/tests/tests/sidechain_addresses_test.cpp index 6c712fdd..bee7cec8 100644 --- a/tests/tests/sidechain_addresses_test.cpp +++ b/tests/tests/sidechain_addresses_test.cpp @@ -31,7 +31,7 @@ BOOST_AUTO_TEST_CASE( sidechain_address_add_test ) { op.sidechain_address_account = alice_id; op.sidechain = graphene::peerplays_sidechain::sidechain_type::bitcoin; op.deposit_address = "deposit_address"; - op.withdrawal_address = "withdrawal_address"; + op.withdraw_address = "withdraw_address"; trx.operations.push_back(op); sign(trx, alice_private_key); @@ -48,7 +48,7 @@ BOOST_AUTO_TEST_CASE( sidechain_address_add_test ) { BOOST_CHECK( obj->sidechain_address_account == alice_id ); BOOST_CHECK( obj->sidechain == graphene::peerplays_sidechain::sidechain_type::bitcoin ); BOOST_CHECK( obj->deposit_address == "deposit_address" ); - BOOST_CHECK( obj->withdrawal_address == "withdrawal_address" ); + BOOST_CHECK( obj->withdraw_address == "withdraw_address" ); } BOOST_AUTO_TEST_CASE( sidechain_address_update_test ) { @@ -65,7 +65,7 @@ BOOST_AUTO_TEST_CASE( sidechain_address_update_test ) { BOOST_REQUIRE( obj != idx.end() ); std::string new_deposit_address = "new_deposit_address"; - std::string new_withdrawal_address = "new_withdrawal_address"; + std::string new_withdraw_address = "new_withdraw_address"; { BOOST_TEST_MESSAGE("Send sidechain_address_update_operation"); @@ -75,7 +75,7 @@ BOOST_AUTO_TEST_CASE( sidechain_address_update_test ) { op.sidechain_address_account = obj->sidechain_address_account; op.sidechain = obj->sidechain; op.deposit_address = new_deposit_address; - op.withdrawal_address = new_withdrawal_address; + op.withdraw_address = new_withdraw_address; trx.operations.push_back(op); sign(trx, alice_private_key); @@ -93,7 +93,7 @@ BOOST_AUTO_TEST_CASE( sidechain_address_update_test ) { BOOST_CHECK( obj->sidechain_address_account == obj->sidechain_address_account ); BOOST_CHECK( obj->sidechain == obj->sidechain ); BOOST_CHECK( obj->deposit_address == new_deposit_address ); - BOOST_CHECK( obj->withdrawal_address == new_withdrawal_address ); + BOOST_CHECK( obj->withdraw_address == new_withdraw_address ); } }