mirror of
https://github.com/Chia-Network/chia-blockchain.git
synced 2024-09-11 10:56:14 +03:00
added get_coin_records_by_parent_ids to spend_sim (#9438)
* added get_coin_records_by_parent_ids to spend_sim * fix linting errors
This commit is contained in:
parent
8db6ee540d
commit
a085d26670
@ -218,6 +218,20 @@ class SimClient:
|
||||
async def get_coin_record_by_name(self, name: bytes32) -> CoinRecord:
|
||||
return await self.service.mempool_manager.coin_store.get_coin_record(name)
|
||||
|
||||
async def get_coin_records_by_parent_ids(
|
||||
self,
|
||||
parent_ids: List[bytes32],
|
||||
start_height: Optional[int] = None,
|
||||
end_height: Optional[int] = None,
|
||||
include_spent_coins: bool = False,
|
||||
) -> List[CoinRecord]:
|
||||
kwargs: Dict[str, Any] = {"include_spent_coins": include_spent_coins, "parent_ids": parent_ids}
|
||||
if start_height is not None:
|
||||
kwargs["start_height"] = start_height
|
||||
if end_height is not None:
|
||||
kwargs["end_height"] = end_height
|
||||
return await self.service.mempool_manager.coin_store.get_coin_records_by_parent_ids(**kwargs)
|
||||
|
||||
async def get_coin_records_by_puzzle_hash(
|
||||
self,
|
||||
puzzle_hash: bytes32,
|
||||
|
@ -137,5 +137,11 @@ class TestSimClient:
|
||||
# get_puzzle_and_solution
|
||||
coin_solution = await sim_client.get_puzzle_and_solution(spendable_coin.name(), latest_block.height)
|
||||
assert coin_solution
|
||||
|
||||
# get_coin_records_by_parent_ids
|
||||
new_coin = next(x.coin for x in additions if x.coin.puzzle_hash == puzzle_hash)
|
||||
coin_records = await sim_client.get_coin_records_by_parent_ids([spendable_coin.name()])
|
||||
assert coin_records[0].coin.name() == new_coin.name()
|
||||
|
||||
finally:
|
||||
await sim.close()
|
||||
|
Loading…
Reference in New Issue
Block a user