From 3e2c61d776d28df2f3cf28ec818e95b4a48a13b3 Mon Sep 17 00:00:00 2001 From: Gal Rogozinski Date: Tue, 2 Oct 2018 18:42:22 +0300 Subject: [PATCH] =?UTF-8?q?fix=20milestones=20signatures=20are=20not=20val?= =?UTF-8?q?idated=20on=20testnet=20(since=20config=20=E2=80=A6=20(#1035)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix milestones signatures are not validated on testnet (since config rework) * fix typo in existing test --- src/main/java/com/iota/iri/conf/TestnetConfig.java | 4 ++-- src/test/java/com/iota/iri/conf/ConfigTest.java | 12 ++++++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/iota/iri/conf/TestnetConfig.java b/src/main/java/com/iota/iri/conf/TestnetConfig.java index 0ff59d0eb6..8126dcd82f 100644 --- a/src/main/java/com/iota/iri/conf/TestnetConfig.java +++ b/src/main/java/com/iota/iri/conf/TestnetConfig.java @@ -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; @@ -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"; diff --git a/src/test/java/com/iota/iri/conf/ConfigTest.java b/src/test/java/com/iota/iri/conf/ConfigTest.java index a2d991e6d8..b6af0c4d8d 100644 --- a/src/test/java/com/iota/iri/conf/ConfigTest.java +++ b/src/test/java/com/iota/iri/conf/ConfigTest.java @@ -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" }; @@ -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 @@ -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) {