Waiting for #35185 to be merged so I can rebase on it
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 #35185 is merged, the output will be per item.