Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
previousBlockId: previousBlock.id,
generatorPublicKey: keypair.publicKey.toString('hex'),
transactions: blockTransactions,
height: nextHeight,
maxHeightPreviouslyForged,
maxHeightPrevoted,
};
// Reduce reward based on BFT rules
if (!this.bftModule.isBFTProtocolCompliant(block)) {
block.reward = block.reward.times(0.25);
}
return {
...block,
blockSignature: signDataWithPrivateKey(
hash(getBytes(block)),
keypair.privateKey,
),
};
}
const sign = (block, keypair) =>
signDataWithPrivateKey(hash(getBytes(block)), keypair.privateKey);
totalAmount,
totalFee,
height: nextHeight,
reward,
payloadHash,
timestamp,
numberOfTransactions: blockTransactions.length,
payloadLength: size,
previousBlockId: previousBlock.id,
generatorPublicKey: keypair.publicKey.toString('hex'),
transactions: blockTransactions,
};
return {
...block,
blockSignature: signDataWithPrivateKey(
hash(getBytes(block)),
keypair.privateKey,
),
};
}
}
const sign = (block, keypair) =>
signDataWithPrivateKey(hash(getBytes(block)), keypair.privateKey);
const sign = (block, keypair) =>
signDataWithPrivateKey(hash(getBytes(block)), keypair.privateKey);