From eb1895ef55a234674e28c682a4f4b1e391a52040 Mon Sep 17 00:00:00 2001 From: Daniel Larimer Date: Thu, 8 Oct 2015 15:03:35 -0400 Subject: [PATCH] fix derefrence of null, fix build, restore compat with oct5 test net --- libraries/chain/db_block.cpp | 7 +++++-- libraries/chain/db_maint.cpp | 3 ++- libraries/chain/market_evaluator.cpp | 10 +++++----- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/libraries/chain/db_block.cpp b/libraries/chain/db_block.cpp index f2652ac8..afa7ca80 100644 --- a/libraries/chain/db_block.cpp +++ b/libraries/chain/db_block.cpp @@ -640,8 +640,11 @@ const witness_object& database::validate_block_header( uint32_t skip, const sign witness_id_type scheduled_witness = get_scheduled_witness( slot_num ); - FC_ASSERT( next_block.witness == scheduled_witness, "Witness produced block at wrong time", - ("block witness",next_block.witness)("scheduled",scheduled_witness)("slot_num",slot_num) ); +#warning remove this hardfork check for next release + if( next_block.block_num() > 58500 ) { + FC_ASSERT( next_block.witness == scheduled_witness, "Witness produced block at wrong time", + ("block witness",next_block.witness)("scheduled",scheduled_witness)("slot_num",slot_num) ); + } } return witness; diff --git a/libraries/chain/db_maint.cpp b/libraries/chain/db_maint.cpp index 748681b7..91b9ec02 100644 --- a/libraries/chain/db_maint.cpp +++ b/libraries/chain/db_maint.cpp @@ -47,7 +47,8 @@ vector> database::sort template void database::perform_account_maintenance(std::tuple helpers) { - const auto& idx = get_index_type().indices().get(); +#warning switch to this for next release: const auto& idx = get_index_type().indices().get(); + const auto& idx = get_index_type().indices(); for( const account_object& a : idx ) detail::for_each(helpers, a, detail::gen_seq()); } diff --git a/libraries/chain/market_evaluator.cpp b/libraries/chain/market_evaluator.cpp index dcf5536c..3267f169 100644 --- a/libraries/chain/market_evaluator.cpp +++ b/libraries/chain/market_evaluator.cpp @@ -216,24 +216,24 @@ void_result call_order_update_evaluator::do_apply(const call_order_update_operat // then we must check for margin calls and other issues if( !_bitasset_data->is_prediction_market ) { - auto call_order_id = call_obj->id; + call_order_id_type call_order_id = call_obj->id; // check to see if the order needs to be margin called now, but don't allow black swans and require there to be // 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); + const auto call_obj = d.find(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_obj->call_price : "NULL")("b", _bitasset_data->current_feed.settlement_price) + ("a", call_obj ? ~call_obj->call_price : price())("b", _bitasset_data->current_feed.settlement_price) ); } else { - auto call_obj = find_object(call_order_id); + const auto call_obj = d.find(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 @@ -242,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_obj->call_price : "NULL")("b", _bitasset_data->current_feed.settlement_price) + ("a",call_obj ? ~call_obj->call_price : price())("b", _bitasset_data->current_feed.settlement_price) ); } }