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

Commit

Permalink
fix milestones signatures are not validated on testnet (since config … (
Browse files Browse the repository at this point in the history
#1035)

* fix milestones signatures are not validated on testnet (since config rework)

* fix typo in existing test
  • Loading branch information
GalRogozinski authored Oct 2, 2018
1 parent c32ee24 commit 3e2c61d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/main/java/com/iota/iri/conf/TestnetConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
public class TestnetConfig extends BaseIotaConfig {

protected String coordinator = Defaults.COORDINATOR_ADDRESS;
protected boolean dontValidateTestnetMilestoneSig = Defaults.VALIDATE_MILESTONE_SIG;
protected boolean dontValidateTestnetMilestoneSig = Defaults.DONT_VALIDATE_MILESTONE_SIG;
protected String snapshotFile = Defaults.SNAPSHOT_FILE;
protected String snapshotSignatureFile = Defaults.SNAPSHOT_SIG;
protected long snapshotTime = Defaults.SNAPSHOT_TIME;
Expand Down Expand Up @@ -160,7 +160,7 @@ public void setDbLogPath(String dbLogPath) {

public interface Defaults {
String COORDINATOR_ADDRESS = "EQQFCZBIHRHWPXKMTOLMYUYPCN9XLMJPYZVFJSAY9FQHCCLWTOLLUGKKMXYFDBOOYFBLBI9WUEILGECYM";
boolean VALIDATE_MILESTONE_SIG = true;
boolean DONT_VALIDATE_MILESTONE_SIG = false;
String SNAPSHOT_FILE = "/snapshotTestnet.txt";
int REQUEST_HASH_SIZE = 49;
String SNAPSHOT_SIG = "/snapshotTestnet.sig";
Expand Down
12 changes: 10 additions & 2 deletions src/test/java/com/iota/iri/conf/ConfigTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ public void testArgsParsingTestnet() {
//we ignore this on mainnet
"--mwm", "4",
"--testnet-coordinator", "TTTTTTTTT",
"--test-no-coo-validation",
"--testnet-no-coo-validation",
//this should be ignored everywhere
"--fake-config"
};
Expand Down Expand Up @@ -173,7 +173,8 @@ public void testArgsParsingTestnet() {
Assert.assertEquals("zmq enabled", true, iotaConfig.isZmqEnabled());
Assert.assertEquals("mwm", 4, iotaConfig.getMwm());
Assert.assertEquals("coo", "TTTTTTTTT", iotaConfig.getCoordinator());
Assert.assertEquals("--test-no-coo-validation", true, iotaConfig.isDontValidateTestnetMilestoneSig());
Assert.assertEquals("--testnet-no-coo-validation", true,
iotaConfig.isDontValidateTestnetMilestoneSig());
}

@Test
Expand Down Expand Up @@ -278,6 +279,13 @@ public void backwardsIniCompatibilityTest() {
Assert.assertThat(configNames, IsCollectionContaining.hasItem(config)));
}

@Test
public void testDontValidateMIlestoneSigDefaultValue() {
IotaConfig iotaConfig = ConfigFactory.createIotaConfig(true);
Assert.assertFalse("By default testnet should be validating milestones",
iotaConfig.isDontValidateTestnetMilestoneSig());
}

private String deriveNameFromSetter(Method setter) {
JsonIgnore jsonIgnore = setter.getAnnotation(JsonIgnore.class);
if (jsonIgnore != null) {
Expand Down

0 comments on commit 3e2c61d

Please sign in to comment.