Browse Source

We (currently) can't filter unconfirmed transactions by address, because only the public key is stored in the database until it is confirmed (at which point there is an entry in the TransactionParticipants table which contains the address). Given that this isn't a simple problem to solve, for now it makes sense to reject this combination if requested via the /transactions/search API.

block-minter-updates
CalDescent 3 years ago
parent
commit
7aed0354f1
  1. 4
      src/main/java/org/qortal/api/resource/TransactionsResource.java

4
src/main/java/org/qortal/api/resource/TransactionsResource.java

@ -349,6 +349,10 @@ public class TransactionsResource {
if (confirmationStatus != ConfirmationStatus.CONFIRMED && (startBlock != null || blockLimit != null))
throw ApiExceptionFactory.INSTANCE.createException(request, ApiError.INVALID_CRITERIA);
// You can't ask for unconfirmed and filter by address (due to only public key being stored when unconfirmed)
if (confirmationStatus != ConfirmationStatus.CONFIRMED && address != null && !address.isEmpty())
throw ApiExceptionFactory.INSTANCE.createException(request, ApiError.INVALID_CRITERIA);
try (final Repository repository = RepositoryManager.getRepository()) {
List<byte[]> signatures = repository.getTransactionRepository().getSignaturesMatchingCriteria(startBlock, blockLimit, txGroupId,
txTypes, null, null, address, confirmationStatus, limit, offset, reverse);

Loading…
Cancel
Save