#421 fix double in consensus of nft_lottery_token_purchase

This commit is contained in:
Milos Milosevic 2023-02-10 14:50:23 +00:00 committed by serkixenos
parent 70cd09495e
commit e44ed0cfe5
2 changed files with 4 additions and 4 deletions

View file

@ -18,7 +18,7 @@ namespace graphene
// Buyer purchasing lottery tickets // Buyer purchasing lottery tickets
account_id_type buyer; account_id_type buyer;
// count of tickets to buy // count of tickets to buy
uint64_t tickets_to_buy; share_type tickets_to_buy;
// amount that can spent // amount that can spent
asset amount; asset amount;
@ -83,4 +83,4 @@ FC_REFLECT(graphene::chain::nft_lottery_reward_operation::fee_parameters_type, (
FC_REFLECT(graphene::chain::nft_lottery_end_operation::fee_parameters_type, (fee)) FC_REFLECT(graphene::chain::nft_lottery_end_operation::fee_parameters_type, (fee))
FC_REFLECT(graphene::chain::nft_lottery_token_purchase_operation, (fee)(lottery_id)(buyer)(tickets_to_buy)(amount)(extensions)) FC_REFLECT(graphene::chain::nft_lottery_token_purchase_operation, (fee)(lottery_id)(buyer)(tickets_to_buy)(amount)(extensions))
FC_REFLECT(graphene::chain::nft_lottery_reward_operation, (fee)(lottery_id)(winner)(amount)(win_percentage)(is_benefactor_reward)(winner_ticket_id)(extensions)) FC_REFLECT(graphene::chain::nft_lottery_reward_operation, (fee)(lottery_id)(winner)(amount)(win_percentage)(is_benefactor_reward)(winner_ticket_id)(extensions))
FC_REFLECT(graphene::chain::nft_lottery_end_operation, (fee)(lottery_id)(extensions)) FC_REFLECT(graphene::chain::nft_lottery_end_operation, (fee)(lottery_id)(extensions))

View file

@ -30,7 +30,7 @@ namespace graphene
auto lottery_options = lottery_md_obj.lottery_data->lottery_options; auto lottery_options = lottery_md_obj.lottery_data->lottery_options;
FC_ASSERT(lottery_options.ticket_price.asset_id == op.amount.asset_id); FC_ASSERT(lottery_options.ticket_price.asset_id == op.amount.asset_id);
FC_ASSERT((double)op.amount.amount.value / lottery_options.ticket_price.amount.value == (double)op.tickets_to_buy); FC_ASSERT(op.tickets_to_buy * lottery_options.ticket_price.amount.value == op.amount.amount.value);
return void_result(); return void_result();
} }
FC_CAPTURE_AND_RETHROW((op)) FC_CAPTURE_AND_RETHROW((op))
@ -142,4 +142,4 @@ namespace graphene
FC_CAPTURE_AND_RETHROW((op)) FC_CAPTURE_AND_RETHROW((op))
} }
} // namespace chain } // namespace chain
} // namespace graphene } // namespace graphene