diff --git a/libraries/chain/db_market.cpp b/libraries/chain/db_market.cpp index 2e5c878ddc..c0a733fb63 100644 --- a/libraries/chain/db_market.cpp +++ b/libraries/chain/db_market.cpp @@ -99,6 +99,18 @@ bool database::check_for_blackswan( const asset_object& mia, bool enable_black_s auto limit_itr = limit_price_index.lower_bound( highest_possible_bid ); auto limit_end = limit_price_index.upper_bound( lowest_possible_bid ); + price call_pays_price; + if( limit_itr != limit_end ) + { + FC_ASSERT( highest.base.asset_id == limit_itr->sell_price.base.asset_id ); + call_pays_price = limit_itr->sell_price; + if( after_core_hardfork_2481 ) + { + // due to margin call fee, we check with MCPP (margin call pays price) here + call_pays_price = call_pays_price * bitasset.get_margin_call_pays_ratio(); + } + } + using bsrm_type = bitasset_options::black_swan_response_type; const auto bsrm = bitasset.get_black_swan_response_method(); @@ -122,13 +134,6 @@ bool database::check_for_blackswan( const asset_object& mia, bool enable_black_s if( limit_itr != limit_end ) { - FC_ASSERT( highest.base.asset_id == limit_itr->sell_price.base.asset_id ); - auto call_pays_price = limit_itr->sell_price; - if( after_core_hardfork_2481 ) - { - // due to margin call fee, we check with MCPP (margin call pays price) here - call_pays_price = call_pays_price * bitasset.get_margin_call_pays_ratio(); - } if( bsrm_type::individual_settlement_to_fund != bsrm ) highest = std::max( call_pays_price, highest ); // for individual_settlement_to_fund, if call_pays_price < current_feed.max_short_squeeze_price(),