Skip to content

Instantly share code, notes, and snippets.

@nosequeldeebee
Created January 29, 2018 05:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nosequeldeebee/efe4ca74c2670e91305dc0ae28dc0842 to your computer and use it in GitHub Desktop.
Save nosequeldeebee/efe4ca74c2670e91305dc0ae28dc0842 to your computer and use it in GitHub Desktop.
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