mirror of
https://github.com/Chia-Network/chia-blockchain.git
synced 2024-09-11 18:58:59 +03:00
parent
3e6e08732f
commit
1557dcfe60
@ -10,6 +10,7 @@ from chia.types.blockchain_format.coin import Coin
|
||||
from chia.types.blockchain_format.program import Program
|
||||
from chia.types.blockchain_format.sized_bytes import bytes32
|
||||
from chia.types.coin_record import CoinRecord
|
||||
from chia.types.spend_bundle import SpendBundle
|
||||
from chia.util.bech32m import encode_puzzle_hash
|
||||
from chia.util.ints import uint16, uint32, uint64
|
||||
from chia.wallet.conditions import Condition, ConditionValidTimes, conditions_to_json_dicts
|
||||
@ -92,7 +93,7 @@ class WalletRpcClient(RpcClient):
|
||||
async def get_height_info(self) -> uint32:
|
||||
return (await self.fetch("get_height_info", {}))["height"]
|
||||
|
||||
async def push_tx(self, spend_bundle):
|
||||
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]):
|
||||
|
@ -104,7 +104,6 @@ tests.util.test_full_block_utils
|
||||
tests.util.test_misc
|
||||
tests.util.test_network
|
||||
tests.util.time_out_assert
|
||||
tests.wallet.cat_wallet.test_cat_wallet
|
||||
tests.wallet.cat_wallet.test_trades
|
||||
tests.wallet.did_wallet.test_did
|
||||
tests.wallet.rpc.test_wallet_rpc
|
||||
|
@ -3,7 +3,6 @@ from __future__ import annotations
|
||||
import asyncio
|
||||
import tempfile
|
||||
from pathlib import Path
|
||||
from typing import List
|
||||
|
||||
import pytest
|
||||
|
||||
@ -11,7 +10,6 @@ from chia.consensus.block_rewards import calculate_base_farmer_reward, calculate
|
||||
from chia.protocols.wallet_protocol import CoinState
|
||||
from chia.rpc.wallet_rpc_api import WalletRpcApi
|
||||
from chia.rpc.wallet_rpc_client import WalletRpcClient
|
||||
from chia.simulator.full_node_simulator import FullNodeSimulator
|
||||
from chia.simulator.simulator_protocol import FarmNewBlockProtocol, ReorgProtocol
|
||||
from chia.types.blockchain_format.coin import Coin, coin_as_list
|
||||
from chia.types.blockchain_format.program import Program
|
||||
@ -29,14 +27,14 @@ from chia.wallet.derivation_record import DerivationRecord
|
||||
from chia.wallet.derive_keys import _derive_path_unhardened, master_sk_to_wallet_sk_unhardened_intermediate
|
||||
from chia.wallet.lineage_proof import LineageProof
|
||||
from chia.wallet.puzzles.p2_delegated_puzzle_or_hidden_puzzle import puzzle_hash_for_pk
|
||||
from chia.wallet.transaction_record import TransactionRecord
|
||||
from chia.wallet.util.tx_config import DEFAULT_COIN_SELECTION_CONFIG, DEFAULT_TX_CONFIG
|
||||
from chia.wallet.util.wallet_types import WalletType
|
||||
from chia.wallet.wallet_info import WalletInfo
|
||||
from chia.wallet.wallet_interested_store import WalletInterestedStore
|
||||
from chia.wallet.wallet_node import WalletNode
|
||||
from chia.wallet.wallet_state_manager import WalletStateManager
|
||||
from tests.conftest import ConsensusMode
|
||||
from tests.util.setup_nodes import SimulatorsAndWalletsServices
|
||||
from tests.util.setup_nodes import OldSimulatorsAndWallets, SimulatorsAndWalletsServices
|
||||
from tests.util.time_out_assert import time_out_assert, time_out_assert_not_none
|
||||
|
||||
|
||||
@ -44,12 +42,9 @@ def check_wallets(node: WalletNode) -> int:
|
||||
return len(node.wallet_state_manager.wallets.keys())
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"trusted",
|
||||
[True, False],
|
||||
)
|
||||
@pytest.mark.parametrize("trusted", [True, False])
|
||||
@pytest.mark.anyio
|
||||
async def test_cat_creation(self_hostname, two_wallet_nodes, trusted):
|
||||
async def test_cat_creation(self_hostname: str, two_wallet_nodes: OldSimulatorsAndWallets, trusted: bool) -> None:
|
||||
num_blocks = 3
|
||||
full_nodes, wallets, _ = two_wallet_nodes
|
||||
full_node_api = full_nodes[0]
|
||||
@ -64,9 +59,9 @@ async def test_cat_creation(self_hostname, two_wallet_nodes, trusted):
|
||||
wallet_node.config["trusted_peers"] = {}
|
||||
|
||||
await server_2.start_client(PeerInfo(self_hostname, full_node_server.get_port()), None)
|
||||
for i in range(0, num_blocks):
|
||||
for _ in range(num_blocks):
|
||||
await full_node_api.farm_new_transaction_block(FarmNewBlockProtocol(ph))
|
||||
await full_node_api.farm_new_transaction_block(FarmNewBlockProtocol(32 * b"0"))
|
||||
await full_node_api.farm_new_transaction_block(FarmNewBlockProtocol(bytes32(32 * b"0")))
|
||||
|
||||
funds = sum(
|
||||
[calculate_pool_reward(uint32(i)) + calculate_base_farmer_reward(uint32(i)) for i in range(1, num_blocks + 1)]
|
||||
@ -76,7 +71,7 @@ async def test_cat_creation(self_hostname, two_wallet_nodes, trusted):
|
||||
await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node, timeout=20)
|
||||
|
||||
async with wallet_node.wallet_state_manager.lock:
|
||||
cat_wallet: CATWallet = await CATWallet.create_new_cat_wallet(
|
||||
cat_wallet = await CATWallet.create_new_cat_wallet(
|
||||
wallet_node.wallet_state_manager,
|
||||
wallet,
|
||||
{"identifier": "genesis_by_id"},
|
||||
@ -88,7 +83,7 @@ async def test_cat_creation(self_hostname, two_wallet_nodes, trusted):
|
||||
cat_wallet = await CATWallet.create(wallet_node.wallet_state_manager, wallet, cat_wallet.wallet_info)
|
||||
await wallet_node.wallet_state_manager.add_new_wallet(cat_wallet)
|
||||
|
||||
tx_queue: List[TransactionRecord] = await wallet_node.wallet_state_manager.tx_store.get_not_sent()
|
||||
tx_queue = await wallet_node.wallet_state_manager.tx_store.get_not_sent()
|
||||
tx_record = tx_queue[0]
|
||||
await full_node_api.process_transaction_records(records=[tx_record])
|
||||
|
||||
@ -114,14 +109,15 @@ async def test_cat_creation(self_hostname, two_wallet_nodes, trusted):
|
||||
assert await cat_wallet.lineage_store.get_all_lineage_proofs() == all_lineage
|
||||
|
||||
height = full_node_api.full_node.blockchain.get_peak_height()
|
||||
assert height is not None
|
||||
await full_node_api.reorg_from_index_to_new_index(
|
||||
ReorgProtocol(height - num_blocks - 1, height + 1, 32 * b"1", None)
|
||||
ReorgProtocol(uint32(height - num_blocks - 1), uint32(height + 1), bytes32(32 * b"1"), None)
|
||||
)
|
||||
await time_out_assert(20, cat_wallet.get_confirmed_balance, 0)
|
||||
|
||||
|
||||
@pytest.mark.anyio
|
||||
async def test_cat_creation_unique_lineage_store(self_hostname, two_wallet_nodes):
|
||||
async def test_cat_creation_unique_lineage_store(self_hostname: str, two_wallet_nodes: OldSimulatorsAndWallets) -> None:
|
||||
num_blocks = 3
|
||||
full_nodes, wallets, _ = two_wallet_nodes
|
||||
full_node_api = full_nodes[0]
|
||||
@ -132,9 +128,9 @@ async def test_cat_creation_unique_lineage_store(self_hostname, two_wallet_nodes
|
||||
wallet_node.config["trusted_peers"] = {full_node_server.node_id.hex(): full_node_server.node_id.hex()}
|
||||
|
||||
await wallet_server.start_client(PeerInfo(self_hostname, full_node_server.get_port()), None)
|
||||
for i in range(0, num_blocks):
|
||||
for _ in range(num_blocks):
|
||||
await full_node_api.farm_new_transaction_block(FarmNewBlockProtocol(ph))
|
||||
await full_node_api.farm_new_transaction_block(FarmNewBlockProtocol(32 * b"0"))
|
||||
await full_node_api.farm_new_transaction_block(FarmNewBlockProtocol(bytes32(32 * b"0")))
|
||||
|
||||
funds = sum(
|
||||
[calculate_pool_reward(uint32(i)) + calculate_base_farmer_reward(uint32(i)) for i in range(1, num_blocks + 1)]
|
||||
@ -144,19 +140,11 @@ async def test_cat_creation_unique_lineage_store(self_hostname, two_wallet_nodes
|
||||
await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node, timeout=20)
|
||||
|
||||
async with wallet_node.wallet_state_manager.lock:
|
||||
cat_wallet_1: CATWallet = await CATWallet.create_new_cat_wallet(
|
||||
wallet_node.wallet_state_manager,
|
||||
wallet,
|
||||
{"identifier": "genesis_by_id"},
|
||||
uint64(100),
|
||||
DEFAULT_TX_CONFIG,
|
||||
cat_wallet_1 = await CATWallet.create_new_cat_wallet(
|
||||
wallet_node.wallet_state_manager, wallet, {"identifier": "genesis_by_id"}, uint64(100), DEFAULT_TX_CONFIG
|
||||
)
|
||||
cat_wallet_2: CATWallet = await CATWallet.create_new_cat_wallet(
|
||||
wallet_node.wallet_state_manager,
|
||||
wallet,
|
||||
{"identifier": "genesis_by_id"},
|
||||
uint64(200),
|
||||
DEFAULT_TX_CONFIG,
|
||||
cat_wallet_2 = await CATWallet.create_new_cat_wallet(
|
||||
wallet_node.wallet_state_manager, wallet, {"identifier": "genesis_by_id"}, uint64(200), DEFAULT_TX_CONFIG
|
||||
)
|
||||
|
||||
proofs_1 = await cat_wallet_1.lineage_store.get_all_lineage_proofs()
|
||||
@ -166,12 +154,9 @@ async def test_cat_creation_unique_lineage_store(self_hostname, two_wallet_nodes
|
||||
assert cat_wallet_1.lineage_store.table_name != cat_wallet_2.lineage_store.table_name
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"trusted",
|
||||
[True, False],
|
||||
)
|
||||
@pytest.mark.parametrize("trusted", [True, False])
|
||||
@pytest.mark.anyio
|
||||
async def test_cat_spend(self_hostname, two_wallet_nodes, trusted):
|
||||
async def test_cat_spend(self_hostname: str, two_wallet_nodes: OldSimulatorsAndWallets, trusted: bool) -> None:
|
||||
num_blocks = 3
|
||||
full_nodes, wallets, _ = two_wallet_nodes
|
||||
full_node_api = full_nodes[0]
|
||||
@ -192,9 +177,9 @@ async def test_cat_spend(self_hostname, two_wallet_nodes, trusted):
|
||||
await server_2.start_client(PeerInfo(self_hostname, full_node_server.get_port()), None)
|
||||
await server_3.start_client(PeerInfo(self_hostname, full_node_server.get_port()), None)
|
||||
|
||||
for i in range(0, num_blocks):
|
||||
for _ in range(num_blocks):
|
||||
await full_node_api.farm_new_transaction_block(FarmNewBlockProtocol(ph))
|
||||
await full_node_api.farm_new_transaction_block(FarmNewBlockProtocol(32 * b"0"))
|
||||
await full_node_api.farm_new_transaction_block(FarmNewBlockProtocol(bytes32(32 * b"0")))
|
||||
|
||||
funds = sum(
|
||||
[calculate_pool_reward(uint32(i)) + calculate_base_farmer_reward(uint32(i)) for i in range(1, num_blocks + 1)]
|
||||
@ -203,14 +188,10 @@ async def test_cat_spend(self_hostname, two_wallet_nodes, trusted):
|
||||
await time_out_assert(20, wallet.get_confirmed_balance, funds)
|
||||
|
||||
async with wallet_node.wallet_state_manager.lock:
|
||||
cat_wallet: CATWallet = await CATWallet.create_new_cat_wallet(
|
||||
wallet_node.wallet_state_manager,
|
||||
wallet,
|
||||
{"identifier": "genesis_by_id"},
|
||||
uint64(100),
|
||||
DEFAULT_TX_CONFIG,
|
||||
cat_wallet = await CATWallet.create_new_cat_wallet(
|
||||
wallet_node.wallet_state_manager, wallet, {"identifier": "genesis_by_id"}, uint64(100), DEFAULT_TX_CONFIG
|
||||
)
|
||||
tx_queue: List[TransactionRecord] = await wallet_node.wallet_state_manager.tx_store.get_not_sent()
|
||||
tx_queue = await wallet_node.wallet_state_manager.tx_store.get_not_sent()
|
||||
tx_record = tx_queue[0]
|
||||
await full_node_api.process_transaction_records(records=[tx_record])
|
||||
|
||||
@ -220,9 +201,7 @@ async def test_cat_spend(self_hostname, two_wallet_nodes, trusted):
|
||||
assert cat_wallet.cat_info.limitations_program_hash is not None
|
||||
asset_id = cat_wallet.get_asset_id()
|
||||
|
||||
cat_wallet_2: CATWallet = await CATWallet.get_or_create_wallet_for_cat(
|
||||
wallet_node_2.wallet_state_manager, wallet2, asset_id
|
||||
)
|
||||
cat_wallet_2 = await CATWallet.get_or_create_wallet_for_cat(wallet_node_2.wallet_state_manager, wallet2, asset_id)
|
||||
|
||||
assert cat_wallet.cat_info.limitations_program_hash == cat_wallet_2.cat_info.limitations_program_hash
|
||||
|
||||
@ -240,12 +219,13 @@ async def test_cat_spend(self_hostname, two_wallet_nodes, trusted):
|
||||
await time_out_assert(15, full_node_api.txs_in_mempool, True, tx_records)
|
||||
|
||||
await time_out_assert(20, cat_wallet.get_pending_change_balance, 40)
|
||||
memos = await api_0.get_transaction_memo(dict(transaction_id=tx_id))
|
||||
assert tx_id is not None
|
||||
memos = await api_0.get_transaction_memo({"transaction_id": tx_id})
|
||||
assert len(memos[tx_id]) == 2 # One for tx, one for change
|
||||
assert list(memos[tx_id].values())[0][0] == cat_2_hash.hex()
|
||||
|
||||
for i in range(1, num_blocks):
|
||||
await full_node_api.farm_new_transaction_block(FarmNewBlockProtocol(32 * b"\0"))
|
||||
for _ in range(1, num_blocks):
|
||||
await full_node_api.farm_new_transaction_block(FarmNewBlockProtocol(bytes32(32 * b"\0")))
|
||||
|
||||
await time_out_assert(30, wallet.get_confirmed_balance, funds - 101)
|
||||
|
||||
@ -274,16 +254,16 @@ async def test_cat_spend(self_hostname, two_wallet_nodes, trusted):
|
||||
await time_out_assert(20, cat_wallet.get_unconfirmed_balance, 55)
|
||||
|
||||
height = full_node_api.full_node.blockchain.get_peak_height()
|
||||
await full_node_api.reorg_from_index_to_new_index(ReorgProtocol(height - 1, height + 1, 32 * b"1", None))
|
||||
assert height is not None
|
||||
await full_node_api.reorg_from_index_to_new_index(
|
||||
ReorgProtocol(uint32(height - 1), uint32(height + 1), bytes32(32 * b"1"), None)
|
||||
)
|
||||
await time_out_assert(20, cat_wallet.get_confirmed_balance, 40)
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"trusted",
|
||||
[True, False],
|
||||
)
|
||||
@pytest.mark.parametrize("trusted", [True, False])
|
||||
@pytest.mark.anyio
|
||||
async def test_cat_reuse_address(self_hostname, two_wallet_nodes, trusted):
|
||||
async def test_cat_reuse_address(self_hostname: str, two_wallet_nodes: OldSimulatorsAndWallets, trusted: bool) -> None:
|
||||
num_blocks = 3
|
||||
full_nodes, wallets, _ = two_wallet_nodes
|
||||
full_node_api = full_nodes[0]
|
||||
@ -303,9 +283,9 @@ async def test_cat_reuse_address(self_hostname, two_wallet_nodes, trusted):
|
||||
await server_2.start_client(PeerInfo(self_hostname, full_node_server.get_port()), None)
|
||||
await server_3.start_client(PeerInfo(self_hostname, full_node_server.get_port()), None)
|
||||
|
||||
for i in range(0, num_blocks):
|
||||
for _ in range(num_blocks):
|
||||
await full_node_api.farm_new_transaction_block(FarmNewBlockProtocol(ph))
|
||||
await full_node_api.farm_new_transaction_block(FarmNewBlockProtocol(32 * b"0"))
|
||||
await full_node_api.farm_new_transaction_block(FarmNewBlockProtocol(bytes32(32 * b"0")))
|
||||
|
||||
funds = sum(
|
||||
[calculate_pool_reward(uint32(i)) + calculate_base_farmer_reward(uint32(i)) for i in range(1, num_blocks + 1)]
|
||||
@ -314,14 +294,10 @@ async def test_cat_reuse_address(self_hostname, two_wallet_nodes, trusted):
|
||||
await time_out_assert(20, wallet.get_confirmed_balance, funds)
|
||||
|
||||
async with wallet_node.wallet_state_manager.lock:
|
||||
cat_wallet: CATWallet = await CATWallet.create_new_cat_wallet(
|
||||
wallet_node.wallet_state_manager,
|
||||
wallet,
|
||||
{"identifier": "genesis_by_id"},
|
||||
uint64(100),
|
||||
DEFAULT_TX_CONFIG,
|
||||
cat_wallet = await CATWallet.create_new_cat_wallet(
|
||||
wallet_node.wallet_state_manager, wallet, {"identifier": "genesis_by_id"}, uint64(100), DEFAULT_TX_CONFIG
|
||||
)
|
||||
tx_queue: List[TransactionRecord] = await wallet_node.wallet_state_manager.tx_store.get_not_sent()
|
||||
tx_queue = await wallet_node.wallet_state_manager.tx_store.get_not_sent()
|
||||
tx_record = tx_queue[0]
|
||||
await full_node_api.process_transaction_records(records=[tx_record])
|
||||
|
||||
@ -331,9 +307,7 @@ async def test_cat_reuse_address(self_hostname, two_wallet_nodes, trusted):
|
||||
assert cat_wallet.cat_info.limitations_program_hash is not None
|
||||
asset_id = cat_wallet.get_asset_id()
|
||||
|
||||
cat_wallet_2: CATWallet = await CATWallet.get_or_create_wallet_for_cat(
|
||||
wallet_node_2.wallet_state_manager, wallet2, asset_id
|
||||
)
|
||||
cat_wallet_2 = await CATWallet.get_or_create_wallet_for_cat(wallet_node_2.wallet_state_manager, wallet2, asset_id)
|
||||
|
||||
assert cat_wallet.cat_info.limitations_program_hash == cat_wallet_2.cat_info.limitations_program_hash
|
||||
|
||||
@ -345,6 +319,7 @@ async def test_cat_reuse_address(self_hostname, two_wallet_nodes, trusted):
|
||||
await wallet.wallet_state_manager.add_pending_transaction(tx_record)
|
||||
if tx_record.wallet_id is cat_wallet.id():
|
||||
assert tx_record.to_puzzle_hash == cat_2_hash
|
||||
assert tx_record.spend_bundle is not None
|
||||
assert len(tx_record.spend_bundle.coin_spends) == 2
|
||||
for cs in tx_record.spend_bundle.coin_spends:
|
||||
if cs.coin.amount == 100:
|
||||
@ -356,8 +331,8 @@ async def test_cat_reuse_address(self_hostname, two_wallet_nodes, trusted):
|
||||
|
||||
await time_out_assert(20, cat_wallet.get_pending_change_balance, 40)
|
||||
|
||||
for i in range(1, num_blocks):
|
||||
await full_node_api.farm_new_transaction_block(FarmNewBlockProtocol(32 * b"\0"))
|
||||
for _ in range(1, num_blocks):
|
||||
await full_node_api.farm_new_transaction_block(FarmNewBlockProtocol(bytes32(32 * b"\0")))
|
||||
|
||||
await time_out_assert(30, wallet.get_confirmed_balance, funds - 101)
|
||||
|
||||
@ -380,16 +355,18 @@ async def test_cat_reuse_address(self_hostname, two_wallet_nodes, trusted):
|
||||
await time_out_assert(20, cat_wallet.get_unconfirmed_balance, 55)
|
||||
|
||||
height = full_node_api.full_node.blockchain.get_peak_height()
|
||||
await full_node_api.reorg_from_index_to_new_index(ReorgProtocol(height - 1, height + 1, 32 * b"1", None))
|
||||
assert height is not None
|
||||
await full_node_api.reorg_from_index_to_new_index(
|
||||
ReorgProtocol(uint32(height - 1), uint32(height + 1), bytes32(32 * b"1"), None)
|
||||
)
|
||||
await time_out_assert(20, cat_wallet.get_confirmed_balance, 40)
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"trusted",
|
||||
[True, False],
|
||||
)
|
||||
@pytest.mark.parametrize("trusted", [True, False])
|
||||
@pytest.mark.anyio
|
||||
async def test_get_wallet_for_asset_id(self_hostname, two_wallet_nodes, trusted):
|
||||
async def test_get_wallet_for_asset_id(
|
||||
self_hostname: str, two_wallet_nodes: OldSimulatorsAndWallets, trusted: bool
|
||||
) -> None:
|
||||
num_blocks = 3
|
||||
full_nodes, wallets, _ = two_wallet_nodes
|
||||
full_node_api = full_nodes[0]
|
||||
@ -404,9 +381,9 @@ async def test_get_wallet_for_asset_id(self_hostname, two_wallet_nodes, trusted)
|
||||
wallet_node.config["trusted_peers"] = {}
|
||||
await server_2.start_client(PeerInfo(self_hostname, full_node_server.get_port()), None)
|
||||
|
||||
for i in range(0, num_blocks):
|
||||
for _ in range(num_blocks):
|
||||
await full_node_api.farm_new_transaction_block(FarmNewBlockProtocol(ph))
|
||||
await full_node_api.farm_new_transaction_block(FarmNewBlockProtocol(32 * b"0"))
|
||||
await full_node_api.farm_new_transaction_block(FarmNewBlockProtocol(bytes32(32 * b"0")))
|
||||
|
||||
funds = sum(
|
||||
[calculate_pool_reward(uint32(i)) + calculate_base_farmer_reward(uint32(i)) for i in range(1, num_blocks + 1)]
|
||||
@ -415,18 +392,15 @@ async def test_get_wallet_for_asset_id(self_hostname, two_wallet_nodes, trusted)
|
||||
await time_out_assert(20, wallet.get_confirmed_balance, funds)
|
||||
|
||||
async with wallet_node.wallet_state_manager.lock:
|
||||
cat_wallet: CATWallet = await CATWallet.create_new_cat_wallet(
|
||||
wallet_node.wallet_state_manager,
|
||||
wallet,
|
||||
{"identifier": "genesis_by_id"},
|
||||
uint64(100),
|
||||
DEFAULT_TX_CONFIG,
|
||||
cat_wallet = await CATWallet.create_new_cat_wallet(
|
||||
wallet_node.wallet_state_manager, wallet, {"identifier": "genesis_by_id"}, uint64(100), DEFAULT_TX_CONFIG
|
||||
)
|
||||
|
||||
for i in range(1, num_blocks):
|
||||
await full_node_api.farm_new_transaction_block(FarmNewBlockProtocol(32 * b"0"))
|
||||
for _ in range(1, num_blocks):
|
||||
await full_node_api.farm_new_transaction_block(FarmNewBlockProtocol(bytes32(32 * b"0")))
|
||||
|
||||
asset_id = cat_wallet.get_asset_id()
|
||||
assert cat_wallet.cat_info.my_tail is not None
|
||||
await cat_wallet.set_tail_program(bytes(cat_wallet.cat_info.my_tail).hex())
|
||||
assert await wallet_node.wallet_state_manager.get_wallet_for_asset_id(asset_id) == cat_wallet
|
||||
|
||||
@ -439,12 +413,9 @@ async def test_get_wallet_for_asset_id(self_hostname, two_wallet_nodes, trusted)
|
||||
assert cat_wallet_2.get_name() == "Test Name"
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"trusted",
|
||||
[True, False],
|
||||
)
|
||||
@pytest.mark.parametrize("trusted", [True, False])
|
||||
@pytest.mark.anyio
|
||||
async def test_cat_doesnt_see_eve(self_hostname, two_wallet_nodes, trusted):
|
||||
async def test_cat_doesnt_see_eve(self_hostname: str, two_wallet_nodes: OldSimulatorsAndWallets, trusted: bool) -> None:
|
||||
num_blocks = 3
|
||||
full_nodes, wallets, _ = two_wallet_nodes
|
||||
full_node_api = full_nodes[0]
|
||||
@ -464,9 +435,9 @@ async def test_cat_doesnt_see_eve(self_hostname, two_wallet_nodes, trusted):
|
||||
await server_2.start_client(PeerInfo(self_hostname, full_node_server.get_port()), None)
|
||||
await server_3.start_client(PeerInfo(self_hostname, full_node_server.get_port()), None)
|
||||
|
||||
for i in range(0, num_blocks):
|
||||
for _ in range(num_blocks):
|
||||
await full_node_api.farm_new_transaction_block(FarmNewBlockProtocol(ph))
|
||||
await full_node_api.farm_new_transaction_block(FarmNewBlockProtocol(32 * b"0"))
|
||||
await full_node_api.farm_new_transaction_block(FarmNewBlockProtocol(bytes32(32 * b"0")))
|
||||
|
||||
funds = sum(
|
||||
[calculate_pool_reward(uint32(i)) + calculate_base_farmer_reward(uint32(i)) for i in range(1, num_blocks + 1)]
|
||||
@ -475,14 +446,10 @@ async def test_cat_doesnt_see_eve(self_hostname, two_wallet_nodes, trusted):
|
||||
await time_out_assert(20, wallet.get_confirmed_balance, funds)
|
||||
|
||||
async with wallet_node.wallet_state_manager.lock:
|
||||
cat_wallet: CATWallet = await CATWallet.create_new_cat_wallet(
|
||||
wallet_node.wallet_state_manager,
|
||||
wallet,
|
||||
{"identifier": "genesis_by_id"},
|
||||
uint64(100),
|
||||
DEFAULT_TX_CONFIG,
|
||||
cat_wallet = await CATWallet.create_new_cat_wallet(
|
||||
wallet_node.wallet_state_manager, wallet, {"identifier": "genesis_by_id"}, uint64(100), DEFAULT_TX_CONFIG
|
||||
)
|
||||
tx_records: List[TransactionRecord] = await wallet_node.wallet_state_manager.tx_store.get_not_sent()
|
||||
tx_records = await wallet_node.wallet_state_manager.tx_store.get_not_sent()
|
||||
await full_node_api.process_transaction_records(records=tx_records)
|
||||
|
||||
await time_out_assert(20, cat_wallet.get_confirmed_balance, 100)
|
||||
@ -491,9 +458,7 @@ async def test_cat_doesnt_see_eve(self_hostname, two_wallet_nodes, trusted):
|
||||
assert cat_wallet.cat_info.limitations_program_hash is not None
|
||||
asset_id = cat_wallet.get_asset_id()
|
||||
|
||||
cat_wallet_2: CATWallet = await CATWallet.get_or_create_wallet_for_cat(
|
||||
wallet_node_2.wallet_state_manager, wallet2, asset_id
|
||||
)
|
||||
cat_wallet_2 = await CATWallet.get_or_create_wallet_for_cat(wallet_node_2.wallet_state_manager, wallet2, asset_id)
|
||||
|
||||
assert cat_wallet.cat_info.limitations_program_hash == cat_wallet_2.cat_info.limitations_program_hash
|
||||
|
||||
@ -516,7 +481,7 @@ async def test_cat_doesnt_see_eve(self_hostname, two_wallet_nodes, trusted):
|
||||
|
||||
cc2_ph = await cat_wallet_2.get_new_cat_puzzle_hash()
|
||||
[tx_record] = await wallet.wallet_state_manager.main_wallet.generate_signed_transaction(
|
||||
10, cc2_ph, DEFAULT_TX_CONFIG, 0
|
||||
uint64(10), cc2_ph, DEFAULT_TX_CONFIG
|
||||
)
|
||||
await wallet.wallet_state_manager.add_pending_transaction(tx_record)
|
||||
await full_node_api.process_transaction_records(records=[tx_record])
|
||||
@ -524,7 +489,7 @@ async def test_cat_doesnt_see_eve(self_hostname, two_wallet_nodes, trusted):
|
||||
id = cat_wallet_2.id()
|
||||
wsm = cat_wallet_2.wallet_state_manager
|
||||
|
||||
async def query_and_assert_transactions(wsm, id):
|
||||
async def query_and_assert_transactions(wsm: WalletStateManager, id: uint32) -> int:
|
||||
all_txs = await wsm.tx_store.get_all_transactions_for_wallet(id)
|
||||
return len(list(filter(lambda tx: tx.amount == 10, all_txs)))
|
||||
|
||||
@ -534,12 +499,11 @@ async def test_cat_doesnt_see_eve(self_hostname, two_wallet_nodes, trusted):
|
||||
await time_out_assert(20, cat_wallet_2.get_unconfirmed_balance, 60)
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"trusted",
|
||||
[True, False],
|
||||
)
|
||||
@pytest.mark.parametrize("trusted", [True, False])
|
||||
@pytest.mark.anyio
|
||||
async def test_cat_spend_multiple(self_hostname, three_wallet_nodes, trusted):
|
||||
async def test_cat_spend_multiple(
|
||||
self_hostname: str, three_wallet_nodes: OldSimulatorsAndWallets, trusted: bool
|
||||
) -> None:
|
||||
num_blocks = 3
|
||||
full_nodes, wallets, _ = three_wallet_nodes
|
||||
full_node_api = full_nodes[0]
|
||||
@ -564,7 +528,7 @@ async def test_cat_spend_multiple(self_hostname, three_wallet_nodes, trusted):
|
||||
await wallet_server_1.start_client(PeerInfo(self_hostname, full_node_server.get_port()), None)
|
||||
await wallet_server_2.start_client(PeerInfo(self_hostname, full_node_server.get_port()), None)
|
||||
|
||||
for i in range(0, num_blocks):
|
||||
for _ in range(num_blocks):
|
||||
await full_node_api.farm_new_transaction_block(FarmNewBlockProtocol(ph))
|
||||
|
||||
funds = sum(
|
||||
@ -574,14 +538,14 @@ async def test_cat_spend_multiple(self_hostname, three_wallet_nodes, trusted):
|
||||
await time_out_assert(20, wallet_0.get_confirmed_balance, funds)
|
||||
|
||||
async with wallet_node_0.wallet_state_manager.lock:
|
||||
cat_wallet_0: CATWallet = await CATWallet.create_new_cat_wallet(
|
||||
cat_wallet_0 = await CATWallet.create_new_cat_wallet(
|
||||
wallet_node_0.wallet_state_manager,
|
||||
wallet_0,
|
||||
{"identifier": "genesis_by_id"},
|
||||
uint64(100),
|
||||
DEFAULT_TX_CONFIG,
|
||||
)
|
||||
tx_records: List[TransactionRecord] = await wallet_node_0.wallet_state_manager.tx_store.get_not_sent()
|
||||
tx_records = await wallet_node_0.wallet_state_manager.tx_store.get_not_sent()
|
||||
await full_node_api.process_transaction_records(records=tx_records)
|
||||
|
||||
await time_out_assert(20, cat_wallet_0.get_confirmed_balance, 100)
|
||||
@ -590,13 +554,9 @@ async def test_cat_spend_multiple(self_hostname, three_wallet_nodes, trusted):
|
||||
assert cat_wallet_0.cat_info.limitations_program_hash is not None
|
||||
asset_id = cat_wallet_0.get_asset_id()
|
||||
|
||||
cat_wallet_1: CATWallet = await CATWallet.get_or_create_wallet_for_cat(
|
||||
wallet_node_1.wallet_state_manager, wallet_1, asset_id
|
||||
)
|
||||
cat_wallet_1 = await CATWallet.get_or_create_wallet_for_cat(wallet_node_1.wallet_state_manager, wallet_1, asset_id)
|
||||
|
||||
cat_wallet_2: CATWallet = await CATWallet.get_or_create_wallet_for_cat(
|
||||
wallet_node_2.wallet_state_manager, wallet_2, asset_id
|
||||
)
|
||||
cat_wallet_2 = await CATWallet.get_or_create_wallet_for_cat(wallet_node_2.wallet_state_manager, wallet_2, asset_id)
|
||||
|
||||
assert cat_wallet_0.cat_info.limitations_program_hash == cat_wallet_1.cat_info.limitations_program_hash
|
||||
assert cat_wallet_0.cat_info.limitations_program_hash == cat_wallet_2.cat_info.limitations_program_hash
|
||||
@ -643,7 +603,7 @@ async def test_cat_spend_multiple(self_hostname, three_wallet_nodes, trusted):
|
||||
|
||||
txs = await wallet_1.wallet_state_manager.tx_store.get_transactions_between(cat_wallet_1.id(), 0, 100000)
|
||||
# Test with Memo
|
||||
tx_records_3: TransactionRecord = await cat_wallet_1.generate_signed_transaction(
|
||||
tx_records_3 = await cat_wallet_1.generate_signed_transaction(
|
||||
[uint64(30)], [cat_hash], DEFAULT_TX_CONFIG, memos=[[b"Markus Walburg"]]
|
||||
)
|
||||
with pytest.raises(ValueError):
|
||||
@ -660,13 +620,16 @@ async def test_cat_spend_multiple(self_hostname, three_wallet_nodes, trusted):
|
||||
memos = tx.get_memos()
|
||||
assert len(memos) == 2 # One for tx, one for change
|
||||
assert b"Markus Walburg" in [v for v_list in memos.values() for v in v_list]
|
||||
assert tx.spend_bundle is not None
|
||||
assert list(memos.keys())[0] in [a.name() for a in tx.spend_bundle.additions()]
|
||||
|
||||
|
||||
@pytest.mark.limit_consensus_modes(allowed=[ConsensusMode.PLAIN, ConsensusMode.HARD_FORK_2_0], reason="save time")
|
||||
@pytest.mark.parametrize("trusted", [True, False])
|
||||
@pytest.mark.anyio
|
||||
async def test_cat_max_amount_send(self_hostname, two_wallet_nodes, trusted):
|
||||
async def test_cat_max_amount_send(
|
||||
self_hostname: str, two_wallet_nodes: OldSimulatorsAndWallets, trusted: bool
|
||||
) -> None:
|
||||
num_blocks = 3
|
||||
full_nodes, wallets, _ = two_wallet_nodes
|
||||
full_node_api = full_nodes[0]
|
||||
@ -685,9 +648,9 @@ async def test_cat_max_amount_send(self_hostname, two_wallet_nodes, trusted):
|
||||
await server_2.start_client(PeerInfo(self_hostname, full_node_server.get_port()), None)
|
||||
await server_3.start_client(PeerInfo(self_hostname, full_node_server.get_port()), None)
|
||||
|
||||
for i in range(0, num_blocks):
|
||||
for _ in range(num_blocks):
|
||||
await full_node_api.farm_new_transaction_block(FarmNewBlockProtocol(ph))
|
||||
await full_node_api.farm_new_transaction_block(FarmNewBlockProtocol(32 * b"0"))
|
||||
await full_node_api.farm_new_transaction_block(FarmNewBlockProtocol(bytes32(32 * b"0")))
|
||||
|
||||
funds = sum(
|
||||
[calculate_pool_reward(uint32(i)) + calculate_base_farmer_reward(uint32(i)) for i in range(1, num_blocks + 1)]
|
||||
@ -696,14 +659,10 @@ async def test_cat_max_amount_send(self_hostname, two_wallet_nodes, trusted):
|
||||
await time_out_assert(20, wallet.get_confirmed_balance, funds)
|
||||
|
||||
async with wallet_node.wallet_state_manager.lock:
|
||||
cat_wallet: CATWallet = await CATWallet.create_new_cat_wallet(
|
||||
wallet_node.wallet_state_manager,
|
||||
wallet,
|
||||
{"identifier": "genesis_by_id"},
|
||||
uint64(100000),
|
||||
DEFAULT_TX_CONFIG,
|
||||
cat_wallet = await CATWallet.create_new_cat_wallet(
|
||||
wallet_node.wallet_state_manager, wallet, {"identifier": "genesis_by_id"}, uint64(100000), DEFAULT_TX_CONFIG
|
||||
)
|
||||
tx_records: List[TransactionRecord] = await wallet_node.wallet_state_manager.tx_store.get_not_sent()
|
||||
tx_records = await wallet_node.wallet_state_manager.tx_store.get_not_sent()
|
||||
await full_node_api.process_transaction_records(records=tx_records)
|
||||
|
||||
await time_out_assert(20, cat_wallet.get_confirmed_balance, 100000)
|
||||
@ -728,7 +687,7 @@ async def test_cat_max_amount_send(self_hostname, two_wallet_nodes, trusted):
|
||||
|
||||
await asyncio.sleep(2)
|
||||
|
||||
async def check_all_there():
|
||||
async def check_all_there() -> bool:
|
||||
spendable = await cat_wallet.get_cat_spendable_coins()
|
||||
spendable_name_set = set()
|
||||
for record in spendable:
|
||||
@ -746,36 +705,28 @@ async def test_cat_max_amount_send(self_hostname, two_wallet_nodes, trusted):
|
||||
|
||||
# 1) Generate transaction that is under the limit
|
||||
[transaction_record] = await cat_wallet.generate_signed_transaction(
|
||||
[max_sent_amount - 1],
|
||||
[ph],
|
||||
DEFAULT_TX_CONFIG,
|
||||
[uint64(max_sent_amount - 1)], [ph], DEFAULT_TX_CONFIG
|
||||
)
|
||||
|
||||
assert transaction_record.amount == uint64(max_sent_amount - 1)
|
||||
|
||||
# 2) Generate transaction that is equal to limit
|
||||
[transaction_record] = await cat_wallet.generate_signed_transaction(
|
||||
[max_sent_amount],
|
||||
[ph],
|
||||
DEFAULT_TX_CONFIG,
|
||||
[uint64(max_sent_amount)], [ph], DEFAULT_TX_CONFIG
|
||||
)
|
||||
|
||||
assert transaction_record.amount == uint64(max_sent_amount)
|
||||
|
||||
# 3) Generate transaction that is greater than limit
|
||||
with pytest.raises(ValueError):
|
||||
await cat_wallet.generate_signed_transaction(
|
||||
[max_sent_amount + 1],
|
||||
[ph],
|
||||
DEFAULT_TX_CONFIG,
|
||||
)
|
||||
await cat_wallet.generate_signed_transaction([uint64(max_sent_amount + 1)], [ph], DEFAULT_TX_CONFIG)
|
||||
|
||||
|
||||
@pytest.mark.limit_consensus_modes(allowed=[ConsensusMode.PLAIN, ConsensusMode.HARD_FORK_2_0], reason="save time")
|
||||
@pytest.mark.parametrize("trusted", [True, False])
|
||||
@pytest.mark.parametrize("autodiscovery", [True, False])
|
||||
@pytest.mark.anyio
|
||||
async def test_cat_hint(self_hostname, two_wallet_nodes, trusted, autodiscovery):
|
||||
async def test_cat_hint(
|
||||
self_hostname: str, two_wallet_nodes: OldSimulatorsAndWallets, trusted: bool, autodiscovery: bool
|
||||
) -> None:
|
||||
num_blocks = 3
|
||||
full_nodes, wallets, _ = two_wallet_nodes
|
||||
full_node_api = full_nodes[0]
|
||||
@ -797,9 +748,9 @@ async def test_cat_hint(self_hostname, two_wallet_nodes, trusted, autodiscovery)
|
||||
await server_2.start_client(PeerInfo(self_hostname, full_node_server.get_port()), None)
|
||||
await server_3.start_client(PeerInfo(self_hostname, full_node_server.get_port()), None)
|
||||
|
||||
for i in range(0, num_blocks):
|
||||
for _ in range(num_blocks):
|
||||
await full_node_api.farm_new_transaction_block(FarmNewBlockProtocol(ph))
|
||||
await full_node_api.farm_new_transaction_block(FarmNewBlockProtocol(32 * b"0"))
|
||||
await full_node_api.farm_new_transaction_block(FarmNewBlockProtocol(bytes32(32 * b"0")))
|
||||
|
||||
funds = sum(
|
||||
[calculate_pool_reward(uint32(i)) + calculate_base_farmer_reward(uint32(i)) for i in range(1, num_blocks + 1)]
|
||||
@ -808,14 +759,10 @@ async def test_cat_hint(self_hostname, two_wallet_nodes, trusted, autodiscovery)
|
||||
await time_out_assert(20, wallet.get_confirmed_balance, funds)
|
||||
|
||||
async with wallet_node.wallet_state_manager.lock:
|
||||
cat_wallet: CATWallet = await CATWallet.create_new_cat_wallet(
|
||||
wallet_node.wallet_state_manager,
|
||||
wallet,
|
||||
{"identifier": "genesis_by_id"},
|
||||
uint64(100),
|
||||
DEFAULT_TX_CONFIG,
|
||||
cat_wallet = await CATWallet.create_new_cat_wallet(
|
||||
wallet_node.wallet_state_manager, wallet, {"identifier": "genesis_by_id"}, uint64(100), DEFAULT_TX_CONFIG
|
||||
)
|
||||
tx_records: List[TransactionRecord] = await wallet_node.wallet_state_manager.tx_store.get_not_sent()
|
||||
tx_records = await wallet_node.wallet_state_manager.tx_store.get_not_sent()
|
||||
await full_node_api.process_transaction_records(records=tx_records)
|
||||
|
||||
await time_out_assert(20, cat_wallet.get_confirmed_balance, 100)
|
||||
@ -866,7 +813,8 @@ async def test_cat_hint(self_hostname, two_wallet_nodes, trusted, autodiscovery)
|
||||
|
||||
# Now we check that another wallet WAS created, even if autodiscovery was disabled
|
||||
await time_out_assert(20, check_wallets, 2, wallet_node_2)
|
||||
cat_wallet_2 = wallet_node_2.wallet_state_manager.wallets[2]
|
||||
cat_wallet_2 = wallet_node_2.wallet_state_manager.wallets[uint32(2)]
|
||||
assert isinstance(cat_wallet_2, CATWallet)
|
||||
|
||||
# Previous balance + balance that triggered creation in case of disabled autodiscovery
|
||||
await time_out_assert(30, cat_wallet_2.get_confirmed_balance, 70)
|
||||
@ -883,17 +831,14 @@ async def test_cat_hint(self_hostname, two_wallet_nodes, trusted, autodiscovery)
|
||||
await time_out_assert(20, cat_wallet.get_unconfirmed_balance, 35)
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"trusted",
|
||||
[True, False],
|
||||
)
|
||||
@pytest.mark.parametrize("trusted", [True, False])
|
||||
@pytest.mark.anyio
|
||||
async def test_cat_change_detection(
|
||||
self_hostname: str, one_wallet_and_one_simulator_services: SimulatorsAndWalletsServices, trusted: bool
|
||||
) -> None:
|
||||
num_blocks = 1
|
||||
full_nodes, wallets, bt = one_wallet_and_one_simulator_services
|
||||
full_node_api: FullNodeSimulator = full_nodes[0]._api
|
||||
full_node_api = full_nodes[0]._api
|
||||
full_node_server = full_node_api.full_node.server
|
||||
wallet_service_0 = wallets[0]
|
||||
wallet_node_0 = wallet_service_0._node
|
||||
@ -929,17 +874,12 @@ async def test_cat_change_detection(
|
||||
CAT_MOD, Program.to(None).get_tree_hash(), inner_puzhash
|
||||
).get_tree_hash_precalc(inner_puzhash)
|
||||
change_derivation = DerivationRecord(
|
||||
uint32(0),
|
||||
puzzlehash_unhardened,
|
||||
pubkey_unhardened,
|
||||
WalletType.CAT,
|
||||
uint32(2),
|
||||
False,
|
||||
uint32(0), puzzlehash_unhardened, pubkey_unhardened, WalletType.CAT, uint32(2), False
|
||||
)
|
||||
# Insert the derivation record before the wallet exists so that it is not subscribed to
|
||||
await wallet_node_0.wallet_state_manager.puzzle_store.add_derivation_paths([change_derivation])
|
||||
our_puzzle: Program = await wallet_0.get_new_puzzle()
|
||||
cat_puzzle: Program = construct_cat_puzzle(
|
||||
our_puzzle = await wallet_0.get_new_puzzle()
|
||||
cat_puzzle = construct_cat_puzzle(
|
||||
CAT_MOD,
|
||||
Program.to(None).get_tree_hash(),
|
||||
Program.to(1),
|
||||
@ -960,11 +900,7 @@ async def test_cat_change_detection(
|
||||
cat_coin = next(c for c in spend_bundle.additions() if c.amount == cat_amount_0)
|
||||
next_coin = Coin(
|
||||
cat_coin.name(),
|
||||
construct_cat_puzzle(
|
||||
CAT_MOD,
|
||||
Program.to(None).get_tree_hash(),
|
||||
our_puzzle,
|
||||
).get_tree_hash(),
|
||||
construct_cat_puzzle(CAT_MOD, Program.to(None).get_tree_hash(), our_puzzle).get_tree_hash(),
|
||||
cat_amount_0,
|
||||
)
|
||||
eve_spend = await wallet_node_0.wallet_state_manager.sign_transaction(
|
||||
@ -976,12 +912,7 @@ async def test_cat_change_detection(
|
||||
[
|
||||
Program.to(
|
||||
[
|
||||
[
|
||||
51,
|
||||
our_puzzle.get_tree_hash(),
|
||||
cat_amount_0,
|
||||
[our_puzzle.get_tree_hash()],
|
||||
],
|
||||
[51, our_puzzle.get_tree_hash(), cat_amount_0, [our_puzzle.get_tree_hash()]],
|
||||
[51, None, -113, None, None],
|
||||
]
|
||||
),
|
||||
@ -996,11 +927,7 @@ async def test_cat_change_detection(
|
||||
),
|
||||
make_spend(
|
||||
next_coin,
|
||||
construct_cat_puzzle(
|
||||
CAT_MOD,
|
||||
Program.to(None).get_tree_hash(),
|
||||
our_puzzle,
|
||||
),
|
||||
construct_cat_puzzle(CAT_MOD, Program.to(None).get_tree_hash(), our_puzzle),
|
||||
Program.to(
|
||||
[
|
||||
[
|
||||
@ -1042,9 +969,7 @@ async def test_cat_change_detection(
|
||||
async def test_unacknowledged_cat_table() -> None:
|
||||
db_name = Path(tempfile.TemporaryDirectory().name).joinpath("test.sqlite")
|
||||
db_name.parent.mkdir(parents=True, exist_ok=True)
|
||||
async with DBWrapper2.managed(
|
||||
database=db_name,
|
||||
) as db_wrapper:
|
||||
async with DBWrapper2.managed(database=db_name) as db_wrapper:
|
||||
interested_store = await WalletInterestedStore.create(db_wrapper)
|
||||
|
||||
def asset_id(i: int) -> bytes32:
|
||||
@ -1053,22 +978,10 @@ async def test_unacknowledged_cat_table() -> None:
|
||||
def coin_state(i: int) -> CoinState:
|
||||
return CoinState(Coin(bytes32([0] * 32), bytes32([0] * 32), uint64(i)), None, None)
|
||||
|
||||
await interested_store.add_unacknowledged_coin_state(
|
||||
asset_id(0),
|
||||
coin_state(0),
|
||||
None,
|
||||
)
|
||||
await interested_store.add_unacknowledged_coin_state(
|
||||
asset_id(1),
|
||||
coin_state(1),
|
||||
100,
|
||||
)
|
||||
await interested_store.add_unacknowledged_coin_state(asset_id(0), coin_state(0), None)
|
||||
await interested_store.add_unacknowledged_coin_state(asset_id(1), coin_state(1), 100)
|
||||
assert await interested_store.get_unacknowledged_states_for_asset_id(asset_id(0)) == [(coin_state(0), 0)]
|
||||
await interested_store.add_unacknowledged_coin_state(
|
||||
asset_id(0),
|
||||
coin_state(0),
|
||||
None,
|
||||
)
|
||||
await interested_store.add_unacknowledged_coin_state(asset_id(0), coin_state(0), None)
|
||||
assert await interested_store.get_unacknowledged_states_for_asset_id(asset_id(0)) == [(coin_state(0), 0)]
|
||||
assert await interested_store.get_unacknowledged_states_for_asset_id(asset_id(1)) == [(coin_state(1), 100)]
|
||||
assert await interested_store.get_unacknowledged_states_for_asset_id(asset_id(2)) == []
|
||||
|
Loading…
Reference in New Issue
Block a user