@@ -114,6 +114,25 @@ function validateBitcoinRunnerConfig(bitcoinConf, configs){
114114 }
115115} ;
116116
117+ async function printPowpegJarSha256 ( ) {
118+ const jarPath = process . env . POWPEG_NODE_JAR_PATH ;
119+ if ( ! jarPath ) return ;
120+ try {
121+ console . log ( `Computing sha256 for powpeg node jar (POWPEG_NODE_JAR_PATH): ${ jarPath } ...` ) ;
122+ const hash = crypto . createHash ( 'sha256' ) ;
123+ const stream = fs . createReadStream ( jarPath ) ;
124+ await new Promise ( ( resolve , reject ) => {
125+ stream . on ( 'data' , ( chunk ) => hash . update ( chunk ) ) ;
126+ stream . on ( 'end' , resolve ) ;
127+ stream . on ( 'error' , reject ) ;
128+ } ) ;
129+ console . log ( `Powpeg node jar sha256: ${ hash . digest ( 'hex' ) } ` ) ;
130+ console . log ( "" ) ;
131+ } catch ( e ) {
132+ console . log ( `Could not compute sha256 for powpeg node jar (${ jarPath } ): ${ e . message } ` ) ;
133+ }
134+ }
135+
117136process . on ( 'SIGTERM' , function ( ) {
118137 process . stdout . write ( "\nGracefully shutting down from SIGTERM." ) ;
119138 shutdownHooks ( ) ;
@@ -140,22 +159,7 @@ before(async () => {
140159 const runnersConfig = config . runners || { } ;
141160 const initConfig = config . init || { } ;
142161
143- const jarPath = process . env . POWPEG_NODE_JAR_PATH ;
144- if ( jarPath ) {
145- try {
146- console . log ( `Computing sha256 for powpeg node jar (${ jarPath } )...` ) ;
147- const hash = crypto . createHash ( 'sha256' ) ;
148- const stream = fs . createReadStream ( jarPath ) ;
149- await new Promise ( ( resolve , reject ) => {
150- stream . on ( 'data' , ( chunk ) => hash . update ( chunk ) ) ;
151- stream . on ( 'end' , resolve ) ;
152- stream . on ( 'error' , reject ) ;
153- } ) ;
154- console . log ( `Powpeg node jar sha256: ${ hash . digest ( 'hex' ) } \n` ) ;
155- } catch ( e ) {
156- console . log ( `Could not compute sha256 for powpeg node jar (${ jarPath } ): ${ e . message } ` ) ;
157- }
158- }
162+ await printPowpegJarSha256 ( ) ;
159163
160164 // Start bitcoin daemon if needed
161165 if ( runnersConfig . bitcoin == null ) {
0 commit comments