From e44ed0cfe5df825f2fe264b68be382b559ebb609 Mon Sep 17 00:00:00 2001 From: Milos Milosevic Date: Fri, 10 Feb 2023 14:50:23 +0000 Subject: [PATCH] #421 fix double in consensus of nft_lottery_token_purchase --- .../chain/include/graphene/chain/protocol/nft_lottery.hpp | 4 ++-- libraries/chain/nft_lottery_evaluator.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/libraries/chain/include/graphene/chain/protocol/nft_lottery.hpp b/libraries/chain/include/graphene/chain/protocol/nft_lottery.hpp index 0c8ea855..00ea31b0 100644 --- a/libraries/chain/include/graphene/chain/protocol/nft_lottery.hpp +++ b/libraries/chain/include/graphene/chain/protocol/nft_lottery.hpp @@ -18,7 +18,7 @@ namespace graphene // Buyer purchasing lottery tickets account_id_type buyer; // count of tickets to buy - uint64_t tickets_to_buy; + share_type tickets_to_buy; // amount that can spent 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_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_end_operation, (fee)(lottery_id)(extensions)) \ No newline at end of file +FC_REFLECT(graphene::chain::nft_lottery_end_operation, (fee)(lottery_id)(extensions)) diff --git a/libraries/chain/nft_lottery_evaluator.cpp b/libraries/chain/nft_lottery_evaluator.cpp index 794616cf..2d9fe7f0 100644 --- a/libraries/chain/nft_lottery_evaluator.cpp +++ b/libraries/chain/nft_lottery_evaluator.cpp @@ -30,7 +30,7 @@ namespace graphene auto lottery_options = lottery_md_obj.lottery_data->lottery_options; 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(); } FC_CAPTURE_AND_RETHROW((op)) @@ -142,4 +142,4 @@ namespace graphene FC_CAPTURE_AND_RETHROW((op)) } } // namespace chain -} // namespace graphene \ No newline at end of file +} // namespace graphene