Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Port test_trades.py to WalletTestFramework #18590

Merged
merged 10 commits into from
Sep 20, 2024
13 changes: 10 additions & 3 deletions chia/_tests/environments/wallet.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,9 @@ class WalletTestFramework:
environments: List[WalletEnvironment]
tx_config: TXConfig = DEFAULT_TX_CONFIG

async def process_pending_states(self, state_transitions: List[WalletStateTransition]) -> None:
async def process_pending_states(
self, state_transitions: List[WalletStateTransition], invalid_transactions: List[bytes32] = []
) -> None:
"""
This is the main entry point for processing state in wallet tests. It does the following things:

Expand Down Expand Up @@ -302,7 +304,11 @@ async def process_pending_states(self, state_transitions: List[WalletStateTransi
for i, env in enumerate(self.environments):
await self.full_node.wait_for_wallet_synced(wallet_node=env.node, timeout=20)
try:
pending_txs.append(await env.wait_for_transactions_to_settle(self.full_node))
pending_txs.append(
await env.wait_for_transactions_to_settle(
self.full_node, _exclude_from_mempool_check=invalid_transactions
)
)
except TimeoutError: # pragma: no cover
raise TimeoutError(f"All TXs for env-{i} were not found in mempool or marked as in mempool")
for i, (env, transition) in enumerate(zip(self.environments, state_transitions)):
Expand All @@ -328,7 +334,8 @@ async def process_pending_states(self, state_transitions: List[WalletStateTransi
)
try:
await env.wait_for_transactions_to_settle(
self.full_node, _exclude_from_mempool_check=[tx.name for tx in local_pending_txs]
self.full_node,
_exclude_from_mempool_check=invalid_transactions + [tx.name for tx in local_pending_txs],
)
except TimeoutError: # pragma: no cover
raise TimeoutError(f"All TXs for env-{i} were not found in mempool or marked as in mempool")
Expand Down
Loading
Loading