Add pegin double spend test to functional test

This commit is contained in:
Steven Roose 2019-05-07 18:41:46 +01:00
parent 7f6351782a
commit 99d8840046
No known key found for this signature in database
GPG key ID: 2F2A88D7F8D68E87

View file

@ -203,6 +203,14 @@ class FedPegTest(BitcoinTestFramework):
# Should succeed via wallet lookup for address match, and when given
pegtxid1 = sidechain.claimpegin(raw, proof)
# Make sure a double spend of the pegin doesn't get accepted while another is in mempool.
try:
pegtxid1 = sidechain.claimpegin(raw, proof)
raise Exception("double spending a pegin should not be accepted in mempool!")
except JSONRPCException as e:
print('RPC ERROR:', e.error['message'])
assert("pegin-already-claimed" in e.error["message"])
# Will invalidate the block that confirms this transaction later
self.sync_all()
blockhash = sidechain2.generate(1)
@ -240,6 +248,14 @@ class FedPegTest(BitcoinTestFramework):
if sidechain.gettransaction(pegtxid1)["confirmations"] != 6:
raise Exception("Peg-in should be back to 6 confirms.")
# Make sure a double spend of the pegin doesn't get accepted while another is confirmed.
try:
pegtxid1 = sidechain.claimpegin(raw, proof)
raise Exception("double spending a pegin should not be accepted in mempool!")
except JSONRPCException as e:
print('RPC ERROR:', e.error['message'])
assert("pegin-already-claimed" in e.error["message"])
# Do multiple claims in mempool
n_claims = 6