You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
sortedmulti: simplify constructor and improve unit test
Update the constructor to avoid calling Miniscript::from_ast, which can
return many kinds of errors, none of which are reachable. Instead call
Miniscript::multi and then do a validation check once this is
constructed.
There is a comment in the constructor explaining why the validation is
needed: it may be that an otherwise-valid checkmultisig script could
exceed the 520-byte limit for p2sh outputs.
HOWEVER, we have no test for this behavior, and when trying to test it,
I found several issues. One, that our accounting for uncompressed keys
is wrong, I fixed in the previous commits.
The others are:
1. In the existing unit test we try to create a sortedmulti with 21 keys,
violating the constructor for Threshold. This is a fine test...
2. ...except that we set k == 0 which makes the constructor fail no matter
what n is, so we're not actually testing "too many keys".
3. Furthermore, we have no test at all that tries to exceed the P2SH
limits, and when I added one I was able to exceed these limits
because of the type system bugs fixed in the last two commits.
0 commit comments