mirror of
https://github.com/Chia-Network/chia-blockchain.git
synced 2026-08-24 10:05:29 -05:00
Fix missing wallet state_changed events (#13200)
* Fixed an issue where some of the wallet state_changed events were not notified to subscribers * Fixed a lint error
This commit is contained in:
@@ -187,7 +187,23 @@ class WalletRpcApi:
|
||||
# Metrics is the only current consumer for this event
|
||||
payloads.append(create_payload_dict(change, change_data, self.service_name, "metrics"))
|
||||
|
||||
if "wallet_id" in change_data or "additional_data" in change_data:
|
||||
if change in {
|
||||
"offer_cancelled",
|
||||
"offer_added",
|
||||
"wallet_created",
|
||||
"did_coin_added",
|
||||
"nft_coin_added",
|
||||
"nft_coin_removed",
|
||||
"nft_coin_updated",
|
||||
"nft_coin_did_set",
|
||||
"new_block",
|
||||
"coin_removed",
|
||||
"coin_added",
|
||||
"new_derivation_index",
|
||||
"added_stray_cat",
|
||||
"pending_transaction",
|
||||
"tx_update",
|
||||
}:
|
||||
payloads.append(create_payload_dict("state_changed", change_data, self.service_name, "wallet_ui"))
|
||||
|
||||
return payloads
|
||||
|
||||
@@ -490,13 +490,11 @@ class WalletStateManager:
|
||||
"""
|
||||
if self.state_changed_callback is None:
|
||||
return None
|
||||
change_data: Dict[str, Any] = {}
|
||||
change_data: Dict[str, Any] = {"state": state}
|
||||
if wallet_id is not None:
|
||||
change_data["wallet_id"] = wallet_id
|
||||
if data_object is not None:
|
||||
change_data["additional_data"] = data_object
|
||||
if len(change_data) > 0:
|
||||
change_data["state"] = state
|
||||
self.state_changed_callback(state, change_data)
|
||||
|
||||
def tx_pending_changed(self) -> None:
|
||||
|
||||
Reference in New Issue
Block a user