tapscript with time-locked musig2 #34076

issue scgbckbone openend this issue on December 15, 2025
  1. scgbckbone commented at 12:14 pm on December 15, 2025: contributor

    Is there an existing issue for this?

    • I have searched the existing issues

    Current behaviour

    Trying to import descriptor with time-locked musig fragment in tapscript returns:

    0error code: -5
    1error message:
    2Invalid musig() expression
    

    Expected behaviour

    Import should work.

    Steps to reproduce

    try getdescriptorinfo with following BIP-388 policy:

    tr(musig(@0,@1,@2)/**,{and_v(v:pk(musig(@0,@1)/**),older(12960)),{and_v(v:pk(musig(@0,@2)/**),older(12960)),and_v(v:pk(musig(@1,@2)/**),older(12960))}})

    which translates (for example) to following descriptor:

    0tr(musig([a471be2d/88h/1h/0h]tpubDCyTVDMyRxsEeAf7KLPRfUZkSCCjsZPqZoM2Ay3FqtH55CxvTchpK2DSbTgVRziFGesGGibdsfC4BktGNUMwb4VjGwu2KuzDCp9A97rVH8q,[0f056943/88h/1h/0h]tpubDD8WTkCBJwj5WHR8S1gr2y64LcFSwEic38zGRKEuHXUUPRacZyTREJp9vZ5fayGVqEzzBacffrkK1g4CJRA5PgXE7MkrsLcUWbeixkLaNM6,[6b69e5e9/88h/1h/0h]tpubDCMSPy71rEscssSimZNZ3S1Z2aguLeeLbguzDUXJVfwiCxuAE88omLcd95895x9au5Tw81bCuPhNcmSCzp2Yz13EReNHduoFKc4f1VNs7VG)/<0;1>/*,{and_v(v:pk(musig([6b69e5e9/88h/1h/0h]tpubDCMSPy71rEscssSimZNZ3S1Z2aguLeeLbguzDUXJVfwiCxuAE88omLcd95895x9au5Tw81bCuPhNcmSCzp2Yz13EReNHduoFKc4f1VNs7VG,[a471be2d/88h/1h/0h]tpubDCyTVDMyRxsEeAf7KLPRfUZkSCCjsZPqZoM2Ay3FqtH55CxvTchpK2DSbTgVRziFGesGGibdsfC4BktGNUMwb4VjGwu2KuzDCp9A97rVH8q)/<0;1>/*),older(12960)),{and_v(v:pk(musig([6b69e5e9/88h/1h/0h]tpubDCMSPy71rEscssSimZNZ3S1Z2aguLeeLbguzDUXJVfwiCxuAE88omLcd95895x9au5Tw81bCuPhNcmSCzp2Yz13EReNHduoFKc4f1VNs7VG,[0f056943/88h/1h/0h]tpubDD8WTkCBJwj5WHR8S1gr2y64LcFSwEic38zGRKEuHXUUPRacZyTREJp9vZ5fayGVqEzzBacffrkK1g4CJRA5PgXE7MkrsLcUWbeixkLaNM6)/<0;1>/*),older(12960)),and_v(v:pk(musig([a471be2d/88h/1h/0h]tpubDCyTVDMyRxsEeAf7KLPRfUZkSCCjsZPqZoM2Ay3FqtH55CxvTchpK2DSbTgVRziFGesGGibdsfC4BktGNUMwb4VjGwu2KuzDCp9A97rVH8q,[0f056943/88h/1h/0h]tpubDD8WTkCBJwj5WHR8S1gr2y64LcFSwEic38zGRKEuHXUUPRacZyTREJp9vZ5fayGVqEzzBacffrkK1g4CJRA5PgXE7MkrsLcUWbeixkLaNM6)/<0;1>/*),older(12960))}})
    

    (imo) error is caused by the first leaf where expr after split is missing terminating parentheses of musig expression https://github.com/bitcoin/bitcoin/blob/2210feb4466eff1455468f0a25045fce4b89c55d/src/script/descriptor.cpp#L1844-L1847

    OR use below patch to add test case to musig functional tests:

     0Subject: [PATCH] test
     1---
     2Index: test/functional/wallet_musig.py
     3IDEA additional info:
     4Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
     5<+>UTF-8
     6===================================================================
     7diff --git a/test/functional/wallet_musig.py b/test/functional/wallet_musig.py
     8--- a/test/functional/wallet_musig.py	(revision 2210feb4466eff1455468f0a25045fce4b89c55d)
     9+++ b/test/functional/wallet_musig.py	(date 1765796643152)
    10@@ -236,6 +236,7 @@
    11         self.do_test("tr(H,{pk(musig/*), pk(same keys different musig/*)})", "tr($H,{pk(musig($0,$1,$2)/<0;1>/*),pk(musig($1,$2)/0/*)})", scriptpath=True)
    12         self.do_test("tr(musig/*,{pk(partial keys diff musig-1/*),pk(partial keys diff musig-2/*)})}", "tr(musig($0,$1,$2)/<3;4>/*,{pk(musig($0,$1)/<5;6>/*),pk(musig($1,$2)/7/*)})")
    13         self.do_test("tr(musig/*,{pk(partial keys diff musig-1/*),pk(partial keys diff musig-2/*)})} script-path", "tr(musig($0,$1,$2)/<3;4>/*,{pk(musig($0,$1)/<5;6>/*),pk(musig($1,$2)/7/*)})", scriptpath=True, nosign_wallets=[0])
    14+        self.do_test("time-locked musig", "tr(musig($0,$1,$2)/<0;1>/*,{and_v(v:pk(musig($0,$1)/<0;1>/*),older(12960)),{and_v(v:pk(musig($0,$2)/<0;1>/*),older(12960)),and_v(v:pk(musig($1,$2)/<0;1>/*),older(12960))}})", scriptpath=True)
    15 
    16 
    17 if __name__ == '__main__':
    

    Relevant log output

    No response

    How did you obtain Bitcoin Core

    Compiled from source

    What version of Bitcoin Core are you using?

    master@2210feb4466eff1455468f0a25045fce4b89c55d

    Operating system and version

    Linux … 6.14.0-37-generic #37~24.04.1-Ubuntu … x86_64 x86_64 x86_64 GNU/Linux

    Machine specifications

    No response

  2. scgbckbone commented at 1:32 pm on December 15, 2025: contributor

    (imo) error is caused by the first leaf where expr after split is missing terminating parentheses of musig expression

    actually it is not after split… ParsePubkey parameter sp already lacks terminating ) of musig expression, therefore split.size() is 1

  3. achow101 commented at 2:32 am on December 16, 2025: member
    Looks like ParseKeyEnd is looking for the next ) which is incorrect when there is a musig() as the key.

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2025-12-27 21:13 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me