chia-blockchain icon indicating copy to clipboard operation
chia-blockchain copied to clipboard

Issues with creating many hundreds of offers via script

Open emlowe opened this issue 1 year ago • 2 comments

          Tested with SQL updated to 3.40.1 and Python 3.11.1 / 3.10 

After updating the Python 3.11.1 / 3.10 version, error too many SQL variables error seems fixed.

Script throws new errors due to the CATs. 1st time crashed after creating aprox.1404 offers, 2nd time crashed after creating ~631 offers, 3th time crashed after creating ~417 offers. Failed to add coin 0xab5ff63deed917839b4a9bcaf0e85dc4d3648ca132a9298b757b19850112552c

Total CATs: 6432 https://www.spacescan.io/coin/9bb28ab4cd61417164818914c7a1bb4ffd2d8fcd89e7827e1975671dc801f404 coin: 0x9bb28ab4cd61417164818914c7a1bb4ffd2d8fcd89e7827e1975671dc801f404 2023-02-12T**09:32:07.840** wallet chia.wallet.cat_wallet.cat_wallet: INFO Confirmed balance for cat wallet 12 is **9953000**

Total CATs: 6431 https://www.spacescan.io/coin/0xab5ff63deed917839b4a9bcaf0e85dc4d3648ca132a9298b757b19850112552c Coin: 0xab5ff63deed917839b4a9bcaf0e85dc4d3648ca132a9298b757b19850112552c 2023-02-12T**09:32:14.322** wallet chia.wallet.cat_wallet.cat_wallet: INFO Confirmed balance for cat wallet 12 is **3522000** Suddenly Total Balance dropped from 9953 to 3522 within 6.482 seconds 2023-02-12T09:32:14.322 - 2023-02-12T09:32:07.840 = 6.482 ~aprox.7 seconds

Following errors are observed from the log data: Logs from 2nd attempt errors out after generating ~631 offers:

2023-02-12T09:32:23.601 wallet chia.rpc.util              : WARNING  Error while handling message: Traceback (most recent call last):
  File "chia/rpc/util.py", line 18, in inner
  File "chia/rpc/wallet_rpc_api.py", line 1396, in cat_spend
  File "chia/wallet/cat_wallet/cat_wallet.py", line 786, in generate_signed_transaction
ValueError: Can't send more than 0 mojos in a single transaction
2023-02-12T09:32:28.365 wallet chia.wallet.cat_wallet.cat_wallet: INFO     Confirmed balance for cat wallet 12 is 3522000
2023-02-12T09:32:28.870 wallet chia.wallet.cat_wallet.cat_wallet: WARNING  Can't select amount higher than our spendable balance.  Amount: 1000, spendable: 0
2023-02-12T09:32:28.871 wallet chia.wallet.trade_manager  : ERROR    Error with creating trade offer: <class 'ValueError'>Traceback (most recent call last):
  File "chia/wallet/trade_manager.py", line 493, in _create_offer_for_ids
  File "chia/wallet/cat_wallet/cat_wallet.py", line 886, in get_coins_to_offer
  File "chia/wallet/cat_wallet/cat_wallet.py", line 472, in select_coins
  File "chia/wallet/coin_selection.py", line 39, in select_coins
ValueError: Can't select amount higher than our spendable balance.  Amount: 1000, spendable: 0

2023-02-12T09:32:28.871 wallet chia.rpc.util              : WARNING  Error while handling message: Traceback (most recent call last):
  File "chia/rpc/util.py", line 18, in inner
  File "chia/rpc/wallet_rpc_api.py", line 1485, in create_offer_for_ids
  File "chia/wallet/trade_manager.py", line 407, in create_offer_for_ids
Exception: Error creating offer: Can't select amount higher than our spendable balance.  Amount: 1000, spendable: 0

2023-02-12T09:32:31.730 wallet chia.rpc.util              : WARNING  Error while handling message: Traceback (most recent call last):
  File "chia/rpc/util.py", line 18, in inner
  File "chia/rpc/wallet_rpc_api.py", line 1396, in cat_spend
  File "chia/wallet/cat_wallet/cat_wallet.py", line 786, in generate_signed_transaction
ValueError: Can't send more than 0 mojos in a single transaction

Logs from 3th attempt ~417 offers:

2023-02-13T06:12:59.167 wallet chia.wallet.cat_wallet.cat_wallet: INFO Confirmed balance for cat wallet 12 is 9953000

dropped to after ~aprox.9 seconds

2023-02-13T06:13:09.625 wallet chia.wallet.cat_wallet.cat_wallet: INFO     Confirmed balance for cat wallet 12 is 3709000

......

2023-02-13T06:13:13.777 wallet chia.wallet.cat_wallet.cat_wallet: WARNING  Can't select amount higher than our spendable balance.  Amount: 1000, spendable: 0
2023-02-13T06:13:13.778 wallet chia.wallet.trade_manager  : ERROR    Error with creating trade offer: <class 'ValueError'>Traceback (most recent call last):
  File "chia/wallet/trade_manager.py", line 493, in _create_offer_for_ids
    coins_to_offer[id] = await wallet.get_coins_to_offer(
  File "chia/wallet/cat_wallet/cat_wallet.py", line 886, in get_coins_to_offer
    return await self.select_coins(amount, min_coin_amount=min_coin_amount, max_coin_amount=max_coin_amount)
  File "chia/wallet/cat_wallet/cat_wallet.py", line 472, in select_coins
    coins = await select_coins(
  File "chia/wallet/coin_selection.py", line 39, in select_coins
    raise ValueError(error_msg)
ValueError: Can't select amount higher than our spendable balance.  Amount: 1000, spendable: 0

..............

2023-02-13T06:13:13.778 wallet chia.rpc.util              : WARNING  Error while handling message: Traceback (most recent call last):
  File "chia/rpc/util.py", line 18, in inner
    res_object = await f(request_data)
  File "chia/rpc/wallet_rpc_api.py", line 1485, in create_offer_for_ids
    result = await self.service.wallet_state_manager.trade_manager.create_offer_for_ids(
  File "chia/wallet/trade_manager.py", line 407, in create_offer_for_ids
    raise Exception(f"Error creating offer: {result[2]}")
Exception: Error creating offer: Can't select amount higher than our spendable balance.  Amount: 1000, spendable: 0

2023-02-13T06:13:15.549 full_node chia.full_node.full_node: INFO     🌱 Updated peak to height 3242174

Please review the latest log data and advise how to fix this odd issue.

Thank you in advance🌱 BWCC🍀

Originally posted by @bwccnft in https://github.com/Chia-Network/chia-blockchain/issues/14501#issuecomment-1428486652

emlowe avatar Feb 08 '24 20:02 emlowe

Also see https://github.com/Chia-Network/chia-blockchain/issues/14501#issuecomment-1430224277

emlowe avatar Feb 08 '24 20:02 emlowe

It sounds like all the CATs are in one coin and then creating an offer with 1 CAT ties up the whole balance. Can you split that large CAT coin into smaller CAT coins before trying to create your offers?

wjblanke avatar Feb 14 '24 17:02 wjblanke

This issue has not been updated in 14 days and is now flagged as stale. If this issue is still affecting you and in need of further review, please comment on it with an update to keep it from auto closing in 7 days.

github-actions[bot] avatar Feb 29 '24 11:02 github-actions[bot]

This issue was automatically closed because it has been flagged as stale, and subsequently passed 7 days with no further activity from the submitter or watchers.

github-actions[bot] avatar Mar 08 '24 11:03 github-actions[bot]