petertodd / python-bitcoinlib

Python3 library providing an easy interface to the Bitcoin data structures and protocol.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

OPCODES_BY_NAME missing OP_TRUE and OP_FALSE

kanzure opened this issue · comments

I noticed that OP_TRUE and OP_FALSE aren't in OPCODES_BY_NAME. I am not sure if this is intentional. If it is intentional, then a comment should be added; and if it isn't, then they probably should.

OP_INVALIDOPCODE can probably stay out.

Context: I was parsing some strings like "OP_WHATEVER OP_TRUE" to convert to CScript objects, using OPCODES_BY_NAME as the lookup table.

OP_1 and OP_0 are equivalent to OP_TRUE and OP_FALSE. This issue should be closed I believe. See https://en.bitcoin.it/wiki/Script

Still useful for parsing scripts or converting from string to opcodes.

Thank you. I'm writing a pull request now to add some more RPC calls. Would you recommend i add
"OP_TRUE": OP_1 and likewise for OP_FALSE? Or is there more needed.

Go ahead and add those. Sure. I seem to recall looking at a list and comparing against what's in the library, and only found these stragglers. But don't take my word for it... it's a while ago and don't have a copy in front of me.

Just opened PR #242 which fixes this issue (among other additions)