From 930ff75f33ff68e444995d296fd033baac8322b8 Mon Sep 17 00:00:00 2001 From: "Peter D. Gray" Date: Mon, 24 Feb 2020 14:02:51 -0500 Subject: [PATCH] Accept XPUBs in globals of PSBT for single-signer case --- docs/limitations.md | 2 -- shared/psbt.py | 11 ++++++++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/docs/limitations.md b/docs/limitations.md index f4bc744a..411e58ea 100644 --- a/docs/limitations.md +++ b/docs/limitations.md @@ -61,8 +61,6 @@ - only a single multisig wallet can be involved in a PSBT; can't sign inputs from two different multisig wallets at the same time. - we always store xpubs in BIP32 format, although we can read SLIP132 format (Ypub/Zpub/etc) -- if XPUB values are in the PSBT, we assume it's going to be a multisig transaction signing, so - there must be an unsigned input with M-of-N script: we give unhelpful "Unclear M" error msg. - change outputs (indicated with paths, scripts in output section) must correspond to the active multisig wallet, and cannot be used to describe an unrelated (multisig) wallet. diff --git a/shared/psbt.py b/shared/psbt.py index 8f12c46d..349e9925 100644 --- a/shared/psbt.py +++ b/shared/psbt.py @@ -1011,7 +1011,9 @@ class psbtObject(psbtProxy): return (M, N) - raise AssertionError("unclear M") + # not multisig, probably + return None, None + async def handle_xpubs(self): # Lookup correct wallet based on xpubs in globals @@ -1030,6 +1032,13 @@ class psbtObject(psbtProxy): else: # don't want to guess M if not needed, but we need it M, N = self.guess_M_of_N() + + if not N: + # not multisig, but we can still verify: + # - XFP should be one of ours (checked above). + # - too slow to re-derive it here, so nothing more to validate at this point + return + assert N == len(xfps) if candidates: