Skip to content

Commit

Permalink
fix: follow-up Merge bitcoin#20267: Disable and fix tests for when BD…
Browse files Browse the repository at this point in the history
…B is not compiled

Missing changes in feature_notification.py so far as bitcoin#18878 is done

Setup wallets with descriptors for feature_notifications
  • Loading branch information
achow101 authored and knst committed Oct 24, 2024
1 parent ad2c5a5 commit 1b6baa5
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions test/functional/feature_notifications.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 1b6baa5

Please sign in to comment.