wallet: importdescriptors should output the request on error #35224

pull kevkevinpal wants to merge 2 commits into bitcoin:master from kevkevinpal:importDescriptorsPrintoutRequestOnFailure changing 2 files +11 −2
  1. kevkevinpal commented at 4:33 PM on May 6, 2026: contributor

    Waiting for #34861 to be merged so I can rebase on it or this can be cherry picked

    Motivation

    I was motivated by this comment #35185 (comment) because when using the importdescriptors rpc on error we should get a more descriptive error message than Missing required timestamp field for key. This is because multiple descriptors could be imported, and it would be useful to know the exact request that failed.

    Solution

    Instead of just printing a static error message, Missing required timestamp field for key also output the exact request that failed.

    Example

    Request

    [
      {
        "desc": "wpkh([abcd1234/84h/1h/0h]tpub.../0/*)#x9abc123",
        "timestamp": 1710000000,
        "active": true,
        "range": [0, 100]
      },
      {
        "desc": "wpkh([abcd1234/84h/1h/0h]tpub.../1/*)#y8def456",
        "timestamp": "now",
        "internal": true,
        "active": true,
        "range": [0, 100]
      },
      {
        "desc": "pkh(039dcc64c5c644baf0145a5f7322b16399a01a0ee2a182e3150946fe7946358247)#68u5tv65",
        "active": false
      }
    ]
    

    Before

    {
      "code": -3,
      "message": "Missing required timestamp field for key"
    }
    

    After

    {
      "code": -3,
      "message": "Missing required timestamp field for import request: {\"desc\":\"pkh(039dcc64c5c644baf0145a5f7322b16399a01a0ee2a182e3150946fe7946358247)#68u5tv65\",\"active\":false}"
    }
    

    Note: after #34861 is merged, the output will be per item.

  2. wallet: on failure of importdescriptors printout full request on error 47be83c36f
  3. test: add coverage for failure of importdescriptors 1a24ddb853
  4. DrahtBot added the label Wallet on May 6, 2026
  5. DrahtBot commented at 4:34 PM on May 6, 2026: contributor

    <!--e57a25ab6845829454e8d69fc972939a-->

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    <!--006a51241073e994b41acfe9ec718e94-->

    Code Coverage & Benchmarks

    For details see: https://corecheck.dev/bitcoin/bitcoin/pulls/35224.

    <!--021abf342d371248e50ceaed478a90ca-->

    Reviews

    See the guideline for information on the review process. A summary of reviews will appear here.

    <!--174a7506f384e20aa4161008e828411d-->

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #31668 (Added rescan option for import descriptors by saikiran57)

    If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

    <!--5faf32d7da4f0f540f40219e4f7537a3-->


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-05-19 06:51 UTC