HomePhabricator

[Chronik] Change `empp::parse` to return `None` for ignorable results

Description

[Chronik] Change empp::parse to return None for ignorable results

Summary:
Currently, ParseError::should_ignore tells the call site whether to ignore the failed parsing attempt.

However, it is more intuitive to return Ok(None) in this case.

Also, we change the semantics slightly to make the parsing error a bit more precise:

  • If the script has invalidly encoded opcodes (e.g. OP_PUSHDATA1 with a missing length), but doesn't start with OP_RETURN OP_RESERVED, we return None
  • If the script does start with OP_RETURN OP_RESERVED, we return the DataError associated with the failed parse from the opcode.

This means users get an error for the bad script (which would fail policy rules anyway) a bit earlier, if it does look like they tried to use eMPP.

Test Plan: cargo test -p bitcoinsuite-slp

Reviewers: Fabien, #bitcoin_abc

Reviewed By: Fabien, #bitcoin_abc

Subscribers: bytesofman

Differential Revision: https://reviews.bitcoinabc.org/D15016

Details

Provenance
tobias_ruckAuthored on Dec 20 2023, 16:14
tobias_ruckPushed on Dec 20 2023, 20:08
Reviewer
Restricted Project
Differential Revision
D15016: [Chronik] Change `empp::parse` to return `None` for ignorable results
Parents
rABC575725bf9a8c: [ecash-herald] Extend support for recognizing Hathor-MM
Branches
Unknown
Tags
Unknown