Removed redundant if from asset_evaluator and fixed db_notify

This commit is contained in:
Prabhjot 2019-08-09 13:18:09 -04:00
parent afe6cba258
commit 80dc2003b9
2 changed files with 14 additions and 16 deletions

View file

@ -263,12 +263,11 @@ void_result lottery_asset_create_evaluator::do_evaluate( const lottery_asset_cre
FC_ASSERT( op.precision == op.bitasset_opts->short_backing_asset(d).precision ); FC_ASSERT( op.precision == op.bitasset_opts->short_backing_asset(d).precision );
} }
if( op.extensions.which() == asset_extension::tag<lottery_asset_options>::value ) { FC_ASSERT( op.common_options.max_supply >= 5 );
FC_ASSERT( op.common_options.max_supply >= 5 ); auto lottery_options = op.extensions;
auto lottery_options = op.extensions; lottery_options.validate();
lottery_options.validate(); FC_ASSERT( lottery_options.end_date > d.head_block_time() || lottery_options.end_date == time_point_sec() );
FC_ASSERT( lottery_options.end_date > d.head_block_time() || lottery_options.end_date == time_point_sec() );
}
return void_result(); return void_result();
} FC_CAPTURE_AND_RETHROW( (op) ) } } FC_CAPTURE_AND_RETHROW( (op) ) }
@ -313,15 +312,13 @@ object_id_type lottery_asset_create_evaluator::do_apply( const lottery_asset_cre
a.symbol = op.symbol; a.symbol = op.symbol;
a.precision = op.precision; a.precision = op.precision;
a.options = op.common_options; a.options = op.common_options;
if( op.extensions.which() == asset_extension::tag<lottery_asset_options>::value ) { a.precision = 0;
a.precision = 0; a.lottery_options = op.extensions;
a.lottery_options = op.extensions; //a.lottery_options->balance = asset( 0, a.lottery_options->ticket_price.asset_id );
//a.lottery_options->balance = asset( 0, a.lottery_options->ticket_price.asset_id ); a.lottery_options->owner = a.id;
a.lottery_options->owner = a.id; db().create<lottery_balance_object>([&](lottery_balance_object& lbo) {
db().create<lottery_balance_object>([&](lottery_balance_object& lbo) { lbo.lottery_id = a.id;
lbo.lottery_id = a.id; });
});
}
if( a.options.core_exchange_rate.base.asset_id.instance.value == 0 ) if( a.options.core_exchange_rate.base.asset_id.instance.value == 0 )
a.options.core_exchange_rate.quote.asset_id = next_asset_id; a.options.core_exchange_rate.quote.asset_id = next_asset_id;
else else

View file

@ -269,6 +269,7 @@ struct get_impacted_account_visitor
_impacted.insert( op.affiliate ); _impacted.insert( op.affiliate );
} }
void operator()( const affiliate_referral_payout_operation& op ) { } void operator()( const affiliate_referral_payout_operation& op ) { }
void operator()( const lottery_asset_create_operation& op ) {}
void operator()( const ticket_purchase_operation& op ) void operator()( const ticket_purchase_operation& op )
{ {
_impacted.insert( op.buyer ); _impacted.insert( op.buyer );