Skip to content

Commit

Permalink
temporarily deprecated and disabled tests for HASH_160 and HASH-256
Browse files Browse the repository at this point in the history
since HASH_160 and HASH-256 do not work at the moment I have disabled
the tests and deprecated those two hash functions

Raised issue #26 to restore this functionality when server has proper
support
  • Loading branch information
tonowie committed May 11, 2019
1 parent e6452e3 commit e66128d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 12 deletions.
5 changes: 5 additions & 0 deletions src/integration-test/java/io/proximax/sdk/E2ESecretTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

import org.apache.commons.codec.binary.Hex;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestInstance;
import org.slf4j.Logger;
Expand Down Expand Up @@ -70,11 +71,13 @@ void standaloneSecretLockAndProofTransaction_KECCAK_256() throws ExecutionExcept
}

@Test
@Disabled("not supported at the moment")
void standaloneSecretLockAndProofTransaction_HASH_160() throws ExecutionException, InterruptedException {
standaloneSecretLockAndProofTransaction(seedAccount, simpleAccount.getAddress(), HashType.HASH_160);
}

@Test
@Disabled("not supported at the moment")
void standaloneSecretLockAndProofTransaction_HASH_256() throws ExecutionException, InterruptedException {
standaloneSecretLockAndProofTransaction(seedAccount, simpleAccount.getAddress(), HashType.HASH_256);
}
Expand Down Expand Up @@ -118,11 +121,13 @@ void aggregateSecretLockandProofTransaction_KECCAK_256() {
}

@Test
@Disabled("not supported at the moment")
void aggregateSecretLockAndProofTransaction_HASH_160() {
aggregateSecretLockAndProofTransaction(seedAccount, simpleAccount.getAddress(), HashType.HASH_160);
}

@Test
@Disabled("not supported at the moment")
void aggregateSecretLockAndProofTransaction_HASH_256() {
aggregateSecretLockAndProofTransaction(seedAccount, simpleAccount.getAddress(), HashType.HASH_256);
}
Expand Down
22 changes: 10 additions & 12 deletions src/main/java/io/proximax/sdk/model/transaction/HashType.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,16 @@ public enum HashType {
/**
* hashed twice: first with SHA-256 and then with RIPEMD-160
* (BTC Compat)
* @deprecated This is currently not supported by Sirius platform
*/
@Deprecated
HASH_160(2, Hashes::hash160, "-?[0-9a-fA-F]+", 40),
/**
* Hashed twice with SHA-256
* (BTC Compat)
* @deprecated This is currently not supported by Sirius platform
*/
@Deprecated
HASH_256(3, Hashes::hash256,"-?[0-9a-fA-F]+", 64);

private final int value;
Expand All @@ -65,18 +69,12 @@ public enum HashType {
* @return hash type or throw IllegalArgumentException
*/
public static HashType rawValueOf(int value) {
switch (value) {
case 0:
return HashType.SHA3_256;
case 1:
return HashType.KECCAK_256;
case 2:
return HashType.HASH_160;
case 3:
return HashType.HASH_256;
default:
throw new IllegalArgumentException(value + " is not a valid hash type code");
}
for (HashType type : HashType.values()) {
if (value == type.value) {
return type;
}
}
throw new IllegalArgumentException("Unsupported hash type code " + value);
}

/**
Expand Down

0 comments on commit e66128d

Please sign in to comment.