From d1ab9037c7bcb646ff491ab7ccf2da49349c4c0c Mon Sep 17 00:00:00 2001 From: Alfredo Garcia Date: Fri, 25 Oct 2019 10:15:50 -0300 Subject: [PATCH 1/3] remove check --- libraries/app/api.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/libraries/app/api.cpp b/libraries/app/api.cpp index 99564106a2..59af8f17b3 100644 --- a/libraries/app/api.cpp +++ b/libraries/app/api.cpp @@ -122,8 +122,7 @@ namespace graphene { namespace app { } else if( api_name == "custom_operations_api" ) { - if( _app.get_plugin( "custom_operations" ) ) - _custom_operations_api = std::make_shared< custom_operations_api >( std::ref( _app ) ); + _custom_operations_api = std::make_shared< custom_operations_api >( std::ref( _app ) ); } else if( api_name == "debug_api" ) { From 860fe964c7ea81b6aefa96721118a8e988b56913 Mon Sep 17 00:00:00 2001 From: Alfredo Garcia Date: Fri, 25 Oct 2019 14:01:19 -0300 Subject: [PATCH 2/3] add try-catch to wallet for custom_operations plugin api --- libraries/app/api.cpp | 3 ++- libraries/wallet/wallet_api_impl.cpp | 10 ++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/libraries/app/api.cpp b/libraries/app/api.cpp index 59af8f17b3..99564106a2 100644 --- a/libraries/app/api.cpp +++ b/libraries/app/api.cpp @@ -122,7 +122,8 @@ namespace graphene { namespace app { } else if( api_name == "custom_operations_api" ) { - _custom_operations_api = std::make_shared< custom_operations_api >( std::ref( _app ) ); + if( _app.get_plugin( "custom_operations" ) ) + _custom_operations_api = std::make_shared< custom_operations_api >( std::ref( _app ) ); } else if( api_name == "debug_api" ) { diff --git a/libraries/wallet/wallet_api_impl.cpp b/libraries/wallet/wallet_api_impl.cpp index 5d23c20be4..36fe5a7557 100644 --- a/libraries/wallet/wallet_api_impl.cpp +++ b/libraries/wallet/wallet_api_impl.cpp @@ -56,9 +56,15 @@ namespace graphene { namespace wallet { namespace detail { _remote_api(rapi), _remote_db(rapi->database()), _remote_net_broadcast(rapi->network_broadcast()), - _remote_hist(rapi->history()), - _custom_operations(rapi->custom()) + _remote_hist(rapi->history()) { + try { + _custom_operations = rapi->custom(); + } + catch(const fc::exception& e) + { + wlog("Custom operations plugin is not loaded."); + } chain_id_type remote_chain_id = _remote_db->get_chain_id(); if( remote_chain_id != _chain_id ) { From f6738ec1108d36a9700641eb31a4c0274302f00f Mon Sep 17 00:00:00 2001 From: Alfredo Garcia Date: Fri, 25 Oct 2019 18:49:30 -0300 Subject: [PATCH 3/3] add try to get_account_storage, edit wlog --- libraries/wallet/wallet.cpp | 4 ++-- libraries/wallet/wallet_api_impl.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/libraries/wallet/wallet.cpp b/libraries/wallet/wallet.cpp index 927e4a803d..f2b753a778 100644 --- a/libraries/wallet/wallet.cpp +++ b/libraries/wallet/wallet.cpp @@ -1905,9 +1905,9 @@ signed_transaction wallet_api::account_store_map(string account, string catalog, } vector wallet_api::get_account_storage(string account, string catalog) -{ +{ try { return my->_custom_operations->get_storage_info(account, catalog); -} +} FC_CAPTURE_AND_RETHROW( (account)(catalog) ) } signed_block_with_info::signed_block_with_info( const signed_block& block ) : signed_block( block ) diff --git a/libraries/wallet/wallet_api_impl.cpp b/libraries/wallet/wallet_api_impl.cpp index 36fe5a7557..b3316b36a5 100644 --- a/libraries/wallet/wallet_api_impl.cpp +++ b/libraries/wallet/wallet_api_impl.cpp @@ -63,7 +63,7 @@ namespace graphene { namespace wallet { namespace detail { } catch(const fc::exception& e) { - wlog("Custom operations plugin is not loaded."); + wlog("Custom operations API is not active on server."); } chain_id_type remote_chain_id = _remote_db->get_chain_id(); if( remote_chain_id != _chain_id )