15Dkatz / cryptochain

Build a blockchain-based cryptocurrency on the full stack course
https://www.udemy.com/build-blockchain-full-stack
257 stars 221 forks source link

TypeError: Cannot read properties of undefined (reading 'hash') #17

Open rcturner7 opened 2 years ago

rcturner7 commented 2 years ago

I'm on Chapter 3, I started getting this error in around section 15 and this failed error in test is not going away. I am now on section 18 in chapter 3. I have gone back to chapter 2 all sections trying to figure out if I missed something.

When I run test it shows this error that is not in the videos failed test:

TypeError: Cannot read properties of undefined (reading 'hash') 16 | static mineBlock({ lastBlock, data }) { 17 | const timestamp = Date.now(); 18 | const lastHash = lastBlock.hash; | ^ 19 | 20 | return new this({ 21 | timestamp,

at Function.mineBlock (block.js:18:32) at Blockchain.addBlock (blockchain.js:9:32) at Object. (blockchain.test.js:37:28)

The arrow on 18 in my command prompt points at the .hash in = lastBlock.hash.

If someone could help me figure out why my command prompt the tests can't read properties of hash?