Skip to content

Instantly share code, notes, and snippets.

@lhartikk
Created February 26, 2017 02:05
Show Gist options
  • Save lhartikk/41d840235c5558a572324d59994e98b4 to your computer and use it in GitHub Desktop.
Save lhartikk/41d840235c5558a572324d59994e98b4 to your computer and use it in GitHub Desktop.
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