Chia-Network / chia-blockchain

Chia blockchain python implementation (full node, farmer, harvester, timelord, and wallet)
Apache License 2.0
10.82k stars 2.03k forks source link

Delete key from GUI fails [Bug] #16995

Closed danieljperry closed 8 months ago

danieljperry commented 10 months ago

What happened?

Delete key from the GUI fails, but it succeeds from the CLI.

To recreate:

A new spinner appears, but the key is not deleted. A WARNING message appears in the log (see below).

I'm seeing the same behavior on Windows and Linux. The wallet is synced when I attempt to delete it. It doesn't seem to matter whether the node is synced.

The stack trace is from 2.0.1, though I'm also seeing it in 2.1.2-rc2.

Version

2.0.1

What platform are you using?

Windows

What ui mode are you using?

GUI

Relevant log output

2023-12-05T13:35:19.539 wallet chia.rpc.rpc_server        : WARNING  Error while handling message: Traceback (most recent call last):
  File "chia/rpc/rpc_server.py", line 340, in safe_handle
  File "chia/rpc/rpc_server.py", line 331, in ws_api
  File "chia/rpc/wallet_rpc_api.py", line 462, in check_delete_key
  File "chia/rpc/wallet_rpc_api.py", line 440, in _check_key_used_for_rewards
  File "chia/util/bech32m.py", line 120, in decode_puzzle_hash
ValueError: Invalid Address
paninaro commented 10 months ago

@danieljperry while the spinner is visible, the GUI is asking the wallet to check if the wallet-to-be-deleted is used for farming or pool rewards. The code in question is:

        farmer_target = config["farmer"].get("xch_target_address")
        pool_target = config["pool"].get("xch_target_address")
        address_to_check: List[bytes32] = [decode_puzzle_hash(farmer_target), decode_puzzle_hash(pool_target)]

Can you check if your config has valid values for the farmer/pool xch_target_address?

danieljperry commented 10 months ago

Thanks, that was the issue. Both instances of the target address were blank: xch_target_address: ''

When I added a real address, I could delete the key. However, the UX issue still remains. If I am just running a wallet and am not farming, I cannot delete a key from the GUI unless I add a dummy address to my config.yaml. Before the address_to_check line, would it be possible to check whether the farmer_target and pool_target are valid addresses?

wjblanke commented 8 months ago

Zlatko can u take a look at this if u have some time