remove (security > 3) checks

This commit is contained in:
Andreas C. Osowski 2017-11-06 00:20:05 +01:00
parent 022f1665aa
commit a316f05df3
2 changed files with 14 additions and 9 deletions

View File

@ -52,7 +52,7 @@ public class IotaAPI extends IotaAPICore {
*/
public GetNewAddressResponse getNewAddress(final String seed, int security, final int index, final boolean checksum, final int total, final boolean returnAll) throws InvalidSecurityLevelException, InvalidAddressException {
if (security < 1 || security > 3) {
if (security < 1) {
throw new InvalidSecurityLevelException();
}
@ -114,7 +114,7 @@ public class IotaAPI extends IotaAPICore {
throw new IllegalStateException("Invalid Seed");
}
if (security < 1 || security > 3) {
if (security < 1) {
throw new InvalidSecurityLevelException();
}
@ -372,7 +372,7 @@ public class IotaAPI extends IotaAPICore {
throw new IllegalStateException("Invalid Seed");
}
if (security < 1 || security > 3) {
if (security < 1) {
throw new InvalidSecurityLevelException();
}
@ -531,7 +531,7 @@ public class IotaAPI extends IotaAPICore {
throw new IllegalStateException("Invalid Seed");
}
if (security < 1 || security > 3) {
if (security < 1) {
throw new InvalidSecurityLevelException();
}
@ -582,7 +582,7 @@ public class IotaAPI extends IotaAPICore {
**/
public GetBalancesAndFormatResponse getBalanceAndFormat(final List<String> addresses, long threshold, int start, int end, StopWatch stopWatch, int security) throws InvalidSecurityLevelException {
if (security < 1 || security > 3) {
if (security < 1) {
throw new InvalidSecurityLevelException();
}
@ -817,7 +817,7 @@ public class IotaAPI extends IotaAPICore {
*/
public SendTransferResponse sendTransfer(String seed, int security, int depth, int minWeightMagnitude, final List<Transfer> transfers, Input[] inputs, String remainderAddress) throws NotEnoughBalanceException, InvalidSecurityLevelException, InvalidTrytesException, InvalidAddressException, InvalidTransferException {
if (security < 1 || security > 3) {
if (security < 1) {
throw new InvalidSecurityLevelException();
}

View File

@ -36,9 +36,14 @@ public class SigningTest {
Signing signing = new Signing(curl);
String seed = "EV9QRJFJZVFNLYUFXWKXMCRRPNAZYQVEYB9VEPUHQNXJCWKZFVUCTQJFCUAMXAHMMIUQUJDG9UGGQBPIY";
int[] key1 = signing.key(Converter.trits(seed), 0, 1);
int[] key2 = signing.key(Converter.trits(seed+seed), 0, 1);
int[] key3 = signing.key(Converter.trits(seed+seed+seed), 0, 1);
for(int i = 1; i < 5; i++) {
int[] key1 = signing.key(Converter.trits(seed), 0, i);
assertEquals(Signing.KEY_LENGTH * i, key1.length);
int[] key2 = signing.key(Converter.trits(seed + seed), 0, i);
assertEquals(Signing.KEY_LENGTH * i, key2.length );
int[] key3 = signing.key(Converter.trits(seed + seed + seed), 0, i);
assertEquals(Signing.KEY_LENGTH * i, key3.length );
}
}
@Test