Skip to content

Commit 4d4bb84

Browse files
committed
wip
1 parent 77b4734 commit 4d4bb84

File tree

1 file changed

+33
-8
lines changed

1 file changed

+33
-8
lines changed

qa/rpc-tests/feature_fedpeg.py

Lines changed: 33 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,22 +46,48 @@ def setup_network(self, split=False):
4646
if self.options.parent_type == 'bitcoin' and self.options.parent_binpath == "":
4747
raise Exception("Can't run with --parent_type=bitcoin without specifying --parent_binpath")
4848

49+
self.binary = self.options.parent_binpath if self.options.parent_binpath != "" else None
50+
4951
if self.options.parent_type == 'signet':
50-
import hashlib, random, codecs
51-
from test_framework import script, key, address
5252
from binascii import hexlify
53+
from test_framework import script, key
54+
from test_framework.util import hex_str_to_bytes
55+
import shutil
56+
temp_args = [
57+
"-port=" + str(p2p_port(0)),
58+
"-rpcport=" + str(rpc_port(0)),
59+
"-addresstype=legacy",
60+
"-deprecatedrpc=validateaddress"
61+
]
62+
temp_node = start_node(0, self.options.tmpdir, temp_args, binary=self.binary, chain='signet', cookie_auth=True)
63+
# raise Exception('aaa')
64+
addr = temp_node.getnewaddress()
5365
k = key.CECKey()
54-
pk_bytes = hashlib.sha256(str(random.getrandbits(256)).encode('utf-8')).digest()
55-
k.set_secretbytes(pk_bytes)
56-
wif = address.byte_to_base58(pk_bytes, 217)
66+
pub = temp_node.validateaddress(addr)["pubkey"]
67+
print('pub', pub)
68+
k.set_pubkey(hex_str_to_bytes(pub))
5769
pubkey = key.CPubKey(k.get_pubkey())
70+
wif = temp_node.dumpprivkey(addr)
71+
stop_node(temp_node, 0)
72+
datadir = os.path.join(self.options.tmpdir, 'node0', 'signet')
73+
print('datadir', datadir)
74+
shutil.rmtree(datadir)
75+
76+
# import hashlib, random, codecs
77+
# from test_framework import script, key, address
78+
# from binascii import hexlify
79+
# k = key.CECKey()
80+
# pk_bytes = hashlib.sha256(str(random.getrandbits(256)).encode('utf-8')).digest()
81+
# k.set_secretbytes(pk_bytes)
82+
# wif = address.byte_to_base58(pk_bytes, 217)
83+
# pubkey = key.CPubKey(k.get_pubkey())
5884
script = script.CScript([pubkey, script.OP_CHECKSIG])
5985
blockscript = hexlify(script).decode('ascii')
6086
print('blockscript', blockscript)
6187
print('wif', wif)
6288
# raise Exception('aaa')
63-
blockscript = '4104db082f6133b7d9cdb7be60d8384c818ae61233c20485b438e8c1d7772b7f2dbdc04f2f7273d534df0e6a54c8b333994f6275bb921df2438e9a672438e4ed4969ac'
64-
wif = '8Hh8jNjkx1aSCgEk3iq9Vo2APZUSDQJVt3rJ2BRpb5Tavqb68vW'
89+
# blockscript = '4104db082f6133b7d9cdb7be60d8384c818ae61233c20485b438e8c1d7772b7f2dbdc04f2f7273d534df0e6a54c8b333994f6275bb921df2438e9a672438e4ed4969ac'
90+
# wif = '8Hh8jNjkx1aSCgEk3iq9Vo2APZUSDQJVt3rJ2BRpb5Tavqb68vW'
6591

6692
# import hashlib, random, codecs
6793
# from test_framework import script, key, address
@@ -124,7 +150,6 @@ def setup_network(self, split=False):
124150
if not use_cookie_auth:
125151
self.extra_args[n].extend(["-rpcuser="+rpc_u, "-rpcpassword="+rpc_p])
126152

127-
self.binary = self.options.parent_binpath if self.options.parent_binpath != "" else None
128153
self.nodes.append(start_node(n, self.options.tmpdir, self.extra_args[n], binary=self.binary, chain=self.parent_chain, cookie_auth=use_cookie_auth))
129154
if self.options.parent_type == 'signet':
130155
self.nodes[n].importprivkey(wif)

0 commit comments

Comments
 (0)