Skip to content

wallet: importdescriptors should output the request on error - #35224

Open
kevkevinpal wants to merge 1 commit into
bitcoin:masterfrom
kevkevinpal:importDescriptorsPrintoutRequestOnFailure
Open

kevkevinpal wants to merge 1 commit into
bitcoin:masterfrom
kevkevinpal:importDescriptorsPrintoutRequestOnFailure

Conversation

@kevkevinpal

@kevkevinpal kevkevinpal commented May 6, 2026 •

Copy link
Copy Markdown
Contributor

Motivation

When importdescriptors is given multiple requests, a missing timestamp still fails the whole call with a static error (Missing required timestamp field for key). That does not say which request failed.

#34861 is merged. Other parse failures are returned per item, but a missing or invalid timestamp is still a top-level RPC error from GetImportTimestamp.

Solution

Include the failing request in that error message.

Example

Request

[
  {
    "desc": "wpkh([abcd1234/84h/1h/0h]tpub.../0/*)#x9abc123",
    "timestamp": 1710000000,
    "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}"
}

@DrahtBot DrahtBot added the Wallet label May 6, 2026
@DrahtBot

DrahtBot commented May 6, 2026 •

Copy link
Copy Markdown
Contributor

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

External sites

Reviews

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

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #36990 (test: replace hard-coded RPC error codes by l0rinc)
  • #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.

@kevkevinpal
kevkevinpal force-pushed the importDescriptorsPrintoutRequestOnFailure branch 2 times, most recently from 52e61ef to 1f10516 Compare October 10, 2026 14:18
@kevkevinpal
kevkevinpal marked this pull request as ready for review October 10, 2026 14:32
@kevkevinpal

Copy link
Copy Markdown
Contributor Author

CI / 32 bit ARM (pull_request) failing seems unrelated to the change

…is missing

A missing timestamp still fails the whole call, so put the request JSON in the error so a multi-request import identifies which item failed.
@kevkevinpal
kevkevinpal force-pushed the importDescriptorsPrintoutRequestOnFailure branch from 1f10516 to ad0c67a Compare October 24, 2026 22:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants