Chia-Network / chia-blockchain

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

[Bug] Can't accept self-created offer files #14892

Open HarveyPeachey opened 1 year ago

HarveyPeachey commented 1 year ago

What happened?

I was attempting to test Dexie's websocket protocol using testnet and tried to self-accept an NFT offer to test the emitting mechanism, however, I get an error in the GUI stating Trade for this offer already exists.. I have also encountered the same error using the Wallet RPC take_offer.

I've asked about this in the support channel on Keybase, and a kind Kiwi asked the engineering team, and said:

the offer accept code was modified to add checks to ensure you don't accept the same offer twice. I appears the code is looking at all transactions so it's seeing both the offer and the accept and seeing it as a duplicate transaction, hence the message

However, I would like the ability back to self-accept offers for testing purposes, even if it's just on testnet as I think this was an unintentional consequence of the aforementioned changes.

Version

1.7.1

What platform are you using?

Windows

What ui mode are you using?

GUI

Relevant log output

Error
Trade for this offer already exists.
MumfMeisterT commented 1 year ago

Are you offering an NFT? And what are you asking for in return for the offer?

paninaro commented 1 year ago

Snippet from my debug log:

  File "/Users/jeffc/src/macos/chia-blockchain/chia/rpc/rpc_server.py", line 340, in safe_handle
    response = await self.ws_api(message)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/jeffc/src/macos/chia-blockchain/chia/rpc/rpc_server.py", line 331, in ws_api
    return await f_rpc_api(data)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/Users/jeffc/src/macos/chia-blockchain/chia/rpc/wallet_rpc_api.py", line 1688, in take_offer
    trade_record, tx_records = await self.service.wallet_state_manager.trade_manager.respond_to_offer(
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/jeffc/src/macos/chia-blockchain/chia/wallet/trade_manager.py", line 788, in respond_to_offer
    await self.save_trade(trade_record, offer.name())
  File "/Users/jeffc/src/macos/chia-blockchain/chia/wallet/trade_manager.py", line 386, in save_trade
    await self.trade_store.add_trade_record(trade, offer_name)
  File "/Users/jeffc/src/macos/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.
HarveyPeachey commented 1 year ago

Are you offering an NFT? And what are you asking for in return for the offer?

Offering an NFT for XCH