Merge pull request #3 from ahanikel/issues/2

Issue #2: Add previousHash to hashData
This commit is contained in:
Daxeel Soni 2018-01-29 17:57:07 +05:30 committed by GitHub
commit bee9675c25
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -17,7 +17,7 @@ class Block:
self.hash = self.calculateHash()
def calculateHash(self):
hashData = str(self.index) + str(self.data) + self.timestamp + str(self.nonce)
hashData = str(self.index) + str(self.data) + self.timestamp + self.previousHash + str(self.nonce)
return hashlib.sha256(hashData).hexdigest()
def mineBlock(self, difficulty):