checkpoint: into main from release/1.7.0 @ d1a4c579f4 (#14502)

Source hash: d1a4c579f4
Remaining commits: 3
This commit is contained in:
William Allen 2023-02-07 05:58:38 -06:00 committed by GitHub
commit bbf1e1e2d4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 2 deletions

View File

@ -2,7 +2,7 @@ from __future__ import annotations
import dataclasses
import logging
from typing import Any, Dict, List, Optional, Set
from typing import Any, Dict, List, Optional, Set, Tuple
from blspy import G2Element
@ -19,6 +19,7 @@ from chia.wallet.notification_store import Notification, NotificationStore
from chia.wallet.transaction_record import TransactionRecord
from chia.wallet.util.compute_memos import compute_memos_for_spend
from chia.wallet.util.notifications import construct_notification
from chia.wallet.util.wallet_types import WalletType
class NotificationManager:
@ -55,8 +56,13 @@ class NotificationManager:
else:
memos: Dict[bytes32, List[bytes]] = compute_memos_for_spend(parent_spend)
coin_memos: List[bytes] = memos.get(coin_name, [])
wallet_info: Optional[
Tuple[uint32, WalletType]
] = await self.wallet_state_manager.get_wallet_id_for_puzzle_hash(bytes32(coin_memos[0]))
if (
len(coin_memos) == 2
wallet_info is not None
and wallet_info[1] == WalletType.STANDARD_WALLET
and len(coin_memos) == 2
and construct_notification(bytes32(coin_memos[0]), uint64(coin_state.coin.amount)).get_tree_hash()
== coin_state.coin.puzzle_hash
):

View File

@ -171,6 +171,9 @@ async def test_notifications(self_hostname: str, two_wallet_nodes: Any, trusted:
== notifications
)
sent_notifications = await notification_manager_1.notification_store.get_all_notifications()
assert len(sent_notifications) == 0
await notification_manager_2.notification_store.delete_all_notifications()
assert len(await notification_manager_2.notification_store.get_all_notifications()) == 0
await notification_manager_2.notification_store.add_notification(notifications[0])