Skip to content
This repository has been archived by the owner on Jun 11, 2024. It is now read-only.

Confirmations value in block is NaN - Close #3688 #3706

Merged
merged 3 commits into from
May 22, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions framework/src/modules/chain/logic/block.js
Original file line number Diff line number Diff line change
Expand Up @@ -503,6 +503,9 @@ Block.prototype.dbRead = function(raw) {
if (!raw.b_id) {
return null;
}

const confirmations = parseInt(raw.b_confirmations);

const block = {
id: raw.b_id,
version: parseInt(raw.b_version),
Expand All @@ -518,7 +521,7 @@ Block.prototype.dbRead = function(raw) {
generatorPublicKey: raw.b_generatorPublicKey,
generatorId: __private.getAddressByPublicKey(raw.b_generatorPublicKey),
blockSignature: raw.b_blockSignature,
confirmations: parseInt(raw.b_confirmations),
confirmations: !Number.isNaN(confirmations) ? confirmations : 0,
};
block.totalForged = block.totalFee.plus(block.reward).toString();
return block;
Expand All @@ -535,6 +538,8 @@ Block.prototype.storageRead = function(raw) {
return null;
}

const confirmations = parseInt(raw.confirmations);

const block = {
id: raw.id,
version: parseInt(raw.version),
Expand All @@ -550,7 +555,7 @@ Block.prototype.storageRead = function(raw) {
generatorPublicKey: raw.generatorPublicKey,
generatorId: __private.getAddressByPublicKey(raw.generatorPublicKey),
blockSignature: raw.blockSignature,
confirmations: parseInt(raw.confirmations),
confirmations: !Number.isNaN(confirmations) ? confirmations : 0,
};

if (raw.transactions) {
Expand All @@ -560,7 +565,6 @@ Block.prototype.storageRead = function(raw) {
}

block.totalForged = block.totalFee.plus(block.reward).toString();

return block;
};

Expand Down