importmulti falsely warns private keys present when importing descriptor #15742

issue gwillen opened this issue on April 4, 2019
  1. gwillen commented at 1:28 AM on April 4, 2019: contributor

    Command:

    importmulti '[{"desc": "sh(wsh(multi(2,[aeee1e6a/49h/1h/0h]tpubDC5bVdaveQYxGFztMShFAjU637kKjrs9FD8ne1oHR7z8tLeQJExsaxWRVeSpcCcYMdp5ecf2LQhuVaeYFZ7YEpvWTJr4nDGUJrmuvLuTSsp/1/*,[f04973fd/49h/1h/0h]tpubDDSx3fQ8QyVN21PqRwobfAeDnjesTRMG3U6MPs2aUW5tYg9Arhz4tBRiUWTc9VrJBxRVXJqSrULfGs5HJZTqMJC7PBtDGT7cVtsySf76wmS/1/*,[149b5aca/49h/1h/0h]tpubDCCrKqf5e4eiXxRsma3QkcoKbd6MS8zxK5NTfsvNerTPVZcZqFMbn12D3qtWNLUBdxFkRhw2ZToRCMCNQzxG1T8dCVNMRuLwCmUngyf3CbB/1/*)))", "keypool": true, "timestamp": "now", "watchonly": true, "internal": true, "range": {"end": 100}}]' '{"rescan": false}'

    Result:

    [
      {
        "success": true,
        "warnings": [
          "All private keys are provided, outputs will be considered spendable. If this is intentional, do not specify the watchonly flag."
        ]
      }
    ]
    

    And according to getdescriptoinfo:

    getdescriptorinfo "sh(wsh(multi(2,[aeee1e6a/49h/1h/0h]tpubDC5bVdaveQYxGFztMShFAjU637kKjrs9FD8ne1oHR7z8tLeQJExsaxWRVeSpcCcYMdp5ecf2LQhuVaeYFZ7YEpvWTJr4nDGUJrmuvLuTSsp/1/*,[f04973fd/49h/1h/0h]tpubDDSx3fQ8QyVN21PqRwobfAeDnjesTRMG3U6MPs2aUW5tYg9Arhz4tBRiUWTc9VrJBxRVXJqSrULfGs5HJZTqMJC7PBtDGT7cVtsySf76wmS/1/*,[149b5aca/49h/1h/0h]tpubDCCrKqf5e4eiXxRsma3QkcoKbd6MS8zxK5NTfsvNerTPVZcZqFMbn12D3qtWNLUBdxFkRhw2ZToRCMCNQzxG1T8dCVNMRuLwCmUngyf3CbB/1/*)))"

    {
      "descriptor": "sh(wsh(multi(2,[aeee1e6a/49'/1'/0']tpubDC5bVdaveQYxGFztMShFAjU637kKjrs9FD8ne1oHR7z8tLeQJExsaxWRVeSpcCcYMdp5ecf2LQhuVaeYFZ7YEpvWTJr4nDGUJrmuvLuTSsp/1/*,[f04973fd/49'/1'/0']tpubDDSx3fQ8QyVN21PqRwobfAeDnjesTRMG3U6MPs2aUW5tYg9Arhz4tBRiUWTc9VrJBxRVXJqSrULfGs5HJZTqMJC7PBtDGT7cVtsySf76wmS/1/*,[149b5aca/49'/1'/0']tpubDCCrKqf5e4eiXxRsma3QkcoKbd6MS8zxK5NTfsvNerTPVZcZqFMbn12D3qtWNLUBdxFkRhw2ZToRCMCNQzxG1T8dCVNMRuLwCmUngyf3CbB/1/*)))#sddrjdjm",
      "isrange": true,
      "issolvable": true,
      "hasprivatekeys": false
    }
    
  2. fanquake added the label RPC/REST/ZMQ on Apr 4, 2019
  3. gwillen commented at 6:01 AM on April 4, 2019: contributor

    It seems that ProcessImportDescriptor finds no pubkeys in this descriptor (pubkey_map is empty), so it concludes that, trivially, all privkeys are provided.

    This probably has the same cause as #15743.

  4. gwillen commented at 7:02 AM on April 4, 2019: contributor

    Yeah I'm going to close this as a duplicate of #15743, which is more substantive, because the cause is the same.

  5. gwillen closed this on Apr 4, 2019

  6. gwillen reopened this on Apr 6, 2019

  7. gwillen commented at 12:36 AM on April 6, 2019: contributor

    Reopened because the fix for #15743 won't end up fixing this.

    THAT fix is going to cause key origins to be successfully record for multisigs in ProcessImportDescriptor, but according to @sipa it is intentional that pubkeys are not imported, and this will not be changed.

    Possibly all that needs to be changed is the comment:

        // Check if all the public keys have corresponding private keys in the import for spendability.
        // This does not take into account threshold multisigs which could be spendable without all keys.	    
        // Thus, threshold multisigs without all keys will be considered not spendable here, even if they are,
        // perhaps triggering a false warning message. This is consistent with the current wallet IsMine check.
    

    The comment claims that we will falsely warn that threshold multisigs are not spendable, even when they are, but ACTUALLY we falsely warn that they are spendable, even when they are not.

  8. sipa commented at 1:12 AM on April 6, 2019: member

    Right, there is an additional issue here; namely that only to-be-imported pubkeys are being analyzed for spendability, rather than all involved keys.

    I'll PR a fix soon.

  9. meshcollider referenced this in commit 54798c3a31 on Apr 9, 2019
  10. meshcollider commented at 12:37 PM on April 9, 2019: contributor
  11. meshcollider closed this on Apr 9, 2019

  12. MarcoFalke locked this on Dec 16, 2021

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: 2026-04-13 15:14 UTC

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