From 6c90bd30e8c01d74289eac0e7bcc3cbcbc2bf2f4 Mon Sep 17 00:00:00 2001 From: cwyy <cwyyprog@163.com> Date: Mon, 13 Aug 2018 20:26:26 +0800 Subject: [PATCH 1/2] clean old style codes --- libraries/chain/protocol/fee_schedule.cpp | 2 +- libraries/db/include/graphene/db/generic_index.hpp | 2 +- libraries/db/include/graphene/db/undo_database.hpp | 2 +- libraries/plugins/market_history/market_history_plugin.cpp | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/libraries/chain/protocol/fee_schedule.cpp b/libraries/chain/protocol/fee_schedule.cpp index baaecdc9f2..911f7ac924 100644 --- a/libraries/chain/protocol/fee_schedule.cpp +++ b/libraries/chain/protocol/fee_schedule.cpp @@ -88,7 +88,7 @@ namespace graphene { namespace chain { { try { return op.calculate_fee( param.get<OpType>() ).value; - } catch (fc::assert_exception e) { + } catch (fc::assert_exception& e) { fee_parameters params; params.set_which(current_op); auto itr = param.parameters.find(params); if( itr != param.parameters.end() ) params = *itr; diff --git a/libraries/db/include/graphene/db/generic_index.hpp b/libraries/db/include/graphene/db/generic_index.hpp index 10e5d19ee6..fb11d44a37 100644 --- a/libraries/db/include/graphene/db/generic_index.hpp +++ b/libraries/db/include/graphene/db/generic_index.hpp @@ -73,7 +73,7 @@ namespace graphene { namespace chain { [&m, &exc](ObjectType& o) mutable { try { m(o); - } catch (fc::exception e) { + } catch (fc::exception& e) { exc = std::current_exception(); elog("Exception while modifying object: ${e} -- object may be corrupted", ("e", e)); diff --git a/libraries/db/include/graphene/db/undo_database.hpp b/libraries/db/include/graphene/db/undo_database.hpp index 9f10486960..765d32c6ae 100644 --- a/libraries/db/include/graphene/db/undo_database.hpp +++ b/libraries/db/include/graphene/db/undo_database.hpp @@ -66,7 +66,7 @@ namespace graphene { namespace db { catch ( const fc::exception& e ) { elog( "${e}", ("e",e.to_detail_string() ) ); - throw; // maybe crash.. + //throw; // maybe crash.. } if( _disable_on_exit ) _db.disable(); } diff --git a/libraries/plugins/market_history/market_history_plugin.cpp b/libraries/plugins/market_history/market_history_plugin.cpp index 3f3277e475..004c3891b3 100644 --- a/libraries/plugins/market_history/market_history_plugin.cpp +++ b/libraries/plugins/market_history/market_history_plugin.cpp @@ -247,12 +247,12 @@ struct operation_process_fill_order db.modify( *bucket_itr, [&]( bucket_object& b ){ try { b.base_volume += trade_price.base.amount; - } catch( fc::overflow_exception ) { + } catch( fc::overflow_exception& ) { b.base_volume = std::numeric_limits<int64_t>::max(); } try { b.quote_volume += trade_price.quote.amount; - } catch( fc::overflow_exception ) { + } catch( fc::overflow_exception& ) { b.quote_volume = std::numeric_limits<int64_t>::max(); } b.close_base = fill_price.base.amount; From c064d197497cc332d19282fbd32e25cbf635b599 Mon Sep 17 00:00:00 2001 From: cwyyprog <cwyyprog@163.com> Date: Tue, 14 Aug 2018 19:26:54 +0800 Subject: [PATCH 2/2] Stay unchanged for agreement As no agreement is reached, undo the modifying --- libraries/db/include/graphene/db/undo_database.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/db/include/graphene/db/undo_database.hpp b/libraries/db/include/graphene/db/undo_database.hpp index 765d32c6ae..9f10486960 100644 --- a/libraries/db/include/graphene/db/undo_database.hpp +++ b/libraries/db/include/graphene/db/undo_database.hpp @@ -66,7 +66,7 @@ namespace graphene { namespace db { catch ( const fc::exception& e ) { elog( "${e}", ("e",e.to_detail_string() ) ); - //throw; // maybe crash.. + throw; // maybe crash.. } if( _disable_on_exit ) _db.disable(); }