Page MenuHomePhabricator

[Chronik] Add `ScriptVariant` and `ScriptType`
ClosedPublic

Authored by tobias_ruck on Apr 1 2023, 23:12.

Details

Reviewers
Fabien
Group Reviewers
Restricted Project
Commits
rABC5e3e2c388afd: [Chronik] Add `ScriptVariant` and `ScriptType`
Summary

This allows us parsing which kind of script the user wants to query, and the associated payload, like a hash or pubkey.

We currently only support P2PKH, P2SH and P2PK, as these are the only ones widely used. Other types of scripts can be queried using the Other script type.

There's no OP_RETURN variant, as we don't index the tx history nor the UTXOs of OP_RETURN scripts.

Depends on D13537.

Test Plan

ninja check-crates

Diff Detail

Repository
rABC Bitcoin ABC
Branch
chronik-script-variant
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 22894
Build 45408: Build Diffbuild-chronik
Build 45407: arc lint + arc unit

Event Timeline

Fabien requested changes to this revision.Apr 3 2023, 10:19
Fabien added inline comments.
chronik/bitcoinsuite-core/src/script/variant.rs
195

Since there is support for both compressed and uncompressed pubkeys, the expected length should be either 33 or 65 and the message be more generic

This revision now requires changes to proceed.Apr 3 2023, 10:19

Use PubKeyVariant, for clearer separation & better error messages.

This revision is now accepted and ready to land.Apr 3 2023, 15:53