diff --git a/libraries/chain/db_market.cpp b/libraries/chain/db_market.cpp index f6b87393..9c2971d9 100644 --- a/libraries/chain/db_market.cpp +++ b/libraries/chain/db_market.cpp @@ -339,14 +339,12 @@ bool database::fill_order( const call_order_object& order, const asset& pays, co }); } - if( collateral_freed ) - { - remove( order ); - } - assert( pays.asset_id != receives.asset_id ); push_applied_operation( fill_order_operation{ order.id, order.borrower, pays, receives, asset(0, pays.asset_id) } ); + if( collateral_freed ) + remove( order ); + return collateral_freed.valid(); } FC_CAPTURE_AND_RETHROW( (order)(pays)(receives) ) } diff --git a/libraries/chain/market_evaluator.cpp b/libraries/chain/market_evaluator.cpp index 77f15cf6..dcf5536c 100644 --- a/libraries/chain/market_evaluator.cpp +++ b/libraries/chain/market_evaluator.cpp @@ -222,16 +222,18 @@ void_result call_order_update_evaluator::do_apply(const call_order_update_operat // limit orders available that could be used to fill the order. if( d.check_call_orders( *_debt_asset, false ) ) { + auto call_obj = find_object(call_order_id); // if we filled at least one call order, we are OK if we totally filled. GRAPHENE_ASSERT( !d.find_object( call_order_id ), call_order_update_unfilled_margin_call, "Updating call order would trigger a margin call that cannot be fully filled", - ("a", ~call_obj->call_price)("b", _bitasset_data->current_feed.settlement_price) + ("a", call_obj ? ~call_obj->call_price : "NULL")("b", _bitasset_data->current_feed.settlement_price) ); } else { + auto call_obj = find_object(call_order_id); //edump( (~call_obj->call_price) ("<")( _bitasset_data->current_feed.settlement_price) ); // We didn't fill any call orders. This may be because we // aren't in margin call territory, or it may be because there @@ -240,7 +242,7 @@ void_result call_order_update_evaluator::do_apply(const call_order_update_operat ~call_obj->call_price < _bitasset_data->current_feed.settlement_price, call_order_update_unfilled_margin_call, "Updating call order would trigger a margin call that cannot be fully filled", - ("a", ~call_obj->call_price)("b", _bitasset_data->current_feed.settlement_price) + ("a",call_obj ? ~call_obj->call_price : "NULL")("b", _bitasset_data->current_feed.settlement_price) ); } }