Fixed: crashing when unknown block
This commit is contained in:
parent
0a52cc93db
commit
97d7c6ecde
@ -181,9 +181,19 @@ BlockService.prototype.getRawBlock = function(hash, callback) {
|
||||
if(err) {
|
||||
return callback(err);
|
||||
}
|
||||
let block_raw = block.toRaw();
|
||||
let block_raw_str_hex = block_raw.toString('hex');
|
||||
if (!block || typeof block_raw == "undefined" || typeof block_raw_str_hex == "undefined" || block_raw_str_hex == '') {
|
||||
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();
|
||||
}
|
||||
} catch(e){
|
||||
return callback();
|
||||
}
|
||||
log.info("Testing getRawBlock " + block_raw_str_hex);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user