From a6387733fe2df4335ce4500ccdfa133777440e62 Mon Sep 17 00:00:00 2001 From: Matt Date: Mon, 20 May 2024 15:29:00 -0700 Subject: [PATCH] Simplify vault recovery test --- chia/rpc/wallet_rpc_client.py | 4 ++-- tests/wallet/vault/test_vault_wallet.py | 15 ++------------- 2 files changed, 4 insertions(+), 15 deletions(-) diff --git a/chia/rpc/wallet_rpc_client.py b/chia/rpc/wallet_rpc_client.py index 7540cafbe50d..374fdae85ca4 100644 --- a/chia/rpc/wallet_rpc_client.py +++ b/chia/rpc/wallet_rpc_client.py @@ -116,9 +116,9 @@ async def get_height_info(self) -> uint32: async def push_tx(self, spend_bundle: SpendBundle) -> Dict[str, Any]: return await self.fetch("push_tx", {"spend_bundle": bytes(spend_bundle).hex()}) - async def push_transactions(self, txs: List[TransactionRecord]) -> Dict[str, Any]: + async def push_transactions(self, txs: List[TransactionRecord], sign: bool = False) -> Dict[str, Any]: transactions = [bytes(tx).hex() for tx in txs] - return await self.fetch("push_transactions", {"transactions": transactions}) + return await self.fetch("push_transactions", {"transactions": transactions, "sign": sign}) async def farm_block(self, address: str) -> Dict[str, Any]: return await self.fetch("farm_block", {"address": address}) diff --git a/tests/wallet/vault/test_vault_wallet.py b/tests/wallet/vault/test_vault_wallet.py index 8e53985bc774..c324facfa7dd 100644 --- a/tests/wallet/vault/test_vault_wallet.py +++ b/tests/wallet/vault/test_vault_wallet.py @@ -297,13 +297,7 @@ async def test_vault_recovery( bls_pk=bls_pk, timelock=timelock, ) - assert initiate_tx.spend_bundle is not None - spends = [Spend.from_coin_spend(spend) for spend in initiate_tx.spend_bundle.coin_spends] - signing_info = await wallet_environments.environments[1].rpc_client.gather_signing_info(GatherSigningInfo(spends)) - signing_responses = await funding_wallet.execute_signing_instructions(signing_info.signing_instructions) - signed_response = await funding_wallet.apply_signatures(spends, signing_responses) - - await funding_wallet.wallet_state_manager.submit_transactions([signed_response]) + await wallet_environments.environments[1].rpc_client.push_transactions([initiate_tx], sign=True) vault_coin = wallet.vault_info.coin @@ -331,12 +325,7 @@ async def test_vault_recovery( wallet_environments.full_node.time_per_block = 100 await wallet_environments.full_node.farm_blocks_to_puzzlehash(count=2, guarantee_transaction_blocks=True) - assert finish_tx.spend_bundle is not None - spends = [Spend.from_coin_spend(spend) for spend in finish_tx.spend_bundle.coin_spends] - signing_info = await wallet_environments.environments[1].rpc_client.gather_signing_info(GatherSigningInfo(spends)) - signing_responses = await funding_wallet.execute_signing_instructions(signing_info.signing_instructions) - signed_response = await funding_wallet.apply_signatures(spends, signing_responses) - await funding_wallet.wallet_state_manager.submit_transactions([signed_response]) + await wallet_environments.environments[1].rpc_client.push_transactions([finish_tx]) await wallet_environments.process_pending_states( [