Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: fix tests broken by change to getpeginaddress #1330

Merged
merged 1 commit into from
May 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion test/functional/rpc_tweakfedpeg.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,14 @@ def skip_test_if_missing_module(self):
def run_test(self):
# Test that OP_TRUE mainchain_addr/claim_script never changes
assert_equal(self.nodes[0].getsidechaininfo()["fedpegscript"], OP_TRUE_SCRIPT)
self.generate(self.nodes[0], 1, sync_fun=self.no_op) # just to get node out of ibd
pegin_addr = self.nodes[0].getpeginaddress()
for _ in range(5):
assert_equal(pegin_addr["mainchain_address"], self.nodes[0].getpeginaddress()["mainchain_address"])
assert_equal(self.nodes[0].tweakfedpegscript(pegin_addr["claim_script"])["script"], OP_TRUE_SCRIPT)

# Test that OP_CMS has all keys change and matches elements-0.14 example
self.generate(self.nodes[1], 1, sync_fun=self.no_op)
pegin_addr = self.nodes[1].getpeginaddress()
assert_equal(self.nodes[1].getsidechaininfo()["fedpegscript"], OP_CMS_SCRIPT)
nontweak_decoded = self.nodes[1].decodescript(OP_CMS_SCRIPT)["asm"]
Expand All @@ -61,6 +63,7 @@ def run_test(self):
"522102f5bc6bc407187d06854005c366b84b411534757f4503587cf335645a620f896a2102fd90164e4e7d53417e4eacfa3f86fd39fe40594791758739e8af31eeea4e79c552ae")

# Test Liquid-style fedpegscript with CSV emergency keys(which don't get tweaked!)
self.generate(self.nodes[2], 1, sync_fun=self.no_op)
pegin_addr = self.nodes[2].getpeginaddress()
assert_equal(self.nodes[2].getsidechaininfo()["fedpegscript"], LIQUID_SCRIPT)
nontweak_decoded = self.nodes[2].decodescript(LIQUID_SCRIPT)["asm"]
Expand All @@ -86,7 +89,7 @@ def run_test(self):
# Advance to dynamic federations activation, which has pubkeys
# after OP_ELSE get tweaked except the exact liquidv1 template to
# maintain compatibility
self.generate(self.nodes[2], 433, sync_fun=self.no_op)
self.generate(self.nodes[2], 432, sync_fun=self.no_op)
assert_equal(self.nodes[2].getdeploymentinfo()['deployments']['dynafed']['bip9']['status'], 'active')
assert_equal(self.nodes[2].tweakfedpegscript(claim_script)["script"], liquid_tweaked)

Expand Down
1 change: 1 addition & 0 deletions test/functional/wallet_elements_regression_1263.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ def run_test(self):
self.log.info("Start in Bitcoin regtest mode")
self.nodes[0].createwallet("pegin")
rpc = self.nodes[0].get_wallet_rpc("pegin")
self.generatetoaddress(self.nodes[0], 1, rpc.getnewaddress())

self.log.info("Call getpeginaddress")
assert_raises_rpc_error(-32603, "No valid fedpegscripts. Not running in Elements mode, check your 'chain' param.", rpc.getpeginaddress)
Expand Down