Skip to content

Conversation

@rkrux
Copy link
Contributor

@rkrux rkrux commented Apr 1, 2025

When parsing descriptors with multiple keys (tr, wsh, sh, miniscript),
we might not have all the private keys but only few of them
(rest being public keys).

listdescriptors(private=true) RPC should not
fail in such scenario and instead return those partial private keys,
using public keys for the rest.

Fixes #32078

@DrahtBot
Copy link
Contributor

DrahtBot commented Apr 1, 2025

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

Code Coverage & Benchmarks

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

Reviews

See the guideline for information on the review process.

Type Reviewers
Concept ACK w0xlt, brunoerg
Approach NACK sipa
Stale ACK Randy808

If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #31734 (miniscript: account for all StringType variants in Miniscriptdescriptor::ToString() by pythcoiner)
  • #30243 (descriptors: taproot partial descriptors by Eunovo)

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.

@rkrux
Copy link
Contributor Author

rkrux commented Apr 1, 2025

cc: @furszy

@DrahtBot
Copy link
Contributor

DrahtBot commented Apr 1, 2025

🚧 At least one of the CI tasks failed.
Debug: https://github.com/bitcoin/bitcoin/runs/39778817034

Hints

Try to run the tests locally, according to the documentation. However, a CI failure may still
happen due to a number of reasons, for example:

  • Possibly due to a silent merge conflict (the changes in this pull request being
    incompatible with the current code in the target branch). If so, make sure to rebase on the latest
    commit of the target branch.

  • A sanitizer issue, which can only be found by compiling with the sanitizer and running the
    affected test.

  • An intermittent issue.

Leave a comment here, if you need help tracking down a confusing failure.

@furszy
Copy link
Member

furszy commented Apr 1, 2025

I haven't checked the approach, but based on the title, I assume it is linked to #32078.

@rkrux rkrux force-pushed the taproot-list-desc branch from f30da81 to 425c22a Compare April 3, 2025 10:55
@rkrux rkrux changed the title descriptor: handle listdescriptors(private=true) in case of taproot descriptors having partial keys descriptor: handle listdescriptors(private=true) for taproot descriptors having partial keys Apr 3, 2025
@rkrux rkrux force-pushed the taproot-list-desc branch 2 times, most recently from 1adc7e7 to 92d9340 Compare April 3, 2025 12:06
@DrahtBot DrahtBot removed the CI failed label Apr 3, 2025
@rkrux rkrux marked this pull request as ready for review April 3, 2025 14:50
@w0xlt
Copy link
Contributor

w0xlt commented Apr 4, 2025

Concept ACK.
It addresses the issue mentioned in the PR description.
It may be better if the test validates the returned message.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: 'Atleast' should be 'At least'

@Randy808
Copy link
Contributor

Randy808 commented Apr 5, 2025

Code Review ACK 3d3d8491948c2825c43db7fae69c32aae343742f

Copy link
Contributor

@brunoerg brunoerg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Concept ACK

@sipa
Copy link
Member

sipa commented Apr 7, 2025

Approach NACK. There is no reason why this needs to be special cased for taproot.

listdescriptors true should always return all private keys that are present in the wallet, even if not all private keys are present. That can happen in taproot branches, but it also could happen for a simple multisig.

#24361 would have fixed this. Feel free to pick it up.

@rkrux
Copy link
Contributor Author

rkrux commented Apr 7, 2025

I see, it makes sense to solve it for all the cases; I'll rework this PR.

@rkrux rkrux marked this pull request as draft April 7, 2025 17:03
@laanwj laanwj added the Wallet label Apr 9, 2025
When parsing descriptors with multiple keys (tr, wsh, sh, miniscript),
we might not have all the private keys but only few of them
(rest being public keys).

`listdescriptors(private=true)` RPC should not
fail in such scenario and instead return those partial private keys,
using public keys for the rest.
@rkrux rkrux force-pushed the taproot-list-desc branch from 92d9340 to 60f432e Compare April 10, 2025 13:37
@rkrux rkrux changed the title descriptor: handle listdescriptors(private=true) for taproot descriptors having partial keys descriptor: handle listdescriptors(private=true) for descriptors having partial keys Apr 10, 2025
@DrahtBot
Copy link
Contributor

🚧 At least one of the CI tasks failed.
Debug: https://github.com/bitcoin/bitcoin/runs/40327848658

Hints

Try to run the tests locally, according to the documentation. However, a CI failure may still
happen due to a number of reasons, for example:

  • Possibly due to a silent merge conflict (the changes in this pull request being
    incompatible with the current code in the target branch). If so, make sure to rebase on the latest
    commit of the target branch.

  • A sanitizer issue, which can only be found by compiling with the sanitizer and running the
    affected test.

  • An intermittent issue.

Leave a comment here, if you need help tracking down a confusing failure.

@rkrux
Copy link
Contributor Author

rkrux commented Apr 11, 2025

I don't like the way this diff has turned out, seems repetitive. I will take inspiration from #24361 and spend some time figuring out how to make it work for Miniscript expressions as well. The branch name is outdated too now.

Most likely will close this and open a new PR.

@Eunovo
Copy link
Contributor

Eunovo commented May 5, 2025

@rkrux still working on this?

@rkrux
Copy link
Contributor Author

rkrux commented May 5, 2025

@Eunovo I have not gotten around to trying the other approach yet as I was working on few other PRs. Please feel free to give it a shot if you want else I will give it another try some time later.

Closing this PR either way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

listdescriptors true fails with 'Can't get descriptor string' in non-watch-only descriptor wallet

9 participants