Skip to content

Commit

Permalink
SQUASH: Adapt signet fedpeg test to #433
Browse files Browse the repository at this point in the history
  • Loading branch information
jtimon committed Oct 16, 2018
1 parent 23cb9ae commit 6ba0d07
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 9 deletions.
27 changes: 19 additions & 8 deletions qa/rpc-tests/feature_fedpeg.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,23 +57,30 @@ def setup_network(self, split=False):
"-port=" + str(p2p_port(0)),
"-rpcport=" + str(rpc_port(0)),
"-addresstype=legacy",
"-deprecatedrpc=validateaddress"
"-deprecatedrpc=validateaddress",
"-bech32_hrp=sb",
"-pchmessagestart=F0C7706A",
"-pubkeyprefix=125",
"-scriptprefix=87",
"-secretprefix=217",
"-extpubkeyprefix=043587CF",
"-extprvkeyprefix=04358394",
]
temp_node = start_node(0, self.options.tmpdir, temp_args, binary=self.binary, chain='signet', cookie_auth=True)
temp_node = start_node(0, self.options.tmpdir, temp_args, binary=self.binary, chain='temp', cookie_auth=True)
addr = temp_node.getnewaddress()
k = key.CECKey()
pub = temp_node.validateaddress(addr)["pubkey"]
k.set_pubkey(hex_str_to_bytes(pub))
pubkey = key.CPubKey(k.get_pubkey())
wif = temp_node.dumpprivkey(addr)
stop_node(temp_node, 0)
shutil.rmtree(os.path.join(self.options.tmpdir, 'node0', 'signet'))
script = script.CScript([pubkey, script.OP_CHECKSIG])
blockscript = hexlify(script).decode('ascii')

print('blockscript', blockscript)
print('wif', wif)

self.parent_chain = self.options.parent_type
# Parent chain args
for n in range(2):
# We want to test the rpc cookie method so we force the use of a
Expand All @@ -88,32 +95,36 @@ def setup_network(self, split=False):
"-addresstype=legacy", # To make sure bitcoind gives back p2pkh no matter version
"-deprecatedrpc=validateaddress",
"-port="+str(p2p_port(n)),
"-rpcport="+str(rpc_port(n))
"-rpcport="+str(rpc_port(n)),
])
elif self.options.parent_type == 'signet':
self.parent_chain = 'signet'
rpc_u, rpc_p = rpc_auth_pair(n)
self.extra_args.append([
"-printtoconsole=0",
"-signet_blockscript=%s" % blockscript,
"-signet_siglen=77",
"-signet_seednode=178.128.221.177",
"-port=" + str(p2p_port(n)),
"-rpcport=" + str(rpc_port(n)),
"-addresstype=legacy", # To make sure bitcoind gives back p2pkh no matter version
"-deprecatedrpc=validateaddress",
"-fallbackfee=0.00001",
"-bech32_hrp=sb",
"-pchmessagestart=F0C7706A",
"-pubkeyprefix=125",
"-scriptprefix=87",
"-secretprefix=217",
"-extpubkeyprefix=043587CF",
"-extprvkeyprefix=04358394",
])
elif self.options.parent_type == 'elements':
self.parent_chain = 'parent'
self.extra_args.append([
"-conf=dummy",
"-printtoconsole=0",
'-validatepegin=0',
'-anyonecanspendaremine',
'-initialfreecoins=2100000000000000',
"-port="+str(p2p_port(n)),
"-rpcport="+str(rpc_port(n))
"-rpcport="+str(rpc_port(n)),
])
# Only first parent uses name/password, the 2nd uses cookie auth
if not use_cookie_auth:
Expand Down
2 changes: 1 addition & 1 deletion qa/rpc-tests/test_framework/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ def start_node(i, dirname, extra_args=None, rpchost=None, timewait=None, binary=
if binary is None:
binary = os.getenv("ELEMENTSD", "elementsd")
args = [ binary, "-datadir="+datadir, "-server", "-keypool=1", "-discover=0", "-rest", "-mocktime="+str(get_mocktime()) ]
args.append('-regtest' if chain == 'regtest' else '-signet' if chain == 'signet' else '-chain=' + chain)
args.append('-regtest' if chain == 'regtest' else '-chain=' + chain)
if extra_args is not None: args.extend(extra_args)
bitcoind_processes[i] = subprocess.Popen(args)
if os.getenv("PYTHON_DEBUG", ""):
Expand Down

0 comments on commit 6ba0d07

Please sign in to comment.