mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-18 13:17:55 +02:00
withdrawlocks do not need any maturing, test mempool access
This commit is contained in:
parent
9823c8889c
commit
90ee152c93
1 changed files with 18 additions and 8 deletions
|
|
@ -114,13 +114,17 @@ try:
|
|||
|
||||
# Lockup some funds to unlock later
|
||||
sidechain.sendtomainchain(addr, 50)
|
||||
sidechain.generate(101)
|
||||
# Tests withdrawlock tracking in database
|
||||
sidechain.generate(1)
|
||||
# Tests withdrawlock in mempool
|
||||
sidechain.sendtomainchain(addr, 50)
|
||||
|
||||
addrs = sidechain.getpeginaddress()
|
||||
txid = bitcoin.sendtoaddress(addrs["mainchain_address"], 49)
|
||||
txid1 = bitcoin.sendtoaddress(addrs["mainchain_address"], 24)
|
||||
txid2 = bitcoin.sendtoaddress(addrs["mainchain_address"], 24)
|
||||
bitcoin.generate(10)
|
||||
proof = bitcoin.gettxoutproof([txid])
|
||||
raw = bitcoin.getrawtransaction(txid)
|
||||
proof = bitcoin.gettxoutproof([txid1])
|
||||
raw = bitcoin.getrawtransaction(txid1)
|
||||
|
||||
print("Attempting peg-in")
|
||||
|
||||
|
|
@ -132,8 +136,13 @@ try:
|
|||
pass
|
||||
|
||||
timeout = 20
|
||||
# Should succeed via wallet lookup for address match
|
||||
pegtxid = sidechain.claimpegin(raw, proof)
|
||||
# Both should succeed via wallet lookup for address match, and when given
|
||||
pegtxid1 = sidechain.claimpegin(raw, proof)
|
||||
|
||||
proof = bitcoin.gettxoutproof([txid2])
|
||||
raw = bitcoin.getrawtransaction(txid2)
|
||||
pegtxid2 = sidechain.claimpegin(raw, proof, addrs["sidechain_address"])
|
||||
|
||||
while len(sidechain.getrawmempool()) != len(sidechain2.getrawmempool()):
|
||||
time.sleep(1)
|
||||
timeout -= 1
|
||||
|
|
@ -147,9 +156,10 @@ try:
|
|||
raise Exception("Blocks are not propagating.")
|
||||
|
||||
|
||||
tx = sidechain.gettransaction(pegtxid)
|
||||
tx1 = sidechain.gettransaction(pegtxid1)
|
||||
tx2 = sidechain.gettransaction(pegtxid2)
|
||||
|
||||
if "confirmations" in tx and tx["confirmations"] > 0:
|
||||
if "confirmations" in tx1 and tx1["confirmations"] > 0 and "confirmations" in tx2 and tx2["confirmations"] > 0:
|
||||
print("Peg-in is confirmed: Success!")
|
||||
else:
|
||||
raise Exception("Peg-in confirmation has failed.")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue