|
67 | 67 | SIGHASH_ANYONECANPAY, |
68 | 68 | SIGHASH_NONE, |
69 | 69 | SIGHASH_SINGLE, |
70 | | - SegwitVersion1SignatureHash, |
71 | | - SignatureHash, |
| 70 | + SegwitV0SignatureHash, |
| 71 | + LegacySignatureHash, |
72 | 72 | hash160, |
73 | 73 | ) |
74 | 74 | from test_framework.test_framework import BitcoinTestFramework |
@@ -103,7 +103,7 @@ def get_p2pkh_script(pubkeyhash): |
103 | 103 |
|
104 | 104 | def sign_p2pk_witness_input(script, tx_to, in_idx, hashtype, value, key): |
105 | 105 | """Add signature for a P2PK witness program.""" |
106 | | - tx_hash = SegwitVersion1SignatureHash(script, tx_to, in_idx, hashtype, value) |
| 106 | + tx_hash = SegwitV0SignatureHash(script, tx_to, in_idx, hashtype, value) |
107 | 107 | signature = key.sign_ecdsa(tx_hash) + chr(hashtype).encode('latin-1') |
108 | 108 | tx_to.wit.vtxinwit[in_idx].scriptWitness.stack = [signature, script] |
109 | 109 | tx_to.rehash() |
@@ -1489,7 +1489,7 @@ def test_uncompressed_pubkey(self): |
1489 | 1489 | tx2.vin.append(CTxIn(COutPoint(tx.sha256, 0), b"")) |
1490 | 1490 | tx2.vout.append(CTxOut(tx.vout[0].nValue - 1000, script_wsh)) |
1491 | 1491 | script = get_p2pkh_script(pubkeyhash) |
1492 | | - sig_hash = SegwitVersion1SignatureHash(script, tx2, 0, SIGHASH_ALL, tx.vout[0].nValue) |
| 1492 | + sig_hash = SegwitV0SignatureHash(script, tx2, 0, SIGHASH_ALL, tx.vout[0].nValue) |
1493 | 1493 | signature = key.sign_ecdsa(sig_hash) + b'\x01' # 0x1 is SIGHASH_ALL |
1494 | 1494 | tx2.wit.vtxinwit.append(CTxInWitness()) |
1495 | 1495 | tx2.wit.vtxinwit[0].scriptWitness.stack = [signature, pubkey] |
@@ -1543,7 +1543,7 @@ def test_uncompressed_pubkey(self): |
1543 | 1543 | tx5 = CTransaction() |
1544 | 1544 | tx5.vin.append(CTxIn(COutPoint(tx4.sha256, 0), b"")) |
1545 | 1545 | tx5.vout.append(CTxOut(tx4.vout[0].nValue - 1000, CScript([OP_TRUE]))) |
1546 | | - (sig_hash, err) = SignatureHash(script_pubkey, tx5, 0, SIGHASH_ALL) |
| 1546 | + (sig_hash, err) = LegacySignatureHash(script_pubkey, tx5, 0, SIGHASH_ALL) |
1547 | 1547 | signature = key.sign_ecdsa(sig_hash) + b'\x01' # 0x1 is SIGHASH_ALL |
1548 | 1548 | tx5.vin[0].scriptSig = CScript([signature, pubkey]) |
1549 | 1549 | tx5.rehash() |
@@ -1693,7 +1693,7 @@ def test_signature_version_1(self): |
1693 | 1693 | tx2.vout.append(CTxOut(tx.vout[0].nValue, CScript([OP_TRUE]))) |
1694 | 1694 |
|
1695 | 1695 | script = get_p2pkh_script(pubkeyhash) |
1696 | | - sig_hash = SegwitVersion1SignatureHash(script, tx2, 0, SIGHASH_ALL, tx.vout[0].nValue) |
| 1696 | + sig_hash = SegwitV0SignatureHash(script, tx2, 0, SIGHASH_ALL, tx.vout[0].nValue) |
1697 | 1697 | signature = key.sign_ecdsa(sig_hash) + b'\x01' # 0x1 is SIGHASH_ALL |
1698 | 1698 |
|
1699 | 1699 | # Check that we can't have a scriptSig |
|
0 commit comments