Merge commit '96199c008c5a1d5c6386f8ab81bc82b8435bef3c' into checkpoint/long_lived_atari_from_main_96199c008c5a1d5c6386f8ab81bc82b8435bef3c

This commit is contained in:
Amine Khaldi 2022-08-03 11:15:34 +01:00
commit 3bd94ce213
No known key found for this signature in database
GPG Key ID: B1C074FFC904E2D9

View File

@ -66,10 +66,9 @@ class TemporaryPoolPlot:
async def __aenter__(self): async def __aenter__(self):
self._tmpdir = tempfile.TemporaryDirectory() self._tmpdir = tempfile.TemporaryDirectory()
dirname = self._tmpdir.__enter__() tmp_path: Path = Path(self._tmpdir.name)
tmp_path: Path = Path(dirname)
self.bt.add_plot_directory(tmp_path) self.bt.add_plot_directory(tmp_path)
plot_id: bytes32 = await self.bt.new_plot(self.p2_singleton_puzzle_hash, Path(dirname), tmp_dir=tmp_path) plot_id: bytes32 = await self.bt.new_plot(self.p2_singleton_puzzle_hash, tmp_path, tmp_dir=tmp_path)
assert plot_id is not None assert plot_id is not None
await self.bt.refresh_plots() await self.bt.refresh_plots()
self.plot_id = plot_id self.plot_id = plot_id
@ -77,7 +76,7 @@ class TemporaryPoolPlot:
async def __aexit__(self, exc_type, exc_value, exc_traceback): async def __aexit__(self, exc_type, exc_value, exc_traceback):
await self.bt.delete_plot(self.plot_id) await self.bt.delete_plot(self.plot_id)
self._tmpdir.__exit__(None, None, None) self._tmpdir.cleanup()
async def wallet_is_synced(wallet_node: WalletNode, full_node_api) -> bool: async def wallet_is_synced(wallet_node: WalletNode, full_node_api) -> bool:
@ -125,9 +124,10 @@ async def one_wallet_node_and_rpc(bt, self_hostname) -> AsyncGenerator[Tuple[Wal
@pytest_asyncio.fixture(scope="function") @pytest_asyncio.fixture(scope="function")
async def setup(two_wallet_nodes, bt, self_hostname): async def setup(two_wallet_nodes, self_hostname):
rmtree(get_pool_plot_dir(), ignore_errors=True) rmtree(get_pool_plot_dir(), ignore_errors=True)
full_nodes, wallets = two_wallet_nodes full_nodes, wallets = two_wallet_nodes
bt = full_nodes[0].bt
wallet_node_0, wallet_server_0 = wallets[0] wallet_node_0, wallet_server_0 = wallets[0]
wallet_node_1, wallet_server_1 = wallets[1] wallet_node_1, wallet_server_1 = wallets[1]
our_ph_record = await wallet_node_0.wallet_state_manager.get_unused_derivation_record(1, False, True) our_ph_record = await wallet_node_0.wallet_state_manager.get_unused_derivation_record(1, False, True)
@ -432,9 +432,10 @@ class TestPoolWalletRpc:
@pytest.mark.asyncio @pytest.mark.asyncio
@pytest.mark.parametrize("trusted_and_fee", [(True, FEE_AMOUNT), (False, 0)]) @pytest.mark.parametrize("trusted_and_fee", [(True, FEE_AMOUNT), (False, 0)])
async def test_absorb_self(self, one_wallet_node_and_rpc, trusted_and_fee, bt, self_hostname): async def test_absorb_self(self, one_wallet_node_and_rpc, trusted_and_fee, self_hostname):
trusted, fee = trusted_and_fee trusted, fee = trusted_and_fee
client, wallet_node_0, full_node_api = one_wallet_node_and_rpc client, wallet_node_0, full_node_api = one_wallet_node_and_rpc
bt = full_node_api.bt
if trusted: if trusted:
wallet_node_0.config["trusted_peers"] = { wallet_node_0.config["trusted_peers"] = {
full_node_api.full_node.server.node_id.hex(): full_node_api.full_node.server.node_id.hex() full_node_api.full_node.server.node_id.hex(): full_node_api.full_node.server.node_id.hex()
@ -545,9 +546,10 @@ class TestPoolWalletRpc:
@pytest.mark.asyncio @pytest.mark.asyncio
@pytest.mark.parametrize("trusted_and_fee", [(True, FEE_AMOUNT * 2)]) @pytest.mark.parametrize("trusted_and_fee", [(True, FEE_AMOUNT * 2)])
async def test_absorb_self_multiple_coins(self, one_wallet_node_and_rpc, trusted_and_fee, bt, self_hostname): async def test_absorb_self_multiple_coins(self, one_wallet_node_and_rpc, trusted_and_fee, self_hostname):
trusted, fee = trusted_and_fee trusted, fee = trusted_and_fee
client, wallet_node_0, full_node_api = one_wallet_node_and_rpc client, wallet_node_0, full_node_api = one_wallet_node_and_rpc
bt = full_node_api.bt
if trusted: if trusted:
wallet_node_0.config["trusted_peers"] = { wallet_node_0.config["trusted_peers"] = {
full_node_api.full_node.server.node_id.hex(): full_node_api.full_node.server.node_id.hex() full_node_api.full_node.server.node_id.hex(): full_node_api.full_node.server.node_id.hex()
@ -634,9 +636,10 @@ class TestPoolWalletRpc:
@pytest.mark.asyncio @pytest.mark.asyncio
@pytest.mark.parametrize("trusted_and_fee", [(True, FEE_AMOUNT), (False, 0)]) @pytest.mark.parametrize("trusted_and_fee", [(True, FEE_AMOUNT), (False, 0)])
async def test_absorb_pooling(self, one_wallet_node_and_rpc, trusted_and_fee, bt, self_hostname): async def test_absorb_pooling(self, one_wallet_node_and_rpc, trusted_and_fee, self_hostname):
trusted, fee = trusted_and_fee trusted, fee = trusted_and_fee
client, wallet_node_0, full_node_api = one_wallet_node_and_rpc client, wallet_node_0, full_node_api = one_wallet_node_and_rpc
bt = full_node_api.bt
if trusted: if trusted:
wallet_node_0.config["trusted_peers"] = { wallet_node_0.config["trusted_peers"] = {
full_node_api.full_node.server.node_id.hex(): full_node_api.full_node.server.node_id.hex() full_node_api.full_node.server.node_id.hex(): full_node_api.full_node.server.node_id.hex()
@ -1127,7 +1130,7 @@ class TestPoolWalletRpc:
@pytest.mark.asyncio @pytest.mark.asyncio
@pytest.mark.parametrize("trusted_and_fee", [(True, FEE_AMOUNT), (False, 0)]) @pytest.mark.parametrize("trusted_and_fee", [(True, FEE_AMOUNT), (False, 0)])
async def test_change_pools_reorg(self, setup, trusted_and_fee, bt, self_hostname): async def test_change_pools_reorg(self, setup, trusted_and_fee, self_hostname):
"""This tests Pool A -> escaping -> reorg -> escaping -> Pool B""" """This tests Pool A -> escaping -> reorg -> escaping -> Pool B"""
trusted, fee = trusted_and_fee trusted, fee = trusted_and_fee
full_nodes, wallet_nodes, receive_address, client, rpc_cleanup = setup full_nodes, wallet_nodes, receive_address, client, rpc_cleanup = setup