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

[BUG] Unfriendly error message when joining pool already joined: "'NoneType' object is not iterable". #7292

Open laonadev opened 3 years ago

laonadev commented 3 years ago

Describe the bug When attempting to join a pool, I get the following exception.

$ chia plotnft join -i 2 -u https://asia1.pool.space -y
{'authentication_token_timeout': 5,
 'description': 'Welcome to Space Pool. By creating this Plot NFT, you agree '
                'to the following terms https://pool.space/terms',
 'fee': 0,
 'logo_url': 'https://pool.space/logo-250.png',
 'minimum_difficulty': 1,
 'name': 'Space Pool',
 'protocol_version': 1,
 'relative_lock_height': 64,
 'target_puzzle_hash': '0x2f2c9ba1b2315..........e7b14d942b969ed5d57'}

Will join pool: https://asia1.pool.space with Plot NFT 449168170.
Error performing operation on Plot NFT -f 449168170 wallet id: 2: 'NoneType' object is not iterable

To Reproduce

Steps to reproduce the behavior:

On the cli, chia plotnft join -i 2 -u https://asia1.pool.space -y

Expected behavior

Pool can be joined.

Desktop

OS: Linux OS Version/Flavor: Ubuntu 20.04.2 CPU: Intel i3-3220 Blockchain: 1.2.0

Additional context

Updated from 1.1.8dev0, and I keep the data in ~/.chia/

emlowe commented 3 years ago

It's probably the wrong wallet id - use chia wallet show and see which ID is your pooling wallet. also do chia plotnft show and make sure your plotnft is displayed correctly.

laonadev commented 3 years ago

wallet id is ok, I get it from chia plotnft show. I trace into the code, it seems the api function pw_join_pool in rpc/wallet_rpc_api.py return {"transaction": None}:

    async def pw_join_pool(self, request):
        wallet_id = uint32(request["wallet_id"])
        wallet: PoolWallet = self.service.wallet_state_manager.wallets[wallet_id]
        pool_wallet_info: PoolWalletInfo = await wallet.get_current_state()
        owner_pubkey = pool_wallet_info.current.owner_pubkey
        target_puzzlehash = None
        if "target_puzzlehash" in request:
            target_puzzlehash = bytes32(hexstr_to_bytes(request["target_puzzlehash"]))
        new_target_state: PoolState = create_pool_state(
            FARMING_TO_POOL,
            target_puzzlehash,
            owner_pubkey,
            request["pool_url"],
            uint32(request["relative_lock_height"]),
        )
        async with self.service.wallet_state_manager.lock:
            tx: TransactionRecord = await wallet.join_pool(new_target_state)
            return {"transaction": tx}
laonadev commented 3 years ago

I check the command line help:

$ chia plotnft -h
Usage: chia plotnft [OPTIONS] COMMAND [ARGS]...

Options:
  -h, --help  Show this message and exit.

Commands:
  claim           Claim rewards from a plot NFT
  create          Create a plot NFT
  get_login_link  Create a login link for a pool. To get the launcher id, use
                  plotnft show.

  inspect         Get Detailed plotnft information as JSON
  join            Join a plot NFT to a Pool
  leave           Leave a pool and return to self-farming
  show            Show plotnft information

Is chia plotnft create automatically join the pool after it created? So what will happen if I join to the pool already joined?

emlowe commented 3 years ago

You get this error when trying to join to a pool the PlotNFT is already joined to

Yes, if you do chia plotnft create -s pool -u URL it will create and join the pool. When you run chia plotnft show - it will say something like Current state: FARMING_TO_POOL .. Current pool URL: https://xxx

So I think you are already joined to that pool

changpeng75 commented 3 years ago

@emlowe I already join a pool,why I run chia plotnft show I get Exception from 'wallet' Unclosed client session client_session: <aiohttp.client.ClientSession object at 0x7f8fcad2a0a0> Unclosed connector connections: ['[(<aiohttp.client_proto.ResponseHandler object at 0x7f8fcaca1ca0>, 13152.840514857)]'] connector: <aiohttp.connector.TCPConnector object at 0x7f8fcad2a610>

Sosonedu commented 3 years ago

delete the config order and reinstall chia...

aarcro commented 3 years ago

I got this error as well. I know I was trying to join the pool I had already joined. This was after I changed payout_instructions to point to my cold wallet (a shame that isn't configurable from the start).

I've shifted to solo, which seemed to have worked. And trying to join again I get "Cannot join a pool while waiting for target state" error. Which I assume means I haven't waited long enough for the cool down (But I don't know what the cool down is)

I'm guessing it's related to 'relative_lock_height': 100, in the pool info, but 100 what? and since when?

RealStrike commented 3 years ago

I got this error as well. I know I was trying to join the pool I had already joined. This was after I changed payout_instructions to point to my cold wallet (a shame that isn't configurable from the start).

I've shifted to solo, which seemed to have worked. And trying to join again I get "Cannot join a pool while waiting for target state" error. Which I assume means I haven't waited long enough for the cool down (But I don't know what the cool down is)

I'm guessing it's related to 'relative_lock_height': 100, in the pool info, but 100 what? and since when?

Hi, have you found a solution to the problem?

emlowe commented 3 years ago

The relative_lock_height refers to the blockchain height - so the 100 is blocks. You need to wait at least 100 blocks from the time the transaction to leave is confirmed on the blockchain before the target state will be completed. Usually, it takes a few more than 100.

kanasite commented 3 years ago

check your config and look for pool:

apparently there's a corrupt config if u re-gen with a pool joined

TheOv3rminD commented 3 years ago

This happened to me when I tried to change pools while I was building plots for the associated pool NFT. I figured that what the problem was, so I let the plots finish and tried again and then it worked just fine.

ereish64 commented 3 years ago

I was moving my chia install to another computer (from GUI to CLI) and was having the exception in wallet error on the new computer. Moving my config file from my old install to the new install was what fixed the issue for me. Looks like there's something going wrong when chia trys to re-generate the config file...

LouisLoudogTrottier commented 3 years ago

First occurence

I've sent myself one sigle mojo and was able created a singleton NFT, but now when i type chia wallet show i get in stdout Exception from 'wallet' {'error': 'Value -1 of does not fit into uin128', 'success': False}

And ~/.chia/testnet/log/debog.log loop with the error: ERROR Exception: 'NoneType' object is not iterable <class 'TypeError'>, closing connection {'host': '127.0.0.1', 'port': 58444}. Traceback (most recent call last): also noticed an: WARNING Trying to ban localhost for 10, but will not ban Yes, this is testnet. I'Ve restared with chia start farmer -r My transaction to create the singleton is still in mempool after 45 minutes, the wallet is broken and loop has started to loop TypeError: 'NoneType' object is not iterable Followed by RuntimeError: Was not able to add blocks 634051-634083

Will have to wait to fininsh sync the last 5 wallets to consolidate my mojo before being able to delete db. Thank again,

Reproducing with a new wallet :

BEFORE NFT:

Wallet height: 634285
Sync status: Synced
Balances, fingerprint: ...
Wallet ID 1 type STANDARD_WALLET Chia Wallet
   -Total Balance: 1e-12 txch (1 mojo)
   -Pending Total Balance: 1e-12 txch (1 mojo)
   -Spendable: 1e-12 txch (1 mojo)

chia plotnft create return successfully with

Do chia wallet get_transaction -f .. -tx ... to get status

AFTER NFT:

Wallet height: 634303
Sync status: Synced
Balances, fingerprint: ...
Exception from 'wallet' {'error': 'Value -1 of does not fit into uin128', 'success': False}

TX STUCK

Transaction ...
Status: In mempool
Amount: 1E-12 txch
To address: ...
Created at: 2021-09-24 03:11:29

LOGS since NFT:

2021-09-24T03:15:18.203 wallet wallet_server              : ERROR    Exception: 'NoneType' object is not iterable, {'host': '127.0.0.1', 'port': 58444}. Traceback (most recent call last):
...
TypeError: 'NoneType' object is not iterable

Ya, this is broken, twice on 2 different walers. Will try with more than just one mojo, but if making a singleton break you wallet, ouff..

LouisLoudogTrottier commented 3 years ago

Third run, third wallet but with a full txch instead of just 1 mojo:

Before NFT:

Wallet height: 634424
Sync status: Synced
Balances, fingerprint: 1276634766
Wallet ID 1 type STANDARD_WALLET Chia Wallet
   -Total Balance: 1.0 txch (1000000000000 mojo)
   -Pending Total Balance: 1.0 txch (1000000000000 mojo)
   -Spendable: 1.0 txch (1000000000000 mojo)

Transcation submitted:

Will create a plot NFT and join pool: ....
Transaction submitted to nodes: [('..., 1, None)]
Do chia wallet get_transaction -f ... -tx ... to get status

Wallet AFTER NFT:

NOTE: pending balance is down 2 mojo, not just 1;

Wallet height: 634429
Sync status: Synced
Balances, fingerprint: 1276634766
Wallet ID 1 type STANDARD_WALLET Chia Wallet
   -Total Balance: 1.0 txch (1000000000000 mojo)
   -Pending Total Balance: 0.999999999998 txch (999999999998 mojo)
   -Spendable: 0.0 txch (0 mojo)

Error LOG started to show

TypeError: 'NoneType' object is not iterable
RuntimeError: Was not able to add blocks 634428-634451
WARNING  bad peak response from peer None

TX stuck ni mempool for 6 minutes now.

My 1st tx from 2hours ago is still in mempool and relevant wallet is broken (-1) since. The 2nd attemps is also stuck in mempool and relevant wallet is broken (-1) also.

Before i give up

Taking a last look at the 3rd attemps and tx is stuck in memepool for the last 22 minutes The 3rd wallet is still stuck at 634429 since the NFT and LOOG roll RuntimeError: Was not able to add blocks 634428-634460

F*** That it's friday

I still have 4 wallets to consolidate to have all my mojo at the same place. so before breaking more wallets i'll just let ut go for now at maybe try some last resort solution like rebooting cause rstaing does not do anything to help.

UPDATE:

System update, Chia version 1.2.7 Rebooted Still broken, waiting for another testnet wallet to sync and try again.