moneybutton / bsv

Bitcoin SV javascript library
Other
205 stars 107 forks source link

Fix isOpReturn #205

Closed calvogenerico closed 3 years ago

calvogenerico commented 3 years ago

The method Script#isOpReturn had a really unexpected behavior:

Script.fromAsmString('OP_RETURN 00').isOpReturn() === false

The reason why this fails is because the method was checking that everything after the OP_RETURN is only push data, which is something that is not actually needed.

This PR change that behavior by just checking if the first element is an OP_RETURN opcode.