Skip to content

Commit

Permalink
Merge pull request #183 from hackmod/retry-listen
Browse files Browse the repository at this point in the history
Retry to listenBlocks()
  • Loading branch information
YazzyYaz authored Dec 26, 2018
2 parents 04976b0 + 653219d commit 1ddd0b5
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion tools/sync.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@ var listenBlocks = function(config) {
var newBlocks = web3.eth.filter("latest");
newBlocks.watch(function (error,latestBlock) {
if(error) {
console.log('Error: ' + error);
console.log('Error: ' + error);
newBlocks.stopWatching();
console.log('Retry to listen...');
listenBlocks(config);
} else if (latestBlock == null) {
console.log('Warning: null block hash');
} else {
Expand Down

0 comments on commit 1ddd0b5

Please sign in to comment.