Created
January 29, 2018 05:40
-
-
Save nosequeldeebee/efe4ca74c2670e91305dc0ae28dc0842 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
func isBlockValid(newBlock, oldBlock Block) bool { | |
if oldBlock.Index+1 != newBlock.Index { | |
return false | |
} | |
if oldBlock.Hash != newBlock.PrevHash { | |
return false | |
} | |
if calculateHash(newBlock) != newBlock.Hash { | |
return false | |
} | |
return true | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment