HomePhabricator

[Chronik] Add `Opcode` struct

Description

[Chronik] Add Opcode struct

Summary:
This helps us build/match scripts as needed. Instead of using a plain u8, we wrap it in an Opcode struct, which helps us adding useful opcode-specific functions.

This is also useful for the explorer, which eventually should have all its required functionality moved into bitcoinsuite-core.

We use a macro, so we don't have to re-define each opcode when displaying/parsing etc. We also have access to the doc text in the $doc macro variable, which might be useful if the explorer wants to e.g. show a helpful explanation of each opcode.

We currently only define the opcodes we need for Chronik, but we can add the remaining ones once we need (due to the missing_docs lint we'd have to write a doc comment for each of them, ugh).

Test Plan: ninja check-crates

Reviewers: Fabien, #bitcoin_abc

Reviewed By: Fabien, #bitcoin_abc

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

Details

Provenance
tobias_ruckAuthored on Mar 30 2023, 08:55
tobias_ruckPushed on Apr 1 2023, 13:19
Reviewer
Restricted Project
Differential Revision
D13505: [Chronik] Add `Opcode` struct
Parents
rABC34b59b3f91b6: [chronik] Fix chronik_tx flakiness
Branches
Unknown
Tags
Unknown