HomePhabricator

[electrum] move get_preimage_script from Transaction to TxInput

Description

[electrum] move get_preimage_script from Transaction to TxInput

Summary:
And improve support of p2pk inputs: a pubkey can be passed but is not available from a deserialized tx, an address is not applicable. This is required to test get_preimage_script.

So far get_preimage_script had only partial test coverage for p2pkh transaction. Add coverage for p2pk and multisig p2sh.

Drop the special case for transaction type "unknown", because nothing in this codebase uses or defines txin["scriptCode"]

Add a OutPoint.from_str helper which is just used in tests for now, but can be used later for parsing JSON wallet files.

Depends on D14496

Test Plan: python test_runner.py

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Subscribers: Fabien

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

Details

Provenance
PiRKAuthored on Sep 18 2023, 10:19
PiRKPushed on Sep 18 2023, 14:33
Reviewer
Restricted Project
Differential Revision
D14497: [electrum] move get_preimage_script from Transaction to TxInput
Parents
rABC0ab06e269919: [electrum] support coins with only x_pubkeys and no pubkeys defined
Branches
Unknown
Tags
Unknown