Skip to content

Commit

Permalink
Make strategies a protected member for safety.
Browse files Browse the repository at this point in the history
  • Loading branch information
derekpierre committed Feb 29, 2024
1 parent 65c2148 commit 4bb93a9
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions atxm/machine.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,9 @@ def __init__(
self.w3 = w3
self.signers = {}
self.log = log
self.strategies = [s(w3) for s in self.STRATEGIES]
self._strategies = [s(w3) for s in self.STRATEGIES]
if strategies:
self.strategies.extend(list(strategies))
self._strategies.extend(list(strategies))

# state
self._pause = False
Expand Down Expand Up @@ -323,7 +323,7 @@ def __strategize(self) -> Optional[PendingTx]:
raise RuntimeError("No active transaction to strategize")

_active_copy = deepcopy(self._tx_tracker.pending)
for strategy in self.strategies:
for strategy in self._strategies:
try:
params = strategy.execute(pending=_active_copy)
except Wait as e:
Expand All @@ -339,7 +339,7 @@ def __strategize(self) -> Optional[PendingTx]:

# (!) retry the transaction with the new parameters
retry_params = TxParams(_active_copy.params)
_names = " -> ".join(s.name for s in self.strategies)
_names = " -> ".join(s.name for s in self._strategies)
pending_tx = self.__fire(tx=retry_params, msg=_names)
self.log.info(f"[retry] transaction #{pending_tx.id} has been re-broadcasted")

Expand Down

0 comments on commit 4bb93a9

Please sign in to comment.