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 <phsf.pedro@gmail.com>
| THROW(TX_STATE_READY); | ||
| } | ||
| // validate script and extract pubkey hash | ||
| validate_p2pkh_script(&buf, script_len); |
There was a problem hiding this comment.
I didn't find where you moved this validation to. Don't you need it anymore?
src/transaction/script.c
Outdated
| #include "opcodes.h" | ||
|
|
||
| /** | ||
| * Identifies if the given script is P2PKH |
There was a problem hiding this comment.
Add the expected pattern in the docstring, please.
src/transaction/script.c
Outdated
| } | ||
|
|
||
| /** | ||
| * Identifies if the given script is P2SH |
There was a problem hiding this comment.
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.
Missing docstring. Also, please add the expected pattern to the docstring.
src/transaction/script.c
Outdated
| * 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.
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.
There was a problem hiding this comment.
The identify methods are used to check for valid scripts which is nice to have a separate function for.
It also leaves some possibility to have methods that check for a valid output or transaction without extracting any data.
src/transaction/script.c
Outdated
| 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.
Don't we present it to the user to confirm? Why not?
There was a problem hiding this comment.
Added support for data output, including an alternative output confirmation for data outputs
Acceptance criteria