You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Chia wallet gets in a bad state after I post multiple offers on Dexie then the offers are taken all at once using the combined offer feature of Dexie. The wallet then acts like some of the spent coins remain available and offers completed on-chain still have PENDING_ACCEPT status in my wallet. The debug.log error "Trade for this offer already exists" is raised when the problem happens. The problem still occurs running the Chia 2.0.1 release and looking back in the log I suspect the problem happened running 1.7.x and 1.8.x too. Previously I cleared the problem by deleting the wallet db file and re-syncing because the balance didn't make sense.
I can reproduce the problem myself with the steps below using the CLI. Two wallets (different keys of course) are needed. The maker wallet creates offers and the taker wallet accepts the combined offer created on Dexie.
Using the maker wallet:
Wallet ID 4 is DBX asset ID db1a9020d48d9d4ad22631b66ab4b9ebd3637ef7758ad38881348c5d24c38f20
Create two or more offers to exchange XCH for a CAT such as DBX. The problem will also occur if the CAT is offered and XCH is requested.
On Dexie select the posted offers from the maker wallet to create a single combined offer. Dexie will not allow offers in the "Your Offers" list to be selected for combination. Open Dexie in a private window or hide the offers to be combined on the "Your Offers" page.
Using the taker wallet:
Download the combined offer from Dexie.
Take the combined offer. chia wallet take_offer 0.012XCH_x_6.06DBX.offer
After the combined offer is confirmed verify the new XCH and DBX balances are as expected on the taker wallet.
Using the maker wallet:
Check offer status (chia wallet get_offers -s ) and see only one of the offers from step 1 is now confirmed. The other offers remain with status PENDING_ACCEPT in the wallet but now show Completed status on the Dexie site.
Maker wallet XCH balance is only changed by the amount of the confirmed offer but the DBX balance has increased by the total amount of the offers from step 1. The remaining PENDING_ACCEPT offers will be stuck PENDING_CANCEL or FAILED if canceled with an on-chain transaction but can be canceled using the --insecure option to chia wallet cancel_offer.
New offer files offering XCH can be created but some will be invalid presumably because they include coins are already spent. The invalid offers immediately show Cancelled status if uploaded to Dexie.
The maker wallet can be restored to a good working state with the expected balances by stopping, deleting the wallet db file, then restarting and letting the wallet re-sync.
The Relevant log output contains the error traceback found in the debug.log file.
Version
2.0.1
What platform are you using?
Linux
What ui mode are you using?
CLI
Relevant log output
2023-09-27T22:26:11.428 wallet chia.wallet.wallet_state_manager: ERROR Failed to add coin_state: CoinState { coin: Coin { parent_coin_info: ca640c01bbc42f12be71b6108f4e224d247d0a8a097b54d27681b4d20db272ee, puzzle_hash: 4e632f927766acde8316b334bacb02c7a8cebef9eb79fc3bdcdc5dbb576c947d, amount: 4000000000 }, spent_height: Some(4292383), created_height: Some(4292313) }, error: Trade for this offer already exists.
Traceback (most recent call last):
File "/data/chia/chia-blockchain/chia/wallet/wallet_state_manager.py", line 1301, in _add_coin_states
await self.trade_manager.coins_of_interest_farmed(coin_state, fork_height, peer)
File "/data/chia/chia-blockchain/chia/wallet/trade_manager.py", line 162, in coins_of_interest_farmed
await self.trade_store.set_status(trade.trade_id, TradeStatus.CONFIRMED, height)
File "/data/chia/chia-blockchain/chia/wallet/trading/trade_store.py", line 221, in set_status
await self.add_trade_record(tx, offer_name)
File "/data/chia/chia-blockchain/chia/wallet/trading/trade_store.py", line 164, in add_trade_record
raise ValueError("Trade for this offer already exists.")
ValueError: Trade for this offer already exists.
The text was updated successfully, but these errors were encountered:
@Quexington The fix in PR #16636 solved the problem for me when applied on top of release v2.1.1. The balances in the maker wallet are now correct after offers are taken by a combined offer and all the completed offers have CONFIRMED status as expected.
What happened?
The Chia wallet gets in a bad state after I post multiple offers on Dexie then the offers are taken all at once using the combined offer feature of Dexie. The wallet then acts like some of the spent coins remain available and offers completed on-chain still have PENDING_ACCEPT status in my wallet. The debug.log error "Trade for this offer already exists" is raised when the problem happens. The problem still occurs running the Chia 2.0.1 release and looking back in the log I suspect the problem happened running 1.7.x and 1.8.x too. Previously I cleared the problem by deleting the wallet db file and re-syncing because the balance didn't make sense.
I can reproduce the problem myself with the steps below using the CLI. Two wallets (different keys of course) are needed. The maker wallet creates offers and the taker wallet accepts the combined offer created on Dexie.
Wallet ID 4 is DBX asset ID db1a9020d48d9d4ad22631b66ab4b9ebd3637ef7758ad38881348c5d24c38f20
Create two or more offers to exchange XCH for a CAT such as DBX. The problem will also occur if the CAT is offered and XCH is requested.
chia wallet make_offer -o 1:0.008 --request 4:4.0 -p buydbx_27Sep_1.txt
chia wallet make_offer -o 1:0.004 --request 4:2.0 -p buydbx_27Sep_2.txt
Post the offers on Dexie. The now complete offers on Dexie are visible at the links below.
https://dexie.space/offers/6e2DdZgu4HBNLqjmqTAFMg68MYVaFoqxEaTrvR6N4Ysp
https://dexie.space/offers/2kcvVAbUHzqic3GbfYnoyHD9gTVH5mUfZm8RdEbtNcm3
On Dexie select the posted offers from the maker wallet to create a single combined offer. Dexie will not allow offers in the "Your Offers" list to be selected for combination. Open Dexie in a private window or hide the offers to be combined on the "Your Offers" page.
Download the combined offer from Dexie.
Take the combined offer.
chia wallet take_offer 0.012XCH_x_6.06DBX.offer
After the combined offer is confirmed verify the new XCH and DBX balances are as expected on the taker wallet.
Check offer status (chia wallet get_offers -s ) and see only one of the offers from step 1 is now confirmed. The other offers remain with status PENDING_ACCEPT in the wallet but now show Completed status on the Dexie site.
Maker wallet XCH balance is only changed by the amount of the confirmed offer but the DBX balance has increased by the total amount of the offers from step 1. The remaining PENDING_ACCEPT offers will be stuck PENDING_CANCEL or FAILED if canceled with an on-chain transaction but can be canceled using the --insecure option to chia wallet cancel_offer.
New offer files offering XCH can be created but some will be invalid presumably because they include coins are already spent. The invalid offers immediately show Cancelled status if uploaded to Dexie.
The maker wallet can be restored to a good working state with the expected balances by stopping, deleting the wallet db file, then restarting and letting the wallet re-sync.
The Relevant log output contains the error traceback found in the debug.log file.
Version
2.0.1
What platform are you using?
Linux
What ui mode are you using?
CLI
Relevant log output
The text was updated successfully, but these errors were encountered: