diff --git a/src/main/java/com/iota/iri/service/API.java b/src/main/java/com/iota/iri/service/API.java index c22688120c..26032bcda8 100644 --- a/src/main/java/com/iota/iri/service/API.java +++ b/src/main/java/com/iota/iri/service/API.java @@ -110,7 +110,7 @@ public API(Iota instance, IXI ixi) { } public void init() throws IOException { - readPreviousEpochsSpentAddresses(); + readPreviousEpochsSpentAddresses(testNet); final int apiPort = instance.configuration.integer(DefaultConfSettings.PORT); final String apiHost = instance.configuration.string(DefaultConfSettings.API_HOST); @@ -145,14 +145,18 @@ public void handleRequest(final HttpServerExchange exchange) throws Exception { server.start(); } - private void readPreviousEpochsSpentAddresses() { + private void readPreviousEpochsSpentAddresses(boolean isTestnet) { + if (isTestnet) { + return; + } + if (!SignedFiles.isFileSignatureValid(Configuration.PREVIOUS_EPOCHS_SPENT_ADDRESSES_TXT, Configuration.PREVIOUS_EPOCH_SPENT_ADDRESSES_SIG, Snapshot.SNAPSHOT_PUBKEY, Snapshot.SNAPSHOT_PUBKEY_DEPTH, Snapshot.SPENT_ADDRESSES_INDEX)) { throw new RuntimeException("Failed to load previousEpochsSpentAddresses - signature failed."); } - InputStream in = Snapshot.class.getResourceAsStream("/previousEpochsSpentAddresses.txt"); + InputStream in = Snapshot.class.getResourceAsStream(Configuration.PREVIOUS_EPOCHS_SPENT_ADDRESSES_TXT); BufferedReader reader = new BufferedReader(new InputStreamReader(in)); String line; try {