Page MenuHomePhabricator

[chronik] fix script compression
ClosedPublic

Authored by PiRK on Oct 12 2024, 12:38.

Details

Reviewers
Fabien
tobias_ruck
Group Reviewers
Restricted Project
Commits
rABC4c73e2329958: [chronik] fix script compression
Summary

Some non-standard PUSH33 data CHECKSIG and PUSH65 data CHECKSIG where data is not a valid pubkey were incorrectly wrapped as P2PK, which caused the compressed script to be wrong in the db.

This fixes the compression for new keys. The existing db can be fixed in a separate diff if we decide it is necessary.

Test Plan

ninja check-all check-crates

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

PiRK requested review of this revision.Oct 12 2024, 12:38
chronik/bitcoinsuite-core/src/script/script.rs
354–370 ↗(On Diff #50066)

not sure if this test really makes sense or if Script::p2pk_uncompressed should inspect the pattern and panic in this case. Same for not_comp_pk below.

Fabien added a subscriber: Fabien.
Fabien added inline comments.
chronik/bitcoinsuite-core/src/script/script.rs
354–370 ↗(On Diff #50066)

I think it's fine to not panic here as the output is correct anyway even with the unexpected input

This revision is now accepted and ready to land.Oct 14 2024, 20:51
tobias_ruck added a subscriber: tobias_ruck.
tobias_ruck added inline comments.
chronik/bitcoinsuite-core/src/script/script.rs
430 ↗(On Diff #50066)
This revision was automatically updated to reflect the committed changes.