Skip to content

Commit 8e882cb

Browse files
committed
Also refactor name in download
1 parent b18a90d commit 8e882cb

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

downloadCurrentVersion.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@ function getVersionList (cb) {
2525
});
2626
}
2727

28-
function downloadBinary (version, expectedHash) {
28+
function downloadBinary (outputName, version, expectedHash) {
2929
console.log('Downloading version', version);
3030

31-
var file = fs.createWriteStream('soljson.js');
31+
var file = fs.createWriteStream(outputName);
3232
https.get('https://ethereum.github.io/solc-bin/bin/' + version, function (response) {
3333
if (response.statusCode !== 200) {
3434
console.log('Error downloading file: ' + response.statusCode);
@@ -37,7 +37,7 @@ function downloadBinary (version, expectedHash) {
3737
response.pipe(file);
3838
file.on('finish', function () {
3939
file.close(function () {
40-
var hash = '0x' + ethJSUtil.sha3(fs.readFileSync('soljson.js')).toString('hex');
40+
var hash = '0x' + ethJSUtil.sha3(fs.readFileSync(outputName)).toString('hex');
4141
if (expectedHash !== hash) {
4242
console.log('Hash mismatch: ' + expectedHash + ' vs ' + hash);
4343
process.exit(1);
@@ -55,5 +55,5 @@ getVersionList(function (list) {
5555
var wanted = pkg.version.match(/^(\d+\.\d+\.\d+)$/)[1];
5656
var releaseFileName = list.releases[wanted];
5757
var expectedHash = list.builds.filter(function (entry) { return entry.path === releaseFileName; })[0].keccak256;
58-
downloadBinary(releaseFileName, expectedHash);
58+
downloadBinary('soljson.js', releaseFileName, expectedHash);
5959
});

0 commit comments

Comments
 (0)