@@ -66,19 +66,11 @@ class Beacon extends MutableObject implements SpaceEntryPoint {
6666 Beacon . log . debug ( ( ) => 'Racing for challenge (' + this . steps + ' steps): "' + this . currentChallenge ( ) + '".' ) ;
6767
6868 this . _computation = new Worker ( './dist-examples/examples/randomness-beacon/model/worker.js' ) ;
69- console . log ( 'is death immediate?' )
70- this . _computation . on ( 'online' , ( ) => { console . log ( 'worker is online' ) } ) ;
7169 this . _computation . on ( 'error' , ( err : Error ) => { console . log ( 'ERR' ) ; console . log ( err ) } ) ;
72- this . _computation . on ( 'exit' , ( exitCode : number ) => {
73- console . log ( 'worker exited with ' + exitCode ) ;
74- } )
75- console . log ( 'created worker' )
7670 this . _computation . on ( 'message' , async ( msg : { challenge : string , result : string } ) => {
7771
7872 Beacon . log . debug ( ( ) => 'Solved challenge "' + msg . challenge + '" with: "' + msg . result + '".' ) ;
7973
80-
81-
8274 if ( msg . challenge === this . currentChallenge ( ) ) {
8375 let op = new BeaconValueOp ( this , this . currentSeq ( ) , msg . result ) ;
8476
@@ -92,25 +84,23 @@ class Beacon extends MutableObject implements SpaceEntryPoint {
9284 await this . getStore ( ) . save ( this ) ;
9385
9486 } else {
95- console . log ( 'mismatched challenge') ;
87+ Beacon . log . debug ( 'Mismatched challenge - could be normal. ') ;
9688 }
9789 } ) ;
9890 this . _computation . postMessage ( { steps : this . steps , challenge : this . currentChallenge ( ) } ) ;
99- console . log ( 'posted message to worker' )
10091
10192 } else {
102- console . log ( 'race was called but a computation is running') ;
93+ Beacon . log . debug ( 'Race was called but a computation is running. ') ;
10394 }
10495 }
10596
10697 stopRace ( ) {
107- console . log ( 'stopRace() ') ;
98+ Beacon . log . debug ( 'Going to stop current VDF computation. ') ;
10899 if ( this . _computation !== undefined ) {
109100 if ( this . _computationTermination === undefined ) {
110- console . log ( 'need to stop' )
111101 this . _computationTermination = this . _computation . terminate ( ) . then (
112102 ( ret : number ) => {
113- console . log ( 'stopped ') ;
103+ Beacon . log . trace ( 'Stopped VDF computation ') ;
114104 this . _computation = undefined ;
115105 this . _computationTermination = undefined ;
116106 return ret ;
@@ -174,15 +164,14 @@ class Beacon extends MutableObject implements SpaceEntryPoint {
174164
175165 if ( this . _autoCompute ) {
176166 if ( this . _computation === undefined ) {
177- console . log ( 'computation was finished' ) ;
178167 this . race ( ) ;
179168 } else {
180- console . log ( 'chaining' ) ;
181169 this . stopRace ( ) ;
182- this . _computationTermination ?. then ( ( ) => { console . log ( 'finished now!' ) ; this . race ( ) ; } ) ;
170+ this . _computationTermination ?. then ( ( ) => { this . race ( ) ; } ) ;
183171 }
184-
185172 }
173+
174+ Beacon . log . debug ( 'Challenge now is "' + this . currentChallenge ( ) + '".' ) ;
186175
187176 }
188177
0 commit comments