jimmysong / programmingbitcoin

Repository for the book
Other
1.75k stars 656 forks source link

Chapter 11: Exercise 6 & 7 #254

Open vvronskyFX opened 2 years ago

vvronskyFX commented 2 years ago

I'm getting an error here when I run the test saying that "NameError: name 'merkleblock' is not defined"

Here's my output: image

Here's my code:

class MerkleBlock: image

Below, I have the 2 solutions to the two exercises respectively: image

I matched it up with the original book solutions and it looks correct from what I can tell.

I tried "MerkleBlock" instead of "merkleblock" and I'm still getting the NameError.

Has anyone encountered this? Any solutions?

vvronskyFX commented 2 years ago

Still stuck with no solution yet. @jimmysong would you have any idea to fix this?

alexbarron commented 2 years ago

Yes, I hit the same issue. I resolved it by adding import merkleblock to the top cell in the notebook that loads all the dependencies.

############## PLEASE RUN THIS CELL FIRST! ###################

# import everything and define a test runner function
from importlib import reload
from helper import run
import block
import ecc
import helper
import network
import script
import tx
import merkleblock