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

Commit

Permalink
Fix type change of getCoordinator
Browse files Browse the repository at this point in the history
  • Loading branch information
Gal Rogozinski committed Feb 18, 2019
1 parent 9135f7a commit 0b2698c
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/main/java/com/iota/iri/service/API.java
Original file line number Diff line number Diff line change
Expand Up @@ -907,7 +907,7 @@ private AbstractResponse getNodeInfoStatement() throws Exception{
instance.tipsViewModel.size(),
instance.transactionRequester.numberOfTransactionsToRequest(),
features,
instance.configuration.getCoordinator());
instance.configuration.getCoordinator().toString());
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ private void checkAddresses(Collection<Hash> addressesToCheck, Collection<Hash>
}

private Set<Hash> getInitialUnspentAddresses() {
return Stream.of(Hash.NULL_HASH, HashFactory.ADDRESS.create(config.getCoordinator()))
return Stream.of(Hash.NULL_HASH, config.getCoordinator())
.collect(Collectors.toSet());
}
}
6 changes: 5 additions & 1 deletion src/test/java/com/iota/iri/conf/ConfigFactoryTest.java
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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());
}

Expand Down
4 changes: 3 additions & 1 deletion src/test/java/com/iota/iri/conf/ConfigTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ private void newMilestone(API api, List<Hash> 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<String> elements = api.attachToTangleStatement(tips.get(0), tips.get(0), 13, transactions.stream().map(Converter::trytes).collect(Collectors.toList()));
Expand Down

0 comments on commit 0b2698c

Please sign in to comment.