From 02b0e02042481f5bfb9b28fbed64171f37775708 Mon Sep 17 00:00:00 2001 From: william Date: Tue, 27 Mar 2018 12:18:42 +0800 Subject: [PATCH 1/3] =?UTF-8?q?when=20global=20settle=20an=20asset=20that?= =?UTF-8?q?=20backed=20by=20non=20core=20asset=20and=20quote=20price=20= 0 ) --- libraries/chain/asset_evaluator.cpp | 7 +++++++ libraries/chain/db_market.cpp | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/libraries/chain/asset_evaluator.cpp b/libraries/chain/asset_evaluator.cpp index 9802a647ce..d789c2b1aa 100644 --- a/libraries/chain/asset_evaluator.cpp +++ b/libraries/chain/asset_evaluator.cpp @@ -433,6 +433,13 @@ void_result asset_global_settle_evaluator::do_evaluate(const asset_global_settle FC_ASSERT(asset_to_settle->can_global_settle()); FC_ASSERT(asset_to_settle->issuer == op.issuer ); FC_ASSERT(asset_to_settle->dynamic_data(d).current_supply > 0); + + const asset_bitasset_data_object* bitasset_data = &asset_to_settle->bitasset_data(d); + if( bitasset.is_prediction_market ) { + /// if there is a settlement for this asset, then no further global settle may be taken and + FC_ASSERT( !bitasset_data->has_settlement(),"This asset has settlement, cannot global settle twice" ); + } + const auto& idx = d.get_index_type().indices().get(); assert( !idx.empty() ); auto itr = idx.lower_bound(boost::make_tuple(price::min(asset_to_settle->bitasset_data(d).options.short_backing_asset, diff --git a/libraries/chain/db_market.cpp b/libraries/chain/db_market.cpp index 93e3ac07fa..699e2da8cf 100644 --- a/libraries/chain/db_market.cpp +++ b/libraries/chain/db_market.cpp @@ -460,7 +460,7 @@ bool database::fill_order( const call_order_object& order, const asset& pays, co adjust_balance(borrower.get_id(), *collateral_freed); modify( borrower_statistics, [&]( account_statistics_object& b ){ - if( collateral_freed && collateral_freed->amount > 0 ) + if( collateral_freed && collateral_freed->amount > 0 && collateral_freed->asset_id == asset_id_type()) b.total_core_in_orders -= collateral_freed->amount; if( pays.asset_id == asset_id_type() ) b.total_core_in_orders -= pays.amount; From 9a4fe8f93b3a43cc36216fb905af0054e96c788c Mon Sep 17 00:00:00 2001 From: Abit Date: Tue, 27 Mar 2018 22:38:01 +0200 Subject: [PATCH 2/3] Bump DB version --- libraries/chain/include/graphene/chain/config.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/chain/include/graphene/chain/config.hpp b/libraries/chain/include/graphene/chain/config.hpp index 9a0f34182d..67f2a7283f 100644 --- a/libraries/chain/include/graphene/chain/config.hpp +++ b/libraries/chain/include/graphene/chain/config.hpp @@ -144,7 +144,7 @@ #define GRAPHENE_RECENTLY_MISSED_COUNT_INCREMENT 4 #define GRAPHENE_RECENTLY_MISSED_COUNT_DECREMENT 3 -#define GRAPHENE_CURRENT_DB_VERSION "BTS2.12" +#define GRAPHENE_CURRENT_DB_VERSION "BTS2.13" #define GRAPHENE_IRREVERSIBLE_THRESHOLD (70 * GRAPHENE_1_PERCENT) From bd513797eb1d464da0f77a9a318eeaefe8432709 Mon Sep 17 00:00:00 2001 From: abitmore Date: Tue, 27 Mar 2018 16:53:36 -0400 Subject: [PATCH 3/3] Bump FC version --- libraries/fc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/fc b/libraries/fc index 88d371b0fa..4441e14807 160000 --- a/libraries/fc +++ b/libraries/fc @@ -1 +1 @@ -Subproject commit 88d371b0faae644715b25a05efcdde4158a3487c +Subproject commit 4441e1480778d8e98c4d0322b0e42b19752640b5