Skip to content

Commit

Permalink
WIP feature_fedpeg with bitoind
Browse files Browse the repository at this point in the history
  • Loading branch information
stevenroose committed Sep 24, 2018
1 parent 1920d84 commit 28b89bf
Showing 1 changed file with 34 additions and 3 deletions.
37 changes: 34 additions & 3 deletions qa/rpc-tests/feature_fedpeg.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/usr/bin/env python3

from decimal import Decimal
import os
import json
import time

Expand All @@ -10,6 +11,7 @@
connect_nodes_bi,
rpc_auth_pair,
rpc_port,
p2p_port,
start_node,
start_nodes,
stop_node,
Expand Down Expand Up @@ -47,9 +49,30 @@ def __init__(self):
self.setup_clean_chain = True
self.num_nodes = 4

def setup_network(self, split=False):
def add_options(self, parser):
parser.add_option("--bitcoinddir", dest="bitcoinddir", default="",
help="Use the bitcoind binary in the given directory")

# Parent chain args
def setup_parents_bitcoin(self):
self.extra_args = [[
"-regtest=1",
"-port="+str(p2p_port(n)),
"-rpcuser="+rpc_auth_pair(n)[0],
"-rpcpassword="+rpc_auth_pair(n)[1],
"-rpcport="+str(rpc_port(n)),
"-testnet=0",
"-txindex=1",
"-addresstype=legacy", # To make sure bitcoind gives back p2pkh no matter version
"-connect=localhost:"+str(p2p_port((n+1)%2)),
"-listen=1",
#"-debug"
] for n in range(2)]

binary = os.path.join(self.options.bitcoinddir, "bitcoind")
self.nodes = start_nodes(2, self.options.tmpdir, self.extra_args[:2], binary=binary, chain="regtest")
connect_nodes_bi(self.nodes, 0, 1)

def setup_parents_elements(self):
self.extra_args = [[
# '-printtoconsole',
'-validatepegin=0',
Expand All @@ -59,9 +82,17 @@ def setup_network(self, split=False):

self.nodes = start_nodes(2, self.options.tmpdir, self.extra_args[:2], chain='parent')
connect_nodes_bi(self.nodes, 0, 1)

def setup_network(self, split=False):

# Parent chain args
if self.options.bitcoinddir != "":
self.setup_parents_bitcoin()
else:
self.setup_parents_elements()
parent_pegged_asset = self.nodes[0].getsidechaininfo()['pegged_asset']
self.parentgenesisblockhash = self.nodes[0].getblockhash(0)
print('parentgenesisblockhash', self.parentgenesisblockhash)
parent_pegged_asset = self.nodes[0].getsidechaininfo()['pegged_asset']

# Sidechain args
parent_chain_signblockscript = '51'
Expand Down

0 comments on commit 28b89bf

Please sign in to comment.