Skip to content
This repository was archived by the owner on Aug 23, 2020. It is now read-only.

Commit 7265075

Browse files
authored
Fix: remove threshold from getBalances API call (#1768)
1 parent b38b4cc commit 7265075

File tree

2 files changed

+2
-13
lines changed

2 files changed

+2
-13
lines changed

src/main/java/com/iota/iri/service/API.java

+2-12
Original file line numberDiff line numberDiff line change
@@ -1059,20 +1059,12 @@ public AbstractResponse broadcastTransactionsStatement(List<String> trytes) {
10591059
*
10601060
* @param addresses Address for which to get the balance (do not include the checksum)
10611061
* @param tips The optional tips to find the balance through.
1062-
* @param threshold The confirmation threshold between 0 and 100(inclusive).
1063-
* Should be set to 100 for getting balance by counting only confirmed transactions.
10641062
* @return {@link com.iota.iri.service.dto.GetBalancesResponse}
10651063
* @throws Exception When the database has encountered an error
10661064
**/
10671065
@Document(name="getBalances")
10681066
private AbstractResponse getBalancesStatement(List<String> addresses,
1069-
List<String> tips,
1070-
int threshold) throws Exception {
1071-
1072-
if (threshold <= 0 || threshold > 100) {
1073-
return ErrorResponse.create("Illegal 'threshold'");
1074-
}
1075-
1067+
List<String> tips) throws Exception {
10761068
final List<Hash> addressList = addresses.stream()
10771069
.map(address -> (HashFactory.ADDRESS.create(address)))
10781070
.collect(Collectors.toCollection(LinkedList::new));
@@ -1527,10 +1519,8 @@ private Function<Map<String, Object>, AbstractResponse> getBalances() {
15271519
final List<String> tips = request.containsKey("tips") ?
15281520
getParameterAsList(request,"tips", HASH_SIZE):
15291521
null;
1530-
final int threshold = getParameterAsInt(request, "threshold");
1531-
15321522
try {
1533-
return getBalancesStatement(addresses, tips, threshold);
1523+
return getBalancesStatement(addresses, tips);
15341524
} catch (Exception e) {
15351525
throw new IllegalStateException(e);
15361526
}

src/test/java/com/iota/iri/service/APIIntegrationTests.java

-1
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,6 @@ public void shouldTestGetBalances() {
358358
final Map<String, Object> request = new HashMap<>();
359359
request.put("command", "getBalances");
360360
request.put("addresses", ADDRESSES);
361-
request.put("threshold", 100);
362361

363362
given().
364363
body(gson().toJson(request)).

0 commit comments

Comments
 (0)