Skip to content

Conversation

@landabaso
Copy link
Member

Extend p2ms to support up to 20 public keys (n-of-20 multisig). The previous 16-key cap was only an internal implementation limit, not a Bitcoin rule. In practice, P2SH multisig cannot handle 16 keys anyway due to script-size limits (the effective cap is ~15), but those constraints do not apply to P2WSH. Since p2ms is often wrapped inside P2WSH, the implementation now supports the full 20-key range.

Added new fixtures and a P2MS under P2WSH integration test.

Extend p2ms to support up to 20 public keys (n-of-20 multisig).
The previous 16-key cap was only an internal implementation limit, not a Bitcoin rule.
In practice, P2SH multisig cannot handle 16 keys anyway due to script-size limits (the effective cap is ~15), but those constraints do not apply to P2WSH. Since p2ms is often wrapped inside P2WSH, the implementation now supports the full 20-key range.

Added new fixtures and a P2MS under P2WSH integration test.
@junderw
Copy link
Member

junderw commented Nov 24, 2025

Perhaps we can represent the P2SH limitation in the P2SH payment? Like validate the length of the redeem output etc...?

I'd rather people not get random errors from Bitcoin Core when they broadcast. Those are the most annoying errors to debug.

@landabaso
Copy link
Member Author

landabaso commented Nov 24, 2025

The library already throws an error if you try to build a P2SH-P2MS with more than ~15 pubkeys.
Those checks were added in this PR: #1863

I verified it with integration tests in bitcoinerlab (P2SH with 16 pubkeys throws as expected):
https://github.com/bitcoinerlab/descriptors/blob/ae73d02d73a597ce44209e416300fc4e85a661eb/test/integration/sortedmulti.ts#L202

That PR already included a test for a 16-key P2SH-P2MS case.

If you meant something different, just let me know and I'll address it.

@junderw junderw merged commit 99bb080 into bitcoinjs:master Nov 25, 2025
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants