Skip to content

Commit

Permalink
Update network.py
Browse files Browse the repository at this point in the history
- fixed timestamp logging issue
  • Loading branch information
mikewcasale committed Sep 19, 2022
1 parent 81465d5 commit 32c21f2
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions bancor_research/bancor_simulator/v3/spec/network.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,21 +134,22 @@ def copy_state(self, copy_type: str, state: State = None, timestamp: int = 0):
ts = s.timestamp
else:
ts = timestamp
s.timestamp = timestamp
self._backup_states[f"{copy_type}_{ts}"] = s.copy()
return s

def update_state(self, state: State):
def update_state(self, state: State, timestamp: int = 0):
"""
Updates the global state at the end of each action.
"""
self.global_state = self.copy_state("end", state)
self.global_state = self.copy_state("end", state, timestamp)

def next_transaction(self, state: State):
def next_transaction(self, state: State, timestamp: int = 0):
"""
Increments a new id and state for each action
"""
if self.log_state:
self.update_state(state)
self.update_state(state, timestamp)
self.transaction_id += 1

def get_state(
Expand Down

0 comments on commit 32c21f2

Please sign in to comment.