Merge pull request #1481 from tomt1664/fix/feature_pak_test

test: fix feature_pak.py test
This commit is contained in:
Byron Hambly 2025-08-05 18:29:06 +02:00 committed by GitHub
commit f49f0a2f8a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -109,7 +109,6 @@ class PAKTest (BitcoinTestFramework):
# Node 1 will now make a PAK peg-out, accepted in all mempools and blocks
pegout_info = self.nodes[1].sendtomainchain("", 1)
print(pegout_info)
raw_node1_pegout = self.nodes[1].gettransaction(pegout_info["txid"])["hex"]
self.sync_all() # mempool sync
self.generatetoaddress(self.nodes[1], 1, self.nodes[0].getnewaddress(), sync_fun=self.no_op)
@ -224,7 +223,6 @@ class PAKTest (BitcoinTestFramework):
peg_out_found = False
for output in wpkh_raw["vout"]:
print(output)
if "pegout_address" in output["scriptPubKey"]:
if output["scriptPubKey"]["pegout_address"] == wpkh_info["address_lookahead"][0]:
peg_out_found = True
@ -248,6 +246,8 @@ class PAKTest (BitcoinTestFramework):
for tx_id in [wpkh_txid, sh_wpkh_txid]:
assert_greater_than(self.nodes[1].gettransaction(tx_id)["confirmations"], 0)
self.sync_blocks()
self.log.info("Test that pak-less pegouts are rejected")
# Last test of a pak-less peg-out failing to get into mempool/block
@ -256,7 +256,10 @@ class PAKTest (BitcoinTestFramework):
# node 0 will now create a pegout, will fail to enter mempool of node 1 or 2
# since it's pak-less
nopak_pegout_txid = self.nodes[0].sendtomainchain("n3NkSZqoPMCQN5FENxUBw4qVATbytH6FDK", 1)
pegout_address = "n3NkSZqoPMCQN5FENxUBw4qVATbytH6FDK"
nopak_pegout_txid = self.nodes[0].sendtomainchain(pegout_address, 1)
pegout_tx = self.nodes[0].gettransaction(nopak_pegout_txid,True,True)
assert_equal(pegout_tx["decoded"]["vout"][[d["value"] for d in pegout_tx["decoded"]["vout"]].index(1)]["scriptPubKey"]["pegout_address"],pegout_address)
raw_pakless_pegout = self.nodes[0].gettransaction(nopak_pegout_txid)["hex"]
assert nopak_pegout_txid in self.nodes[0].getrawmempool()