Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
var replaceChain = (newBlocks) => {
if (isValidChain(newBlocks) && newBlocks.length > blockchain.length) {
console.log('Received blockchain is valid. Replacing current blockchain with received blockchain');
blockchain = newBlocks;
broadcast(responseLatestMsg());
} else {
console.log('Received blockchain invalid');
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment