Repository navigation
Conversation
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. External sites
ReviewsSee the guideline and AI policy for information on the review process.
If your review is incorrectly listed, please copy-paste LLM Linter (✨ experimental)Possible typos and grammar issues:
2026-06-02 16:02:31 |
rkrux
left a comment
There was a problem hiding this comment.
Concept ACK e588094
Based on a cursory glance, there is a lot of similarity with the other test mentioned in the PR description along with a duplicated method.
Consider merging these two files into one while getting rid of the duplication?
…criptor_psbt 5b65e31 test: remove two unnecessary nodes from the test (rkrux) Pull request description: A discussion in the review of #35443 PR brought this test to my attention. The test needs multiple wallets that can be created on a single node, multiple nodes are not required. As there is a cost associated with setting-up and tearing-down nodes, this patch helps in reducing the test time as well. ACKs for top commit: ekzyis: ACK 5b65e31 polespinasa: lgtm ACK 5b65e31 sedited: ACK 5b65e31 Tree-SHA512: f6b4a96b9beee968ef5438fd9db582a48834ff36ba27c19dd7012902528fa713424212530e34cc16b58c19c023f1accd2b89fe846ef2cc36677c24e160c5b817
rkrux
left a comment
There was a problem hiding this comment.
Please rebase this PR over master, otherwise there's a CMake error in building this branch on local related to the outdate libevent library (which can be worked around by rebasing on local though).
| @@ -0,0 +1,176 @@ | |||
| #!/usr/bin/env python3 | |||
| # Copyright (c) 2024-present The Bitcoin Core developers | |||
| under_signed = multisig.walletcreatefundedpsbt(inputs=[], outputs={receiver.getnewaddress(): amount}, feeRate=0.00010, locktime=0)["psbt"] | ||
| for _ in range(2): | ||
| under_signed = self.node.combinepsbt([signers[m].walletprocesspsbt(under_signed, finalize=False)["psbt"] for m in range(self.N - 1)]) | ||
| assert_equal(self.node.finalizepsbt(under_signed)["complete"], False) |
There was a problem hiding this comment.
Doesn't this assert need to be in the loop?
There was a problem hiding this comment.
Nvm, this seems fine outside the loop to check the final completeness of the PSBT post both the rounds.
|
|
||
| Whenever all four signers are available, the funds are spent through the **key path** using a single key that aggregates the participants. This is the cheapest and most private spend: it looks like any other single-key output and produces just one signature, though it takes two rounds of communication (each signer first contributes a public nonce, then a partial signature, exchanged as PSBTs). The key path remains available at all times — the wallet does not "decay" into needing fewer signers. | ||
|
|
||
| The **script path** is a fallback used only when a key has become inaccessible. Each halvening relaxes that fallback to require one fewer signer (3-of-4, then 2-of-4, then 1-of-4), so a lost key never permanently strands the funds. It is otherwise avoided because revealing the script makes the spend larger and less private. |
There was a problem hiding this comment.
Each halvening
This particular example doesn't contain any halvening related timelocks. It can be avoided in the description as well.
| under_signed = multisig.walletcreatefundedpsbt(inputs=[], outputs={receiver.getnewaddress(): amount}, feeRate=0.00010, locktime=0)["psbt"] | ||
| for _ in range(2): | ||
| under_signed = self.node.combinepsbt([signers[m].walletprocesspsbt(under_signed, finalize=False)["psbt"] for m in range(self.N - 1)]) | ||
| assert_equal(self.node.finalizepsbt(under_signed)["complete"], False) |
There was a problem hiding this comment.
Nvm, this seems fine outside the loop to check the final completeness of the PSBT post both the rounds.
fametrano
left a comment
There was a problem hiding this comment.
tACK e588094
I compared the test's descriptor, its five spends and the new doc/descriptors.md example with code outside Core, on master 49c3c7f with this commit applied. bip32-descriptors, a library I maintain, derives the same receive and change addresses as deriveaddresses at indexes 0 to 19, for the test's descriptor and for the doc example: 80 of 80. btclib's script interpreter accepts all five spends the test broadcasts, each against an output script bip32-descriptors derived. Two are MuSig2 key-path spends. The script-path spends with lock times 104, 106 and 108 carry 3, 2 and 1 signatures and execute 1, 2 and 3 CHECKLOCKTIMEVERIFY. A flipped signature byte makes each spend fail. Raising the first after() by one block changes all 80 addresses.
That seems preferable to me. Why did you not push that instead? |
I preferred this all things considered. Hard to know what most would prefer so I went with what I considered simpler and easier to understand |


This is closely based on test/functional/wallet_miniscript_decaying_multisig_descriptor_psbt.py both in code and concept. It builds the same "decaying" multisig that starts as 4-of-4 and decays to 3-of-4, 2-of-4, and finally 1-of-4 at each future halvening block height, but as a Taproot output, combining Taproot, Miniscript, and MuSig2 in a single descriptor of the form
tr(musig(key_1,key_2,key_3,key_4),thresh(4,pk(key_1),s:pk(key_2),s:pk(key_3),s:pk(key_4),sln:after(t1),sln:after(t2),sln:after(t3))). While every signer is available the 4-of-4 is spent through the Taproot key path using a MuSig2 aggregate of the participants, which is the cheapest and most private spend, while the Miniscript script path is a fallback used only when a key becomes inaccessible, so a lost key never permanently strands the funds and the key path stays available even after the multisig has fully decayed. As with thewshversion the signers are plain single-key wallets and the multisig is watch-only, so everything needed to sign (including the MuSig2 participant pubkeys) is carried in the PSBT and signers never import the multisig descriptor. It serves as integration testing for Taproot, Miniscript, and MuSig2 descriptors working together, and like thewshtest is meant to be documentation as much as a functional test, so it is kept as simple and readable as possible.Note: this thresh-based design has BIP110-invalid script-path spends.
sln:aftercompiles toOP_IFin the tapscript leaf (the key-path spend is unaffected). I implemented an alternative that avoids this by splitting the decay into separate timelockedmulti_atapleaves (noOP_IF) in e0482ec. It's a quick, less-thoroughly-tested implementation, but I wanted to present it in case reviewers prefer that approach.