@@ -228,6 +228,9 @@ async def respond_to_offer(self, file_path: Path) -> bool:
228228 ] = await self .wallet_state_manager .get_wallet_for_colour (
229229 colour
230230 )
231+ unspent = await self .wallet_state_manager .get_spendable_coins_for_wallet (wallets [colour ].wallet_info .id )
232+ if coinsol .coin in [record .coin for record in unspent ]:
233+ return False , "can't respond to own offer"
231234 innerpuzzlereveal = solution .rest ().rest ().rest ().first ()
232235 innersol = solution .rest ().rest ().rest ().rest ().first ()
233236 out_amount = cc_wallet_puzzles .get_output_amount_for_puzzle_and_solution (
@@ -267,6 +270,9 @@ async def respond_to_offer(self, file_path: Path) -> bool:
267270 coinsols .append (coinsol )
268271 else :
269272 # standard chia coin
273+ unspent = await self .wallet_state_manager .get_spendable_coins_for_wallet (1 )
274+ if coinsol .coin in [record .coin for record in unspent ]:
275+ return False , "can't respond to own offer"
270276 if chia_discrepancy is None :
271277 chia_discrepancy = cc_wallet_puzzles .get_output_discrepancy_for_puzzle_and_solution (
272278 coinsol .coin , puzzle , solution
@@ -309,7 +315,7 @@ async def respond_to_offer(self, file_path: Path) -> bool:
309315 my_cc_spends .add (add )
310316
311317 if my_cc_spends == set () or my_cc_spends is None :
312- return False
318+ return False , "insufficient funds"
313319
314320 auditor = my_cc_spends .pop ()
315321 auditor_inner_puzzle = await self .get_inner_puzzle_for_puzzle_hash (
@@ -570,4 +576,4 @@ async def respond_to_offer(self, file_path: Path) -> bool:
570576 for tx in my_tx_records :
571577 await self .wallet_state_manager .add_transaction (tx )
572578
573- return True
579+ return True , None
0 commit comments