mirror of
https://github.com/Chia-Network/chia-blockchain.git
synced 2025-01-08 18:34:27 +03:00
Merge commit 'bcb4c1ed48a8be9032f686d69d2eda7c23807194' into checkpoint/main_from_release_1.6.1_bcb4c1ed48a8be9032f686d69d2eda7c23807194
This commit is contained in:
commit
d1e1a5d33d
@ -165,9 +165,6 @@ class DataLayerWallet:
|
||||
self.wallet_id = uint8(self.wallet_info.id)
|
||||
|
||||
await self.wallet_state_manager.add_new_wallet(self, self.wallet_info.id)
|
||||
await self.wallet_state_manager.interested_store.add_interested_puzzle_hash(
|
||||
create_mirror_puzzle().get_tree_hash(), self.id()
|
||||
)
|
||||
|
||||
return self
|
||||
|
||||
@ -844,17 +841,18 @@ class DataLayerWallet:
|
||||
launcher_id, urls = get_mirror_info(
|
||||
parent_spend.puzzle_reveal.to_program(), parent_spend.solution.to_program()
|
||||
)
|
||||
ours: bool = await self.wallet_state_manager.get_wallet_for_coin(coin.parent_coin_info) is not None
|
||||
await self.wallet_state_manager.dl_store.add_mirror(
|
||||
Mirror(
|
||||
coin.name(),
|
||||
launcher_id,
|
||||
uint64(coin.amount),
|
||||
urls,
|
||||
ours,
|
||||
if await self.wallet_state_manager.dl_store.is_launcher_tracked(launcher_id):
|
||||
ours: bool = await self.wallet_state_manager.get_wallet_for_coin(coin.parent_coin_info) is not None
|
||||
await self.wallet_state_manager.dl_store.add_mirror(
|
||||
Mirror(
|
||||
coin.name(),
|
||||
launcher_id,
|
||||
uint64(coin.amount),
|
||||
urls,
|
||||
ours,
|
||||
)
|
||||
)
|
||||
)
|
||||
await self.wallet_state_manager.add_interested_coin_ids([coin.name()])
|
||||
await self.wallet_state_manager.add_interested_coin_ids([coin.name()])
|
||||
|
||||
async def singleton_removed(self, parent_spend: CoinSpend, height: uint32) -> None:
|
||||
parent_name = parent_spend.coin.name()
|
||||
|
@ -278,6 +278,17 @@ class DataLayerStore:
|
||||
|
||||
return [bytes32(row[0]) for row in rows]
|
||||
|
||||
async def is_launcher_tracked(self, launcher_id: bytes32) -> bool:
|
||||
async with self.db_wrapper.reader_no_transaction() as conn:
|
||||
cursor = await conn.execute("SELECT COUNT(*) from singleton_records WHERE launcher_id=?", (launcher_id,))
|
||||
row = await cursor.fetchone()
|
||||
await cursor.close()
|
||||
if row is not None:
|
||||
count: int = row[0]
|
||||
return count > 0
|
||||
else:
|
||||
return False
|
||||
|
||||
async def delete_launcher(self, launcher_id: bytes32) -> None:
|
||||
async with self.db_wrapper.writer_maybe_transaction() as conn:
|
||||
await (await conn.execute("DELETE FROM launchers WHERE id=?", (launcher_id,))).close()
|
||||
|
@ -88,6 +88,9 @@ def create_mirror_puzzle() -> Program:
|
||||
return P2_PARENT.curry(Program.to(1))
|
||||
|
||||
|
||||
MIRROR_PUZZLE_HASH = create_mirror_puzzle().get_tree_hash()
|
||||
|
||||
|
||||
def get_mirror_info(parent_puzzle: Program, parent_solution: Program) -> Tuple[bytes32, List[bytes]]:
|
||||
conditions = parent_puzzle.run(parent_solution)
|
||||
for condition in conditions.as_iter():
|
||||
|
@ -40,6 +40,7 @@ from chia.util.path import path_from_root
|
||||
from chia.wallet.cat_wallet.cat_constants import DEFAULT_CATS
|
||||
from chia.wallet.cat_wallet.cat_utils import construct_cat_puzzle, match_cat_puzzle
|
||||
from chia.wallet.cat_wallet.cat_wallet import CATWallet
|
||||
from chia.wallet.db_wallet.db_wallet_puzzles import MIRROR_PUZZLE_HASH
|
||||
from chia.wallet.derivation_record import DerivationRecord
|
||||
from chia.wallet.derive_keys import (
|
||||
master_sk_to_wallet_sk,
|
||||
@ -1006,7 +1007,10 @@ class WalletStateManager:
|
||||
wallet_id, wallet_type = await self.determine_coin_type(peer, coin_state, fork_height)
|
||||
potential_dl = self.get_dl_wallet()
|
||||
if potential_dl is not None:
|
||||
if await potential_dl.get_singleton_record(coin_state.coin.name()) is not None:
|
||||
if (
|
||||
await potential_dl.get_singleton_record(coin_state.coin.name()) is not None
|
||||
or coin_state.coin.puzzle_hash == MIRROR_PUZZLE_HASH
|
||||
):
|
||||
wallet_id = potential_dl.id()
|
||||
wallet_type = WalletType(potential_dl.type())
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user