-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: parse new output script types #73
base: dev
Are you sure you want to change the base?
Conversation
* origin/dev: chore: update linter version chore: update CI (#77) feat: use correct size limit fix: code scanning [auto] Add guideline enforcer [auto] Add manifest
Co-authored-by: Pedro Ferreira <[email protected]>
@@ -76,10 +77,18 @@ size_t parse_output(uint8_t *in, size_t inlen, tx_output_t *output) { | |||
if (!(buffer_read_u8(&buf, &output->token_data) && buffer_read_u16(&buf, &script_len, BE))) { | |||
THROW(TX_STATE_READY); | |||
} | |||
// validate script and extract pubkey hash | |||
validate_p2pkh_script(&buf, script_len); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't find where you moved this validation to. Don't you need it anymore?
#include "opcodes.h" | ||
|
||
/** | ||
* Identifies if the given script is P2PKH |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add the expected pattern in the docstring, please.
} | ||
|
||
/** | ||
* Identifies if the given script is P2SH |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add the expected pattern in the docstring, please.
return true; | ||
} | ||
|
||
bool identify_data_script(buffer_t *in, uint16_t script_len) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing docstring. Also, please add the expected pattern to the docstring.
* Read data from script and store it in `out` | ||
* Returns number of bytes read, 0 if any error occurs. | ||
*/ | ||
uint8_t read_data_script(buffer_t *in, uint16_t script_len, uint8_t out[MAX_DATA_SCRIPT_LEN]) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I couldn't find where you use this function. I was also wondering whether it would be easier to have a parser function that would try to parse and return error otherwise. This would remove the necessity to have both identify_data_script()
and read_data_script()
methods.
break; | ||
case SCRIPT_DATA: | ||
out->type = SCRIPT_DATA; | ||
// XXX: We currently do not read the actual data from the output |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't we present it to the user to confirm? Why not?
Acceptance criteria