diff --git a/src/main/java/com/iota/iri/service/API.java b/src/main/java/com/iota/iri/service/API.java index 14b1fd3ed3..8c84e071e3 100644 --- a/src/main/java/com/iota/iri/service/API.java +++ b/src/main/java/com/iota/iri/service/API.java @@ -907,7 +907,7 @@ private AbstractResponse getNodeInfoStatement() throws Exception{ instance.tipsViewModel.size(), instance.transactionRequester.numberOfTransactionsToRequest(), features, - instance.configuration.getCoordinator()); + instance.configuration.getCoordinator().toString()); } /** diff --git a/src/main/java/com/iota/iri/service/milestone/impl/LatestMilestoneTrackerImpl.java b/src/main/java/com/iota/iri/service/milestone/impl/LatestMilestoneTrackerImpl.java index be90f6453f..6ac95b9bdb 100644 --- a/src/main/java/com/iota/iri/service/milestone/impl/LatestMilestoneTrackerImpl.java +++ b/src/main/java/com/iota/iri/service/milestone/impl/LatestMilestoneTrackerImpl.java @@ -139,7 +139,7 @@ public LatestMilestoneTrackerImpl init(Tangle tangle, SnapshotProvider snapshotP this.milestoneService = milestoneService; this.milestoneSolidifier = milestoneSolidifier; - coordinatorAddress = HashFactory.ADDRESS.create(config.getCoordinator()); + coordinatorAddress = config.getCoordinator(); bootstrapLatestMilestoneValue(); diff --git a/src/main/java/com/iota/iri/service/spentaddresses/impl/SpentAddressesServiceImpl.java b/src/main/java/com/iota/iri/service/spentaddresses/impl/SpentAddressesServiceImpl.java index 136bc566fb..0048dee6cc 100644 --- a/src/main/java/com/iota/iri/service/spentaddresses/impl/SpentAddressesServiceImpl.java +++ b/src/main/java/com/iota/iri/service/spentaddresses/impl/SpentAddressesServiceImpl.java @@ -227,7 +227,7 @@ private void checkAddresses(Collection addressesToCheck, Collection } private Set getInitialUnspentAddresses() { - return Stream.of(Hash.NULL_HASH, HashFactory.ADDRESS.create(config.getCoordinator())) + return Stream.of(Hash.NULL_HASH, config.getCoordinator()) .collect(Collectors.toSet()); } } diff --git a/src/test/java/com/iota/iri/conf/ConfigFactoryTest.java b/src/test/java/com/iota/iri/conf/ConfigFactoryTest.java index ff705a6de8..aac121837f 100644 --- a/src/test/java/com/iota/iri/conf/ConfigFactoryTest.java +++ b/src/test/java/com/iota/iri/conf/ConfigFactoryTest.java @@ -1,5 +1,8 @@ package com.iota.iri.conf; +import com.iota.iri.model.Hash; +import com.iota.iri.model.HashFactory; + import org.junit.Rule; import org.junit.Test; import org.junit.rules.TemporaryFolder; @@ -113,7 +116,8 @@ public void createFromFileTestnetWithTestnetFalseAndFalse() throws IOException { public void createFromFileTestnetWithTrailingSpaces() throws IOException { File configFile = createTestnetConfigFile("true"); IotaConfig iotaConfig = ConfigFactory.createFromFile(configFile, true); - String expected = "NPCRMHDOMU9QHFFBKFCWFHFJNNQDRNDOGVPEVDVGWKHFUFEXLWJBHXDJFKQGYFRDZBQIFDSJMUCCQVICI"; + Hash expected = HashFactory.ADDRESS.create( + "NPCRMHDOMU9QHFFBKFCWFHFJNNQDRNDOGVPEVDVGWKHFUFEXLWJBHXDJFKQGYFRDZBQIFDSJMUCCQVICI"); assertEquals("Expected that leading and trailing spaces were trimmed.", expected, iotaConfig.getCoordinator()); } diff --git a/src/test/java/com/iota/iri/conf/ConfigTest.java b/src/test/java/com/iota/iri/conf/ConfigTest.java index a4ef561dd3..f865147f8e 100644 --- a/src/test/java/com/iota/iri/conf/ConfigTest.java +++ b/src/test/java/com/iota/iri/conf/ConfigTest.java @@ -3,6 +3,8 @@ import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.databind.PropertyNamingStrategy; + +import com.iota.iri.model.HashFactory; import com.iota.iri.utils.IotaUtils; import org.apache.commons.io.FileUtils; import org.apache.commons.lang3.ArrayUtils; @@ -177,7 +179,7 @@ public void testArgsParsingTestnet() { Assert.assertEquals("db path", "/db", iotaConfig.getDbPath()); Assert.assertEquals("zmq enabled", true, iotaConfig.isZmqEnabled()); Assert.assertEquals("mwm", 4, iotaConfig.getMwm()); - Assert.assertEquals("coo", "TTTTTTTTT", iotaConfig.getCoordinator()); + Assert.assertEquals("coo", HashFactory.ADDRESS.create("TTTTTTTTT"), iotaConfig.getCoordinator()); Assert.assertEquals("--testnet-no-coo-validation", true, iotaConfig.isDontValidateTestnetMilestoneSig()); } diff --git a/src/test/java/com/iota/iri/service/NodeIntegrationTests.java b/src/test/java/com/iota/iri/service/NodeIntegrationTests.java index 7ae9976f2c..47c93ad2c2 100644 --- a/src/test/java/com/iota/iri/service/NodeIntegrationTests.java +++ b/src/test/java/com/iota/iri/service/NodeIntegrationTests.java @@ -140,7 +140,7 @@ private void newMilestone(API api, List tips, long index) throws Exception transactions.add(new byte[TRINARY_SIZE]); Converter.copyTrits(index, transactions.get(0), OBSOLETE_TAG_TRINARY_OFFSET, OBSOLETE_TAG_TRINARY_SIZE); transactions.add(Arrays.copyOf(transactions.get(0), TRINARY_SIZE)); - Hash coordinator = HashFactory.ADDRESS.create(new TestnetConfig().getCoordinator()); + Hash coordinator = new TestnetConfig().getCoordinator(); System.arraycopy(coordinator.trits(), 0, transactions.get(0), ADDRESS_TRINARY_OFFSET, ADDRESS_TRINARY_SIZE); setBundleHash(transactions, null); List elements = api.attachToTangleStatement(tips.get(0), tips.get(0), 13, transactions.stream().map(Converter::trytes).collect(Collectors.toList()));