Skip to content

Commit

Permalink
test fixups
Browse files Browse the repository at this point in the history
  • Loading branch information
instagibbs committed Sep 25, 2018
1 parent e380a7f commit af19891
Showing 1 changed file with 8 additions and 13 deletions.
21 changes: 8 additions & 13 deletions qa/rpc-tests/feature_fedpeg.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
stop_node,
)

fedpeg_script="512103dff4923d778550cc13ce0d887d737553b4b58f4e8e886507fc39f5e447b2186451ae"

# Sync mempool, make a block, sync blocks
def sync_all(sidechain, sidechain2, makeblock=True):
block = ""
Expand Down Expand Up @@ -63,7 +65,7 @@ def start_node(self, idx):

def setup_network(self, split=False):
if self.options.parent_bitcoin and self.options.parent_binpath == "":
raise "Can't run with --parent_bitcoin without specifying --parent_binpath"
raise Exception("Can't run with --parent_bitcoin without specifying --parent_binpath")

self.nodes = []
self.extra_args = []
Expand Down Expand Up @@ -107,6 +109,7 @@ def setup_network(self, split=False):
# '-printtoconsole',
'-parentgenesisblockhash=%s' % self.parentgenesisblockhash,
'-validatepegin=1',
'-fedpegscript='+fedpeg_script,
'-anyonecanspendaremine=0',
'-initialfreecoins=0',
'-peginconfirmationdepth=10',
Expand Down Expand Up @@ -186,21 +189,13 @@ def run_test(self):
print('ERROR:', e.error)
assert("Peg-in Bitcoin transaction needs more confirmations to be sent." in e.error["message"])

# Should fail due to non-witness
# Should fail due to non-matching wallet address
try:
pegtxid = sidechain.claimpegin(raw, proof, get_new_unconfidential_address(sidechain))
pegtxid = sidechain.claimpegin(raw, proof, sidechain.validateaddress(get_new_unconfidential_address(sidechain))["scriptPubKey"])
raise Exception("Peg-in with non-matching claim_script should fail.")
except JSONRPCException as e:
print('ERROR:', e.error)
assert("Given or recovered script is not a witness program." in e.error["message"])

# # Should fail due to non-matching wallet address
# try:
# pegtxid = sidechain.claimpegin(raw, proof, get_new_unconfidential_address(sidechain))
# raise Exception("Peg-in with non-matching claim_script should fail.")
# except JSONRPCException as e:
# print(e.error["message"])
# assert("Given claim_script does not match the given Bitcoin transaction." in e.error["message"])
print(e.error["message"])
assert("Given claim_script does not match the given Bitcoin transaction." in e.error["message"])

# 12 confirms allows in mempool
parent.generate(1)
Expand Down

0 comments on commit af19891

Please sign in to comment.