@@ -25,10 +25,10 @@ function getVersionList (cb) {
25
25
} ) ;
26
26
}
27
27
28
- function downloadBinary ( version , expectedHash ) {
28
+ function downloadBinary ( outputName , version , expectedHash ) {
29
29
console . log ( 'Downloading version' , version ) ;
30
30
31
- var file = fs . createWriteStream ( 'soljson.js' ) ;
31
+ var file = fs . createWriteStream ( outputName ) ;
32
32
https . get ( 'https://ethereum.github.io/solc-bin/bin/' + version , function ( response ) {
33
33
if ( response . statusCode !== 200 ) {
34
34
console . log ( 'Error downloading file: ' + response . statusCode ) ;
@@ -37,7 +37,7 @@ function downloadBinary (version, expectedHash) {
37
37
response . pipe ( file ) ;
38
38
file . on ( 'finish' , function ( ) {
39
39
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' ) ;
41
41
if ( expectedHash !== hash ) {
42
42
console . log ( 'Hash mismatch: ' + expectedHash + ' vs ' + hash ) ;
43
43
process . exit ( 1 ) ;
@@ -55,5 +55,5 @@ getVersionList(function (list) {
55
55
var wanted = pkg . version . match ( / ^ ( \d + \. \d + \. \d + ) $ / ) [ 1 ] ;
56
56
var releaseFileName = list . releases [ wanted ] ;
57
57
var expectedHash = list . builds . filter ( function ( entry ) { return entry . path === releaseFileName ; } ) [ 0 ] . keccak256 ;
58
- downloadBinary ( releaseFileName , expectedHash ) ;
58
+ downloadBinary ( 'soljson.js' , releaseFileName , expectedHash ) ;
59
59
} ) ;
0 commit comments