From 1b6baa58994ad596c7d8da1cf193146d6fecd4f2 Mon Sep 17 00:00:00 2001 From: Andrew Chow Date: Thu, 29 Oct 2020 16:37:05 -0400 Subject: [PATCH] fix: follow-up Merge #20267: Disable and fix tests for when BDB is not compiled Missing changes in feature_notification.py so far as #18878 is done Setup wallets with descriptors for feature_notifications --- test/functional/feature_notifications.py | 32 ++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/test/functional/feature_notifications.py b/test/functional/feature_notifications.py index 8ef3720ff9bdc..82ffa2c22d30f 100755 --- a/test/functional/feature_notifications.py +++ b/test/functional/feature_notifications.py @@ -8,6 +8,7 @@ from test_framework.address import ADDRESS_BCRT1_UNSPENDABLE +from test_framework.descriptors import descsum_create from test_framework.test_framework import DashTestFramework from test_framework.util import ( assert_equal, @@ -65,6 +66,37 @@ def run_test(self): for tx_file in os.listdir(self.walletnotify_dir): os.remove(os.path.join(self.walletnotify_dir, tx_file)) + if self.is_wallet_compiled(): + # Setup the descriptors to be imported to the wallet + seed = "cTdGmKFWpbvpKQ7ejrdzqYT2hhjyb3GPHnLAK7wdi5Em67YLwSm9" + xpriv = "tprv8ZgxMBicQKsPfHCsTwkiM1KT56RXbGGTqvc2hgqzycpwbHqqpcajQeMRZoBD35kW4RtyCemu6j34Ku5DEspmgjKdt2qe4SvRch5Kk8B8A2v" + desc_imports = [{ + "desc": descsum_create("pkh(" + xpriv + "/0/*)"), + "timestamp": 0, + "active": True, + "keypool": True, + },{ + "desc": descsum_create("pkh(" + xpriv + "/1/*)"), + "timestamp": 0, + "active": True, + "keypool": True, + "internal": True, + }] + # Make the wallets and import the descriptors + # Ensures that node 0 and node 1 share the same wallet for the conflicting transaction tests below. + + # TODO: remove this flag when DashTestFramework will be compatible with setup_clean_chain = True + # and set_dash_test_params; otherwise wallets created during initialization and sethdseed can't be called anymore + workaround_fixed_setup_clean_chain = False + for i, name in enumerate(self.wallet_names): + if workaround_fixed_setup_clean_chain: + self.nodes[i].createwallet(wallet_name=name, descriptors=self.options.descriptors, blank=True, load_on_startup=True) + if self.options.descriptors: + self.nodes[i].importdescriptors(desc_imports) + else: + if workaround_fixed_setup_clean_chain: + self.nodes[i].sethdseed(True, seed) + self.log.info("test -blocknotify") block_count = 10 blocks = self.generatetoaddress(self.nodes[1], block_count, self.nodes[1].getnewaddress() if self.is_wallet_compiled() else ADDRESS_BCRT1_UNSPENDABLE)