Skip to content

Instantly share code, notes, and snippets.

@nosequeldeebee
Created January 29, 2018 05:19
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/962b6150bd204c5c9ed83d8b58912256 to your computer and use it in GitHub Desktop.
Save nosequeldeebee/962b6150bd204c5c9ed83d8b58912256 to your computer and use it in GitHub Desktop.
func generateBlock(oldBlock Block, BPM int) (Block, error) {
var newBlock Block
t := time.Now()
newBlock.Index = oldBlock.Index + 1
newBlock.Timestamp = t.String()
newBlock.BPM = BPM
newBlock.PrevHash = oldBlock.Hash
newBlock.Hash = calculateHash(newBlock)
return newBlock, nil
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment