programmingbitcoin
programmingbitcoin copied to clipboard
code-ch13 TxIn class
In the parse_segwit method the code line:
tx_in.witness = items
which means the TxIn class should have this "witness" parameter also in its init procedure. How can this be possible ?
It's been a while since I looked at it, but are you sure the code doesn't work? In Python you can add an attribute to an object like that. For a clean coding style, yes it probably should be initialized in the __init__ but that's not a requirement of the language.
Yes the code does work, but I had problems understanding how this could be possible. But as you mentioned before, for clean coding style definitely worth to correct it.