Skip to content

Commit 35b39cf

Browse files
committed
fix: 22619
1 parent 171ab03 commit 35b39cf

File tree

3 files changed

+7
-12
lines changed

3 files changed

+7
-12
lines changed

test/functional/feature_addressindex.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77
# Test addressindex generation and fetching
88
#
99

10-
import binascii
11-
1210
from test_framework.messages import COIN, COutPoint, CTransaction, CTxIn, CTxOut
1311
from test_framework.test_framework import BitcoinTestFramework
1412
from test_framework.test_node import ErrorMatch
@@ -132,7 +130,7 @@ def run_test(self):
132130

133131
# Check that outputs with the same address will only return one txid
134132
self.log.info("Testing for txid uniqueness...")
135-
addressHash = binascii.unhexlify("FE30B718DCF0BF8A2A686BF1820C073F8B2C3B37")
133+
addressHash = bytes.fromhex("FE30B718DCF0BF8A2A686BF1820C073F8B2C3B37")
136134
scriptPubKey = CScript([OP_HASH160, addressHash, OP_EQUAL])
137135
unspent = self.nodes[0].listunspent()
138136
tx = CTransaction()
@@ -159,7 +157,7 @@ def run_test(self):
159157
self.log.info("Testing balances after spending...")
160158
privkey2 = "cU4zhap7nPJAWeMFu4j6jLrfPmqakDAzy8zn8Fhb3oEevdm4e5Lc"
161159
address2 = "yeMpGzMj3rhtnz48XsfpB8itPHhHtgxLc3"
162-
addressHash2 = binascii.unhexlify("C5E4FB9171C22409809A3E8047A29C83886E325D")
160+
addressHash2 = bytes.fromhex("C5E4FB9171C22409809A3E8047A29C83886E325D")
163161
scriptPubKey2 = CScript([OP_DUP, OP_HASH160, addressHash2, OP_EQUALVERIFY, OP_CHECKSIG])
164162
self.nodes[0].importprivkey(privkey2)
165163

@@ -254,7 +252,7 @@ def run_test(self):
254252

255253
privKey3 = "cRyrMvvqi1dmpiCmjmmATqjAwo6Wu7QTjKu1ABMYW5aFG4VXW99K"
256254
address3 = "yWB15aAdpeKuSaQHFVJpBDPbNSLZJSnDLA"
257-
addressHash3 = binascii.unhexlify("6C186B3A308A77C779A9BB71C3B5A7EC28232A13")
255+
addressHash3 = bytes.fromhex("6C186B3A308A77C779A9BB71C3B5A7EC28232A13")
258256
scriptPubKey3 = CScript([OP_DUP, OP_HASH160, addressHash3, OP_EQUALVERIFY, OP_CHECKSIG])
259257
# address4 = "2N8oFVB2vThAKury4vnLquW2zVjsYjjAkYQ"
260258
scriptPubKey4 = CScript([OP_HASH160, addressHash3, OP_EQUAL])
@@ -320,7 +318,7 @@ def run_test(self):
320318
# sending and receiving to the same address
321319
privkey1 = "cMvZn1pVWntTEcsK36ZteGQXRAcZ8CoTbMXF1QasxBLdnTwyVQCc"
322320
address1 = "yM9Eed1bxjy7tYxD3yZDHxjcVT48WdRoB1"
323-
address1hash = binascii.unhexlify("0909C84A817651502E020AAD0FBCAE5F656E7D8A")
321+
address1hash = bytes.fromhex("0909C84A817651502E020AAD0FBCAE5F656E7D8A")
324322
address1script = CScript([OP_DUP, OP_HASH160, address1hash, OP_EQUALVERIFY, OP_CHECKSIG])
325323

326324
self.nodes[0].sendtoaddress(address1, 10)

test/functional/feature_spentindex.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
# Test addressindex generation and fetching
88
#
99

10-
import binascii
1110
from decimal import Decimal
1211

1312
from test_framework.messages import COIN, COutPoint, CTransaction, CTxIn, CTxOut
@@ -64,7 +63,7 @@ def run_test(self):
6463
self.log.info("Testing spent index...")
6564

6665
privkey = "cU4zhap7nPJAWeMFu4j6jLrfPmqakDAzy8zn8Fhb3oEevdm4e5Lc"
67-
addressHash = binascii.unhexlify("C5E4FB9171C22409809A3E8047A29C83886E325D")
66+
addressHash = bytes.fromhex("C5E4FB9171C22409809A3E8047A29C83886E325D")
6867
scriptPubKey = CScript([OP_DUP, OP_HASH160, addressHash, OP_EQUALVERIFY, OP_CHECKSIG])
6968
unspent = self.nodes[0].listunspent()
7069
tx = CTransaction()
@@ -103,7 +102,7 @@ def run_test(self):
103102

104103
# Check that verbose raw transaction includes address values and input values
105104
address2 = "yeMpGzMj3rhtnz48XsfpB8itPHhHtgxLc3"
106-
addressHash2 = binascii.unhexlify("C5E4FB9171C22409809A3E8047A29C83886E325D")
105+
addressHash2 = bytes.fromhex("C5E4FB9171C22409809A3E8047A29C83886E325D")
107106
scriptPubKey2 = CScript([OP_DUP, OP_HASH160, addressHash2, OP_EQUALVERIFY, OP_CHECKSIG])
108107
tx2 = CTransaction()
109108
tx2.vin = [CTxIn(COutPoint(int(txid, 16), 0))]

test/functional/feature_txindex.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77
# Test txindex generation and fetching
88
#
99

10-
import binascii
11-
1210
from test_framework.messages import COutPoint, CTransaction, CTxIn, CTxOut
1311
from test_framework.script import CScript, OP_CHECKSIG, OP_DUP, OP_EQUALVERIFY, OP_HASH160
1412
from test_framework.test_framework import BitcoinTestFramework
@@ -48,7 +46,7 @@ def run_test(self):
4846

4947
self.log.info("Testing transaction index...")
5048

51-
addressHash = binascii.unhexlify("C5E4FB9171C22409809A3E8047A29C83886E325D")
49+
addressHash = bytes.fromhex("C5E4FB9171C22409809A3E8047A29C83886E325D")
5250
scriptPubKey = CScript([OP_DUP, OP_HASH160, addressHash, OP_EQUALVERIFY, OP_CHECKSIG])
5351
unspent = self.nodes[0].listunspent()
5452
tx = CTransaction()

0 commit comments

Comments
 (0)