@@ -281,18 +281,20 @@ module.exports = class Federator {
281281 typeId
282282 } ) . encodeABI ( ) ;
283283
284- let revertedTxns = JSON . parse ( fs . readFileSync ( this . revertedTxnsPath , 'utf8' ) ) ;
285- this . logger . info ( `read these transactions from reverted transactions file` , revertedTxns ) ;
284+ let revertedTxns = { } ;
285+ if ( fs . existsSync ( this . revertedTxnsPath ) ) {
286+ revertedTxns = JSON . parse ( fs . readFileSync ( this . revertedTxnsPath , 'utf8' ) ) ;
287+ this . logger . info ( `read these transactions from reverted transactions file` , revertedTxns ) ;
288+ }
286289
287- let receipt ;
288290 if ( revertedTxns [ txId ] ) {
289291 this . logger . info ( `Skipping Voting Transfer ${ txId } since it's marked as reverted.` , revertedTxns [ txId ] )
290- } else {
291- receipt = await transactionSender . sendTransaction ( fedContract . getAddress ( ) , txData , 0 , this . config . privateKey ) ;
292+ return false ;
292293 }
294+ const receipt = await transactionSender . sendTransaction ( fedContract . getAddress ( ) , txData , 0 , this . config . privateKey ) ;
293295
294- if ( receipt && receipt . status == false ) {
295- this . _saveRevertedTxns (
296+ if ( receipt . status == false ) {
297+ fs . writeFileSync (
296298 this . revertedTxnsPath ,
297299 JSON . stringify ( {
298300 ...revertedTxns ,
@@ -323,10 +325,4 @@ module.exports = class Federator {
323325 fs . writeFileSync ( path , value . toString ( ) ) ;
324326 }
325327 }
326-
327- _saveRevertedTxns ( path , value ) {
328- if ( value ) {
329- fs . writeFileSync ( path , value . toString ( ) ) ;
330- }
331- }
332328}
0 commit comments