Skip to content

Conversation

@Empact
Copy link
Contributor

@Empact Empact commented Mar 2, 2022

This adds readily-available context information to the error string, for further disambiguation.

This is a revival of #16123 which was largely addressed in #16542.

Note 'Multi:' is used rather than 'multi():' as it also encompasses 'sortedmulti():'

@Empact
Copy link
Contributor Author

Empact commented Mar 2, 2022

/cc @achow101

@DrahtBot
Copy link
Contributor

DrahtBot commented Mar 3, 2022

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

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #22838 (descriptors: Be able to specify change and receiving in a single descriptor string by achow101)

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.

Note 'Multi:' is used rather than 'multi():' as it also encompasses 'sortedmulti():'
@Empact Empact force-pushed the 2022-03-descriptor-pubkey-context branch from 3470ee4 to 9b52672 Compare March 3, 2022 17:10
@achow101
Copy link
Member

achow101 commented Mar 3, 2022

ACK 9b52672

auto pk = ParsePubkey(key_exp_index, arg, ctx, out, error);
if (!pk) return nullptr;
if (!pk) {
error = strprintf("Multi: %s", error);
Copy link
Member

Choose a reason for hiding this comment

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

I don't understand why this can't (or shouldn't) be more specific?

Copy link
Member

Choose a reason for hiding this comment

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

I think it's just that it would result in a fairly large if block to get the right function name when Multi: is sufficient to get the point across. There can only be one multi in a descriptor anyways, so it should be obvious where the error is.

Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
error = strprintf("Multi: %s", error);
error = strprintf("%smulti: %s", sorted_multi ? "sorted" : "", error);

?

Copy link
Contributor

@theStack theStack left a comment

Choose a reason for hiding this comment

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

ACK 9b52672

@maflcko maflcko merged commit d6f225f into bitcoin:master Mar 23, 2022
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request Mar 24, 2022
…ext information

9b52672 For descriptor pubkey parse errors, include context information (Ben Woosley)

Pull request description:

  This adds readily-available context information to the error string, for further disambiguation.

  This is a revival of bitcoin#16123 which was largely addressed in bitcoin#16542.

  Note 'Multi:' is used rather than 'multi():' as it also encompasses 'sortedmulti():'

ACKs for top commit:
  achow101:
    ACK 9b52672
  theStack:
    ACK 9b52672

Tree-SHA512: 96533ea8c3ac7010f9b62e75b4bd20b65aff843030eb91c7a88312975acecaaf17909b7d1841f45edc86dbf7fa402d208adb85f0673bd79b857dbebacb8c9395
@bitcoin bitcoin locked and limited conversation to collaborators Mar 23, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants