From 4bb93a947e8846181e46d0fd6480ab5dffe28ded Mon Sep 17 00:00:00 2001 From: derekpierre Date: Thu, 29 Feb 2024 15:47:32 -0500 Subject: [PATCH] Make strategies a protected member for safety. --- atxm/machine.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/atxm/machine.py b/atxm/machine.py index 6ef57d4..49a0dc1 100644 --- a/atxm/machine.py +++ b/atxm/machine.py @@ -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 @@ -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: @@ -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")