Skip to content

Allow same-node Alice tradebot entries for AT offers#293

Open
QuickMythril wants to merge 1 commit intoQortal:masterfrom
QuickMythril:bugfix/same-node-trades
Open

Allow same-node Alice tradebot entries for AT offers#293
QuickMythril wants to merge 1 commit intoQortal:masterfrom
QuickMythril:bugfix/same-node-trades

Conversation

@QuickMythril
Copy link

Summary

This fixes the “same-node buy fails for a different local account” bug (#292). Today, any local trade-bot entry for an AT blocks a response, so Bob’s offer entry prevents a different account on the same node from accepting the offer. That’s a node-local guard and not account-aware, which is why same-node trades fail.

Reason for fix

We only need to prevent multiple concurrent Alice responses for the same AT. A Bob offer and a single Alice response can coexist safely. Scoping the guard to active ALICE entries preserves the safety invariant while allowing same-node trades.

Changes

  • src/main/java/org/qortal/repository/CrossChainRepository.java: add existsAliceTradeWithAtExcludingStates(...) to support ALICE-only checks.
  • src/main/java/org/qortal/repository/hsqldb/HSQLDBCrossChainRepository.java: implement ALICE-only existence query using trade_state LIKE 'ALICE_%' while still excluding end states.
  • src/main/java/org/qortal/controller/tradebot/TradeBot.java: use the ALICE-only guard in startResponse and startResponseMultiple so Bob’s entry no longer blocks a same-node Alice response.
  • src/test/java/org/qortal/test/CrossChainRepositoryTests.java: add coverage ensuring Bob-only does not block, active Alice does block, and Alice end-state no longer blocks.

Tests

  • mvn -q -Dtest=CrossChainRepositoryTests test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant