From 10db01654e98afba69ee168100611065128d3c3d Mon Sep 17 00:00:00 2001 From: Sai Raj <39055732+sairajzero@users.noreply.github.com> Date: Tue, 3 Jan 2023 21:00:21 +0530 Subject: [PATCH] hotfix for crash --- lib/services/block/index.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/services/block/index.js b/lib/services/block/index.js index 25b31987..72f9ed25 100644 --- a/lib/services/block/index.js +++ b/lib/services/block/index.js @@ -181,10 +181,12 @@ BlockService.prototype.getRawBlock = function(hash, callback) { if(err) { return callback(err); } - if (!block) { + 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 == '') { return callback(); } - log.info("Testing getRawBlock " + block.toRaw().toString('hex')); + log.info("Testing getRawBlock " + block_raw_str_hex); callback(null, block.toRaw().toString('hex')); }); };