From 3afb2f981fb1ba24a74968631ae45fd091657677 Mon Sep 17 00:00:00 2001 From: Sjors Provoost Date: Mon, 29 Nov 2021 15:11:10 +0700 Subject: [PATCH] test: use getxpub in wallet_multisig_descriptor_psbt.py --- test/functional/wallet_multisig_descriptor_psbt.py | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/test/functional/wallet_multisig_descriptor_psbt.py b/test/functional/wallet_multisig_descriptor_psbt.py index 68bf45f7e34877..8dc052aa3a803f 100755 --- a/test/functional/wallet_multisig_descriptor_psbt.py +++ b/test/functional/wallet_multisig_descriptor_psbt.py @@ -29,12 +29,6 @@ def skip_test_if_missing_module(self): self.skip_if_no_wallet() self.skip_if_no_sqlite() - @staticmethod - def _get_xpub(wallet): - """Extract the wallet's xpubs using `listdescriptors` and pick the one from the `pkh` descriptor since it's least likely to be accidentally reused (legacy addresses).""" - descriptor = next(filter(lambda d: d["desc"].startswith("pkh"), wallet.listdescriptors()["descriptors"])) - return descriptor["desc"].split("]")[-1].split("/")[0] - @staticmethod def _check_psbt(psbt, to, value, multisig): """Helper function for any of the N participants to check the psbt with decodepsbt and verify it is OK before signing.""" @@ -93,7 +87,9 @@ def run_test(self): } self.log.info("Generate and exchange xpubs...") - xpubs = [self._get_xpub(signer) for signer in participants["signers"]] + # Reuse `pkh` descriptor keys, since it's least likely to be accidentally reused (legacy addresses) + # TODO: use BIP87's recommended m/87'/1'/0' once importdescriptors can infer private keys for arbitrary derivations + xpubs = [signer.getxpub("m/44'/1'/0'")["xpub"] for signer in participants["signers"]] self.log.info("Every participant imports the following descriptors to create the watch-only multisig...") participants["multisigs"] = list(self.participants_create_multisigs(xpubs))