From a00b6cc8a1e3032db8251ba79e1b0d13045fd3d2 Mon Sep 17 00:00:00 2001 From: Eric Frias Date: Tue, 22 Nov 2016 17:46:24 -0500 Subject: [PATCH 1/2] Disalbe excessive logging, fix a bug that was preventing a game from ending even after all reveal moves moves were made --- libraries/chain/db_maint.cpp | 2 +- libraries/chain/game_object.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libraries/chain/db_maint.cpp b/libraries/chain/db_maint.cpp index 51f7041d..4bbd1b77 100644 --- a/libraries/chain/db_maint.cpp +++ b/libraries/chain/db_maint.cpp @@ -898,7 +898,7 @@ void schedule_pending_dividend_balances(database& db, fc::uint128_t amount_to_credit(delta_balance.value); amount_to_credit *= holder_balance_object.balance.value; amount_to_credit /= total_balance_of_dividend_asset.value; - wdump((delta_balance.value)(holder_balance_object.balance)(total_balance_of_dividend_asset)); + //wdump((delta_balance.value)(holder_balance_object.balance)(total_balance_of_dividend_asset)); share_type shares_to_credit((int64_t)amount_to_credit.to_uint64()); remaining_amount_to_distribute -= shares_to_credit; diff --git a/libraries/chain/game_object.cpp b/libraries/chain/game_object.cpp index 2bbcdd92..d43296ba 100644 --- a/libraries/chain/game_object.cpp +++ b/libraries/chain/game_object.cpp @@ -200,7 +200,7 @@ namespace graphene { namespace chain { const rock_paper_scissors_game_details& game_details = game_obj->game_details.get(); for (unsigned i = 0; i < game_details.commit_moves.size(); ++i) - if (!game_details.reveal_moves[i] && i != this_reveal_index) + if (game_details.commit_moves[i] && !game_details.reveal_moves[i] && i != this_reveal_index) return false; return true; } From 85914fb3b4085d91215bab80075a9e10a36a0730 Mon Sep 17 00:00:00 2001 From: Eric Frias Date: Tue, 22 Nov 2016 18:30:34 -0500 Subject: [PATCH 2/2] Remove code that was resetting the game timer each time a player made a move --- libraries/chain/game_object.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libraries/chain/game_object.cpp b/libraries/chain/game_object.cpp index d43296ba..30a646ad 100644 --- a/libraries/chain/game_object.cpp +++ b/libraries/chain/game_object.cpp @@ -106,7 +106,6 @@ namespace graphene { namespace chain { fc_ilog(fc::logger::get("tournament"), "game ${id} received a commit move, still expecting another commit move", ("id", game.id)); - set_next_timeout(event.db, game); } }; struct expecting_reveal_moves : public msm::front::state<> @@ -131,14 +130,16 @@ namespace graphene { namespace chain { game_object& game = *fsm.game_obj; if (event.move.move.which() == game_specific_moves::tag::value) + { fc_ilog(fc::logger::get("tournament"), "game ${id} received a commit move, now expecting reveal moves", ("id", game.id)); + set_next_timeout(event.db, game); + } else fc_ilog(fc::logger::get("tournament"), "game ${id} received a reveal move, still expecting reveal moves", ("id", game.id)); - set_next_timeout(event.db, game); } };