T3060
Use the consume function to build a feature complete push-parsing function for OP_RETURN.
OOM vector of large pushes is not directly handled. An error will be thrown though if pushdata exceeds the length of the provided string.
Differential D13964
[alias-server] push parsing for op return bytesofman on Jun 1 2023, 12:54. Authored by
Details
T3060 Use the consume function to build a feature complete push-parsing function for OP_RETURN. OOM vector of large pushes is not directly handled. An error will be thrown though if pushdata exceeds the length of the provided string. npm test
Diff Detail
Event Timeline
Comment Actions Responding to feedback
Comment Actions You're missing a test for the case the pushdata length doesn't match the operator, like my previous example 4d42 (aka PUSHDATA2 42) Comment Actions
In this case, the failure will depend on what is next in the stack. e.g. 0x4d4274657374 i.e. 0x4d42 + ascii encoded "test" => parser will see 4d and get 4274, flip this to 7442, parseInt('7442', 16) = 29762 --> so it will fail because the provided string is much shorter than this. In theory the app could still a case where the push operator is used "wrong" but there is still a result...in this case, well, that is what the script says. Added test cases |