You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Correct me if I'm wrong, but in the third version of this code, shouldn't we add the latest block's hash when creating a new block in minePendingTransactions. Doesn't this ensure the integrity of our chain, were someone to try and alter a block?
for example:
minePendingTransactions(miningRewardAddress) {
let block = new Block(Date.now(), this.pendingTransactions, this.getLatestBlock().hash);
block.mineBlock(this.difficulty);
this.chain.push(block);
this.pendingTransactions = [
new Transaction(null, miningRewardAddress, this.miningReward)
];
}
also one small matter of cleanup, we no longer need to include this.index in the calculateHash function.
Thanks for the tutorials! They have definitely helped me to better understand what a blockchain is.
The text was updated successfully, but these errors were encountered:
Hello Savjee,
Correct me if I'm wrong, but in the third version of this code, shouldn't we add the latest block's hash when creating a new block in minePendingTransactions. Doesn't this ensure the integrity of our chain, were someone to try and alter a block?
for example:
also one small matter of cleanup, we no longer need to include this.index in the calculateHash function.
Thanks for the tutorials! They have definitely helped me to better understand what a blockchain is.
The text was updated successfully, but these errors were encountered: