HomePhabricator

[electrum] replace match_decoded function with more explicit functions

Description

[electrum] replace match_decoded function with more explicit functions

Summary:
The match_decoded function is surprising, it matches all push opcodes with OP_PUSHDATA4. Also its name is not very descriptive.

Replace it with more explicit functions: is_push_opcode, matches_p2pk_scriptsig, matches_p2pkh_scriptsig, matches_p2sh_multisig_scriptsig, matches_multisig_redeemscript

Document the Script.get_ops classmethod that produces the input for these functions.

Test Plan:
python test_runner.py

python -m electrumabc.transaction

The additional tests added in D14458, D14459 and D14461 also pass (after rebasing on this)

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Subscribers: Fabien

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

Details

Provenance
PiRKAuthored on Sep 11 2023, 09:22
PiRKPushed on Sep 12 2023, 10:48
Reviewer
Restricted Project
Differential Revision
D14466: [electrum] replace match_decoded function with more explicit functions
Parents
rABC33ce042318c6: [electrum] delete unused code that raises on linux and windows
Branches
Unknown
Tags
Unknown