From f42bbcd0876af1669fcdcc863d597fd98a9fa912 Mon Sep 17 00:00:00 2001 From: theoreticalbts Date: Tue, 15 Dec 2015 11:38:40 -0500 Subject: [PATCH] Fix non-BTS MIA core_exchange_rate check #480 --- libraries/chain/asset_evaluator.cpp | 14 ++++++++++++++ .../chain/include/graphene/chain/hardfork.hpp | 2 ++ libraries/chain/protocol/asset_ops.cpp | 1 - 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/libraries/chain/asset_evaluator.cpp b/libraries/chain/asset_evaluator.cpp index 6a1e72ec..6d2e90c7 100644 --- a/libraries/chain/asset_evaluator.cpp +++ b/libraries/chain/asset_evaluator.cpp @@ -491,6 +491,20 @@ void_result asset_publish_feeds_evaluator::do_evaluate(const asset_publish_feed_ FC_ASSERT( !bitasset.has_settlement(), "No further feeds may be published after a settlement event" ); FC_ASSERT( o.feed.settlement_price.quote.asset_id == bitasset.options.short_backing_asset ); + if( d.head_block_time() > HARDFORK_480_TIME ) + { + if( !o.feed.core_exchange_rate.is_null() ) + { + FC_ASSERT( o.feed.core_exchange_rate.quote.asset_id == asset_id_type() ); + } + } + else + { + if( (!o.feed.settlement_price.is_null()) && (!o.feed.core_exchange_rate.is_null()) ) + { + FC_ASSERT( o.feed.settlement_price.quote.asset_id == o.feed.core_exchange_rate.quote.asset_id ); + } + } //Verify that the publisher is authoritative to publish a feed if( base.options.flags & witness_fed_asset ) diff --git a/libraries/chain/include/graphene/chain/hardfork.hpp b/libraries/chain/include/graphene/chain/hardfork.hpp index c5e50f03..121e3f20 100644 --- a/libraries/chain/include/graphene/chain/hardfork.hpp +++ b/libraries/chain/include/graphene/chain/hardfork.hpp @@ -27,3 +27,5 @@ #define HARDFORK_415_TIME (fc::time_point_sec( 1446652800 )) #define HARDFORK_416_TIME (fc::time_point_sec( 1446652800 )) #define HARDFORK_419_TIME (fc::time_point_sec( 1446652800 )) + +#define HARDFORK_480_TIME (fc::time_point_sec( 1450378800 )) diff --git a/libraries/chain/protocol/asset_ops.cpp b/libraries/chain/protocol/asset_ops.cpp index bf0c126a..530fa70f 100644 --- a/libraries/chain/protocol/asset_ops.cpp +++ b/libraries/chain/protocol/asset_ops.cpp @@ -136,7 +136,6 @@ void asset_publish_feed_operation::validate()const if( (!feed.settlement_price.is_null()) && (!feed.core_exchange_rate.is_null()) ) { FC_ASSERT( feed.settlement_price.base.asset_id == feed.core_exchange_rate.base.asset_id ); - FC_ASSERT( feed.settlement_price.quote.asset_id == feed.core_exchange_rate.quote.asset_id ); } FC_ASSERT( !feed.settlement_price.is_null() );