Created
February 26, 2017 02:05
-
-
Save lhartikk/41d840235c5558a572324d59994e98b4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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