Skip to content

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

@rcturner7

Description

@rcturner7

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions