Distinguish round-closing sub-phases and anchor cooldown to payout confirmation
Flip status to "closing" the instant the round timer expires, rather than leaving it "open" (invisible) while in-flight bets confirm — /rounds/current now surfaces this wait as its own phase instead of collapsing it into "drawing". _tick() is updated to keep re-checking pending bets while status is "closing" instead of short-circuiting on the old "status != open" guard. Also re-stamp closed_at at actual payout confirmation time (not at the earlier "closing" transition), since round_cooldown_seconds counts from closed_at — with a short cooldown (e.g. 20s) and ~2 block-time draw+payout wait, the old anchor meant the cooldown had already elapsed by the time the round actually closed, making it a no-op. Expose draw_block_height/draw_block_hash on GET /rounds/current so clients can show which block the winner was drawn from.
This commit is contained in:
@@ -25,6 +25,8 @@ class CurrentRoundResponse(BaseModel):
|
||||
draw_animation_seconds: int
|
||||
winner_user_id: int | None = None
|
||||
winner_amount_sats: int | None = None
|
||||
draw_block_height: int | None = None
|
||||
draw_block_hash: str | None = None
|
||||
chain_tip_height: int | None = None
|
||||
lottery_paused: bool = False
|
||||
|
||||
@@ -70,6 +72,8 @@ async def current_round(request: Request, session: AsyncSession = Depends(get_se
|
||||
draw_animation_seconds=config.draw_animation_seconds,
|
||||
winner_user_id=round_.winner_user_id,
|
||||
winner_amount_sats=round_.winner_amount_sats,
|
||||
draw_block_height=round_.draw_block_height,
|
||||
draw_block_hash=round_.draw_block_hash,
|
||||
chain_tip_height=chain_tip_height,
|
||||
lottery_paused=config.paused,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user