Skip to content

Commit ec4c2a4

Browse files
committed
test: fix feature_taphash_pegins_issuances.py
The first transaction was failing with bad-txns-inputs-missingorspent because the "input" selected with fundrawtransaction was the anyonecanspend initialfreecoins. Fixed by first spending the initialfreecoins to "real" outputs.
1 parent d215bf7 commit ec4c2a4

File tree

3 files changed

+10
-8
lines changed

3 files changed

+10
-8
lines changed

test/functional/feature_taphash_pegins_issuances.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ def create_taproot_utxo(self):
8080
self.nodes[0].sendrawtransaction(signed_raw_tx['hex'])
8181
tx = tx_from_hex(signed_raw_tx['hex'])
8282
tx.rehash()
83-
self.nodes[0].generate(1)
83+
self.generate(self.nodes[0], 1)
8484
last_blk = self.nodes[0].getblock(self.nodes[0].getbestblockhash())
8585
assert(tx.hash in last_blk['tx'])
8686

@@ -95,7 +95,7 @@ def pegin_test(self, sighash_ty):
9595
peg_id = self.nodes[0].sendtoaddress(fund_info["mainchain_address"], 1)
9696
raw_peg_tx = self.nodes[0].gettransaction(peg_id)["hex"]
9797
peg_txid = self.nodes[0].sendrawtransaction(raw_peg_tx)
98-
self.nodes[0].generate(101)
98+
self.generate(self.nodes[0], 101)
9999
peg_prf = self.nodes[0].gettxoutproof([peg_txid])
100100
claim_script = fund_info["claim_script"]
101101

@@ -126,7 +126,7 @@ def pegin_test(self, sighash_ty):
126126
assert(verify_schnorr(pub_tweak, sig, msg))
127127
# Since we add in/outputs the min feerate is no longer maintained.
128128
self.nodes[0].sendrawtransaction(hexstring = raw_claim.serialize().hex())
129-
self.nodes[0].generate(1)
129+
self.generate(self.nodes[0], 1)
130130
last_blk = self.nodes[0].getblock(self.nodes[0].getbestblockhash())
131131
raw_claim.rehash()
132132
assert(raw_claim.hash in last_blk['tx'])
@@ -166,15 +166,18 @@ def issuance_test(self, sighash_ty):
166166
assert(verify_schnorr(pub_tweak, sig, msg))
167167
# Since we add in/outputs the min feerate is no longer maintained.
168168
self.nodes[0].sendrawtransaction(hexstring = issued_tx.serialize().hex())
169-
self.nodes[0].generate(1)
169+
self.generate(self.nodes[0], 1)
170170
last_blk = self.nodes[0].getblock(self.nodes[0].getbestblockhash())
171171
issued_tx.rehash()
172172
assert(issued_tx.hash in last_blk['tx'])
173173

174174

175175
def run_test(self):
176-
self.nodes[0].generate(101)
176+
self.generate(self.nodes[0], 101)
177177
self.wait_until(lambda: self.nodes[0].getblockcount() == 101, timeout=5)
178+
# spend the initialfreecoins to node0, to fix bad-txns-inputs-missingorspent error
179+
self.nodes[0].sendtoaddress(self.nodes[0].getnewaddress(), 50)
180+
self.generate(self.nodes[0], 1)
178181
self.log.info("Testing sighash taproot pegins")
179182
# Note that this does not test deposit to taproot pegin addresses
180183
# because there is no support for taproot pegins in rpc. The current rpc assumes

test/functional/feature_tapscript_opcodes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ def tapscript_satisfy_test(self, script, inputs = None, add_issuance = False,
258258
def run_test(self):
259259
self.generate(self.nodes[0], 101)
260260
self.wait_until(lambda: self.nodes[0].getblockcount() == 101, timeout=5)
261-
# spend the initialfreecoins to node0, to fix bad-txns-inputs-missingorspent error when creating the first taproot utxo
261+
# ELEMENTS: spend the initialfreecoins to node0, to fix bad-txns-inputs-missingorspent error when creating the first taproot utxo
262262
self.nodes[0].sendtoaddress(self.nodes[0].getnewaddress(), 50)
263263
self.generate(self.nodes[0], 1)
264264

test/functional/test_runner.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,7 @@
143143
'feature_taproot.py',
144144
'rpc_signer.py',
145145
'wallet_signer.py --descriptors',
146-
# ELEMENTS: FIXME failing tests
147-
# 'feature_taphash_pegins_issuances.py',
146+
'feature_taphash_pegins_issuances.py',
148147
'feature_tapscript_opcodes.py',
149148
# vv Tests less than 60s vv
150149
'p2p_sendheaders.py',

0 commit comments

Comments
 (0)