With the current implementation, the NextMove player could simply decide not to make any more moves.
The match will not progress, and the funds will be locked forever (potentially against the oppponent's will).
The ideal solution is to implement a Match Timer.
An enum called MatchStyle provides different options of time-to-move. E.g:
A on_initialize hook continuously checks the last_move of every ongoing Match on storage, and compares it to the BlockNumber of the current block. If the delta is bigger than the threshold established by MatchStyle, that means the player defined by NextMove ran out of time for their move, and they must lose the match.
With the current implementation, the
NextMove
player could simply decide not to make any more moves. The match will not progress, and the funds will be locked forever (potentially against the oppponent's will).The ideal solution is to implement a Match Timer.
An
enum
calledMatchStyle
provides different options of time-to-move. E.g:This
enum
is added toMatch
, along with alast_move: T::BlockNumber
parameter:A
on_initialize
hook continuously checks thelast_move
of every ongoingMatch
on storage, and compares it to theBlockNumber
of the current block. If the delta is bigger than the threshold established byMatchStyle
, that means the player defined byNextMove
ran out of time for their move, and they must lose the match.