HomePhabricator

[electrum] move Transaction.serialize_input to TxInput.serialize

Description

[electrum] move Transaction.serialize_input to TxInput.serialize

Summary:
This change lets us remove 3 Transaction methods that operate purely on inputs, and simplify Transaction.serialize.

There is a small difference in logic/design between the legacy coin dict and the TxInput class, regarding how to determine if the amount is to be appended to the serialized transaction for offline signing.
In the legacy coin dict, the scriptsig entry was deleted from the dict if the input is not complete (see d.pop("scriptSig", None) in TxInput.to_coin_dict)), whereas in the TxInput object the scriptsig may still defined if the object is constructed via TxInput.from_scriptsig, so we check for self.is_complete() instead of self.scriptsig is not None.

Depends on D14500

Test Plan: python test_runner.py

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Subscribers: Fabien

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

Details

Provenance
PiRKAuthored on Sep 18 2023, 12:18
PiRKPushed on Sep 19 2023, 10:50
Reviewer
Restricted Project
Differential Revision
D14501: [electrum] move Transaction.serialize_input to TxInput.serialize
Parents
rABC081380d77ed0: [electrum] cache scriptsig for complete inputs, invalidate it for incomplete…
Branches
Unknown
Tags
Unknown