Accept XPUBs in globals of PSBT for single-signer case

This commit is contained in:
Peter D. Gray 2020-02-24 14:02:51 -05:00
parent 262fb59f4d
commit 930ff75f33
2 changed files with 10 additions and 3 deletions

View File

@ -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.

View File

@ -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: