forked from Qortal/qortal
Fixed bug in GET /crosschain/price/{blockchain} inverse price API endpoint when the "inverse" parameter is null.
This commit is contained in:
parent
098d7baa4d
commit
0dcd2e6e93
@ -283,6 +283,7 @@ public class CrossChainResource {
|
|||||||
int maximumCount = maxtrades != null ? maxtrades : 10;
|
int maximumCount = maxtrades != null ? maxtrades : 10;
|
||||||
long minimumPeriod = 4 * 60 * 60 * 1000L; // ms
|
long minimumPeriod = 4 * 60 * 60 * 1000L; // ms
|
||||||
Boolean isFinished = Boolean.TRUE;
|
Boolean isFinished = Boolean.TRUE;
|
||||||
|
boolean useInversePrice = (inverse != null && inverse == true);
|
||||||
|
|
||||||
try (final Repository repository = RepositoryManager.getRepository()) {
|
try (final Repository repository = RepositoryManager.getRepository()) {
|
||||||
Map<ByteArray, Supplier<ACCT>> acctsByCodeHash = SupportedBlockchain.getFilteredAcctMap(foreignBlockchain);
|
Map<ByteArray, Supplier<ACCT>> acctsByCodeHash = SupportedBlockchain.getFilteredAcctMap(foreignBlockchain);
|
||||||
@ -304,7 +305,7 @@ public class CrossChainResource {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return inverse ? Amounts.scaledDivide(totalForeign, totalQort) : Amounts.scaledDivide(totalQort, totalForeign);
|
return useInversePrice ? Amounts.scaledDivide(totalForeign, totalQort) : Amounts.scaledDivide(totalQort, totalForeign);
|
||||||
} catch (DataException e) {
|
} catch (DataException e) {
|
||||||
throw ApiExceptionFactory.INSTANCE.createException(request, ApiError.REPOSITORY_ISSUE, e);
|
throw ApiExceptionFactory.INSTANCE.createException(request, ApiError.REPOSITORY_ISSUE, e);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user