Compare commits

...

8 Commits

Author SHA1 Message Date
sairajzero
6cf330926c hotfix: Do not shutdown on unhandled exceptions 2023-01-08 17:03:21 +05:30
Sai Raj
e98754eab8
Fixed bug: block_raw_str_hex out of scope 2023-01-07 17:10:50 +05:30
Sai Raj
97d7c6ecde
Fixed: crashing when unknown block 2023-01-06 23:02:07 +05:30
Vivek Teega
0a52cc93db
Merge pull request #2 from ranchimall/temp
Uncommenting 'getRawBlock' logging
2023-01-06 18:45:55 +05:30
Vivek Teega
b6a64351b3
Uncommenting 'getRawBlock' logging 2023-01-06 18:45:03 +05:30
Sai Raj
d831d36835
Commenting out 'getRawBlock' logging 2023-01-04 13:28:23 +05:30
Sai Raj
10db01654e
hotfix for crash 2023-01-03 21:00:21 +05:30
b4df8314a2
Update index.js
Added getRawBlack test data in logs to troubleshoot
2023-01-03 20:21:29 +05:30
2 changed files with 23 additions and 9 deletions

View File

@ -212,12 +212,13 @@ function exitHandler(options, _process, node, err) {
if(err.stack) { if(err.stack) {
log.error(err.stack); log.error(err.stack);
} }
node.stop(function(err) { if(options.exit)
if(err) { node.stop(function(err) {
log.error('Failed to stop services: ' + err); if(err) {
} log.error('Failed to stop services: ' + err);
_process.exit(-1); }
}); _process.exit(-1);
});
} }
// Handle SIGINT (Ctrl+C) // Handle SIGINT (Ctrl+C)
if (options.sigint) { if (options.sigint) {
@ -229,7 +230,7 @@ function exitHandler(options, _process, node, err) {
} }
function registerExitHandlers(_process, node) { function registerExitHandlers(_process, node) {
_process.on('uncaughtException', exitHandler.bind(null, {exit:true}, _process, node)); _process.on('uncaughtException', exitHandler.bind(null, {exit:false}, _process, node));
_process.on('SIGINT', exitHandler.bind(null, {sigint:true}, _process, node)); _process.on('SIGINT', exitHandler.bind(null, {sigint:true}, _process, node));
} }

View File

@ -181,10 +181,23 @@ BlockService.prototype.getRawBlock = function(hash, callback) {
if(err) { if(err) {
return callback(err); return callback(err);
} }
if (!block) { try{
if(!block){
return callback();
}
let block_raw = block.toRaw();
if(typeof block_raw == "undefined" || !block_raw){
return callback();
}
let block_raw_str_hex = block_raw.toString('hex');
if(typeof block_raw_str_hex == "undefined" || block_raw_str_hex == ''){
return callback();
}
log.info("Testing getRawBlock " + block_raw_str_hex);
callback(null, block_raw_str_hex);
} catch(e){
return callback(); return callback();
} }
callback(null, block.toRaw().toString('hex'));
}); });
}; };