diff options
author | Sebastian Falbesoner <sebastian.falbesoner@gmail.com> | 2023-07-03 02:05:13 +0200 |
---|---|---|
committer | Sebastian Falbesoner <sebastian.falbesoner@gmail.com> | 2023-07-03 17:33:41 +0200 |
commit | 5cf44275c8ca8c32d238f37f717d78e9823f44c2 (patch) | |
tree | c4c2d5efde2939ae97a7c12d2c62e93406236c00 /README.md | |
parent | 61d59fed74108f31eb4e9a2faa3f36422a37000e (diff) | |
download | bitcoin-5cf44275c8ca8c32d238f37f717d78e9823f44c2.tar.xz |
test: refactor: deduplicate legacy ECDSA signing for tx inputs
There are several instances in functional tests and the framework
(MiniWallet, feature_block.py, p2p_segwit.py) where we create a legacy
ECDSA signature for a certain transaction's input by doing the following
steps:
1) calculate the `LegacySignatureHash` with the desired sighash type
2) create the actual digital signature by calling `ECKey.sign_ecdsa`
on the signature message hash calculated above
3) put the DER-encoded result as CScript data push into
tx input's scriptSig
Create a new helper `sign_input_legacy` which hides those details and
takes only the necessary parameters (tx, input index, relevant
scriptPubKey, private key, sighash type [SIGHASH_ALL by default]). For
further convenience, the signature is prepended to already existing
data-pushes in scriptSig, in order to avoid rehashing the transaction
after calling the new signing function.
Diffstat (limited to 'README.md')
0 files changed, 0 insertions, 0 deletions