Skip to content

Commit

Permalink
forgot to uncomment pytimeparse
Browse files Browse the repository at this point in the history
  • Loading branch information
geoffwalmsley committed Oct 18, 2023
1 parent 665eceb commit 53d5e3a
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions cdv/test/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import struct
from typing import Dict, List, Optional, Tuple, Union

# import pytimeparse
import pytimeparse
from blspy import AugSchemeMPL, G1Element, G2Element, PrivateKey
from chia.clvm.spend_sim import SimClient, SpendSim
from chia.consensus.default_constants import DEFAULT_CONSTANTS
Expand Down Expand Up @@ -628,16 +628,16 @@ def make_wallet(self, name: str) -> Wallet:
return w

# # Skip real time by farming blocks until the target duration is achieved.
# async def skip_time(self, target_duration: str, **kwargs):
# """Skip a duration of simulated time, causing blocks to be farmed. If a farmer
# is specified, they win each block"""
# target_time = self.time + datetime.timedelta(pytimeparse.parse(target_duration) / duration_div)
# while target_time > self.get_timestamp():
# await self.farm_block(**kwargs)
# self.sim.pass_time(uint64(20))

# # Or possibly aggregate farm_block results.
# return None
async def skip_time(self, target_duration: str, **kwargs):
"""Skip a duration of simulated time, causing blocks to be farmed. If a farmer
is specified, they win each block"""
target_time = self.time + datetime.timedelta(pytimeparse.parse(target_duration) / duration_div)
while target_time > self.get_timestamp():
await self.farm_block(**kwargs)
self.sim.pass_time(uint64(20))

# Or possibly aggregate farm_block results.
return None

def get_timestamp(self) -> datetime.timedelta:
"""Return the current simualtion time in seconds."""
Expand Down

0 comments on commit 53d5e3a

Please sign in to comment.