Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unquoted descriptor arguments cause RPC console to improperly detect method name #737

Open
1 task done
achow101 opened this issue Jun 12, 2023 · 3 comments
Open
1 task done

Comments

@achow101
Copy link
Member

achow101 commented Jun 12, 2023

Is there an existing issue for this?

  • I have searched the existing issues

Current behaviour

Using the RPC console with a command that has descriptor arguments results in a Method not found error.

Expected behaviour

The command should either accept the argument as is, or return an error about failing to parse the argument.

Steps to reproduce

> getdescriptorinfo wpkh(cNaQCDwmmh4dS9LzCgVtyy1e1xjCJ21GUDHe9K98nzb689JvinGV)
Method not found (code -32601)

Relevant log output

No response

How did you obtain Bitcoin Core

Compiled from source

What version of Bitcoin Core are you using?

v25.99.0-c92fd638860c

Operating system and version

Arch Linux

Machine specifications

No response

@achow101 achow101 changed the title Single quotes in arguments cause RPC console to to improperly detect method name Unquoted descriptor arguments cause RPC console to to improperly detect method name Jun 12, 2023
@achow101
Copy link
Member Author

Ah, the issue is actually with the parentheses. The console thinks those are the beginning of a nested command or a more function-like syntax, introduced in bitcoin/bitcoin#7783

@hebasto hebasto changed the title Unquoted descriptor arguments cause RPC console to to improperly detect method name Unquoted descriptor arguments cause RPC console to improperly detect method name Jun 13, 2023
@hernanmarino
Copy link
Contributor

Perhaps I 'm saying something obvious, but a good workaround migth be enclosing the descriptor with double quotes:

> getdescriptorinfo "wpkh(cNaQCDwmmh4dS9LzCgVtyy1e1xjCJ21GUDHe9K98nzb689JvinGV)"
{
  "descriptor": "wpkh(02fcba7ecf41bc7e1be4ee122d9d22e3333671eb0a3a87b5cdf099d59874e1940f)#442qn8e8",
  "checksum": "3qah2w9c",
  "isrange": false,
  "issolvable": true,
  "hasprivatekeys": true
}

Single quotes might work for some descriptors, but will probably fail with descriptors including hardened derivation paths.

@achow101
Copy link
Member Author

Perhaps I 'm saying something obvious, but a good workaround migth be enclosing the descriptor with double quotes:

Yes, that is the correct way to pass these strings. However method not found seems like the incorrect error to be giving when not using them.

Additionally, double quotes gets really confusing and insane when using RPCs that involve json like importdescriptors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants