Skip to content

Commit d215bf7

Browse files
committed
test: fix feature_tapscript_opcodes.py
The first transaction from create_taproot_utxo 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 8ccb3e1 commit d215bf7

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

test/functional/feature_tapscript_opcodes.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ def create_taproot_utxo(self, scripts = None, blind = False):
9696
self.nodes[0].sendrawtransaction(signed_raw_tx['hex'])
9797
tx = tx_from_hex(signed_raw_tx['hex'])
9898
tx.rehash()
99-
self.nodes[0].generate(1)
99+
self.generate(self.nodes[0], 1)
100100
last_blk = self.nodes[0].getblock(self.nodes[0].getbestblockhash())
101101
assert(tx.hash in last_blk['tx'])
102102

@@ -118,7 +118,7 @@ def tapscript_satisfy_test(self, script, inputs = None, add_issuance = False,
118118
peg_id = self.nodes[0].sendtoaddress(fund_info["mainchain_address"], 1)
119119
raw_peg_tx = self.nodes[0].gettransaction(peg_id)["hex"]
120120
peg_txid = self.nodes[0].sendrawtransaction(raw_peg_tx)
121-
self.nodes[0].generate(101)
121+
self.generate(self.nodes[0], 101)
122122
peg_prf = self.nodes[0].gettxoutproof([peg_txid])
123123
claim_script = fund_info["claim_script"]
124124

@@ -249,15 +249,19 @@ def tapscript_satisfy_test(self, script, inputs = None, add_issuance = False,
249249

250250

251251
self.nodes[0].sendrawtransaction(hexstring = tx.serialize().hex())
252-
self.nodes[0].generate(1)
252+
self.generate(self.nodes[0], 1)
253253
last_blk = self.nodes[0].getblock(self.nodes[0].getbestblockhash())
254254
tx.rehash()
255255
assert(tx.hash in last_blk['tx'])
256256

257257

258258
def run_test(self):
259-
self.nodes[0].generate(101)
259+
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
262+
self.nodes[0].sendtoaddress(self.nodes[0].getnewaddress(), 50)
263+
self.generate(self.nodes[0], 1)
264+
261265
# Test whether the above test framework is working
262266
self.log.info("Test simple op_1")
263267
self.tapscript_satisfy_test(CScript([OP_1]))

test/functional/test_runner.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@
145145
'wallet_signer.py --descriptors',
146146
# ELEMENTS: FIXME failing tests
147147
# 'feature_taphash_pegins_issuances.py',
148-
# 'feature_tapscript_opcodes.py',
148+
'feature_tapscript_opcodes.py',
149149
# vv Tests less than 60s vv
150150
'p2p_sendheaders.py',
151151
'wallet_importmulti.py --legacy-wallet',

0 commit comments

Comments
 (0)