Skip to content

Commit 9eee4b0

Browse files
committed
Updater: Remove JAR_HASH download
Recent changes broke reproducibility and the last release's JAR_HASH file contains "Dummy file (needed for updater)". We need to keep creating a dummy file because the updater fails without a dummy file. This change fixes the bug.
1 parent f079e26 commit 9eee4b0

File tree

2 files changed

+1
-54
lines changed

2 files changed

+1
-54
lines changed

desktop/src/main/java/bisq/desktop/main/overlays/windows/downloadupdate/BisqInstaller.java

+1-17
Original file line numberDiff line numberDiff line change
@@ -74,16 +74,12 @@ public Optional<DownloadTask> download(String version) {
7474
// tells us which key was used for signing
7575
FileDescriptor signingKeyDescriptor = getSigningKeyDescriptor(partialUrl);
7676

77-
// Hash of jar file inside of the binary
78-
FileDescriptor jarHashDescriptor = getJarHashDescriptor(version, partialUrl);
79-
8077
List<FileDescriptor> keyFileDescriptors = getKeyFileDescriptors();
8178
List<FileDescriptor> sigFileDescriptors = getSigFileDescriptors(installerFileDescriptor, keyFileDescriptors);
8279

8380
List<FileDescriptor> allFiles = Lists.newArrayList();
8481
allFiles.add(installerFileDescriptor);
8582
allFiles.add(signingKeyDescriptor);
86-
allFiles.add(jarHashDescriptor);
8783
allFiles.addAll(keyFileDescriptors);
8884
allFiles.addAll(sigFileDescriptors);
8985

@@ -234,17 +230,6 @@ private FileDescriptor getSigningKeyDescriptor(String url) {
234230
.build();
235231
}
236232

237-
@NotNull
238-
private FileDescriptor getJarHashDescriptor(String version, String partialUrl) {
239-
String fileName = "Bisq-" + version + ".jar.txt";
240-
return FileDescriptor.builder()
241-
.type(DownloadType.JAR_HASH)
242-
.fileName(fileName)
243-
.id(fileName)
244-
.loadUrl(partialUrl.concat(fileName))
245-
.build();
246-
}
247-
248233
/**
249234
* The files containing the gpg keys of the bisq signers.
250235
* Currently these are 2 hard-coded keys, one included with bisq and the same key online for maximum security.
@@ -342,8 +327,7 @@ public enum DownloadType {
342327
KEY,
343328
SIG,
344329
SIGNING_KEY,
345-
MISC,
346-
JAR_HASH
330+
MISC
347331
}
348332
}
349333

desktop/src/main/java/bisq/desktop/main/overlays/windows/downloadupdate/DisplayUpdateDownloadWindow.java

-37
Original file line numberDiff line numberDiff line change
@@ -51,18 +51,12 @@
5151

5252
import javafx.beans.value.ChangeListener;
5353

54-
import java.nio.file.Path;
55-
import java.nio.file.Paths;
56-
5754
import java.io.File;
58-
import java.io.FileReader;
5955
import java.io.IOException;
60-
import java.io.PrintWriter;
6156

6257
import java.util.ArrayList;
6358
import java.util.List;
6459
import java.util.Optional;
65-
import java.util.Scanner;
6660

6761
import lombok.extern.slf4j.Slf4j;
6862

@@ -232,11 +226,6 @@ private void addContent() {
232226
log.debug("Download completed successfully.");
233227
downloadedFilesLabel.getStyleClass().add("success-text");
234228

235-
downloadTask.getFileDescriptors().stream()
236-
.filter(fileDescriptor -> fileDescriptor.getType() == BisqInstaller.DownloadType.JAR_HASH)
237-
.findFirst()
238-
.ifPresent(this::copyJarHashToDataDir);
239-
240229
verifyTask = installer.verify(downloadResults);
241230
verifiedSigLabel.setOpacity(1);
242231

@@ -286,32 +275,6 @@ private void addContent() {
286275
});
287276
}
288277

289-
private void copyJarHashToDataDir(BisqInstaller.FileDescriptor fileDescriptor) {
290-
StringBuilder sb = new StringBuilder();
291-
final File sourceFile = fileDescriptor.getSaveFile();
292-
try (Scanner scanner = new Scanner(new FileReader(sourceFile))) {
293-
while (scanner.hasNext()) {
294-
sb.append(scanner.next());
295-
}
296-
scanner.close();
297-
final String hashOfJar = sb.toString();
298-
299-
Path path = Paths.get(config.appDataDir.getPath(), fileDescriptor.getFileName());
300-
final String target = path.toString();
301-
try (PrintWriter writer = new PrintWriter(target, "UTF-8")) {
302-
writer.println(hashOfJar);
303-
writer.close();
304-
log.info("Copied hash of jar from {} to {}", sourceFile.getAbsolutePath(), target);
305-
} catch (Exception e) {
306-
log.error(e.toString());
307-
e.printStackTrace();
308-
}
309-
} catch (Exception e) {
310-
log.error(e.toString());
311-
e.printStackTrace();
312-
}
313-
}
314-
315278
@Override
316279
protected void addButtons() {
317280
closeButton = new AutoTooltipButton(Res.get("displayUpdateDownloadWindow.button.ignoreDownload"));

0 commit comments

Comments
 (0)