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

combinePubKeys should not allow for n_pubkeys==1 #89

Closed
ysangkok opened this issue Mar 25, 2020 · 5 comments
Closed

combinePubKeys should not allow for n_pubkeys==1 #89

ysangkok opened this issue Mar 25, 2020 · 5 comments

Comments

@ysangkok
Copy link

ysangkok commented Mar 25, 2020

There is this line in combine_pubkeys:

ARG_CHECK(n_pubkeys > 0);

Given that it doesn't make sense for n_pubkeys to be 1, I was wondering if this check should be changed to be "> 1"?

@gmaxwell
Copy link
Contributor

why wouldn't it? n_pubkeys = 1 is well defined and has an obvious sensible behaviour. If the interface forces more than one then a caller needs to handle an additional corner case that would otherwise just work.

@real-or-random
Copy link
Collaborator

Hm. You can also combine the same pubkey n times with itself. I don't have a use case for this either but it's not broken or wrong in any sense, so I tend not to put restrictions here. But you're right, it's somehow confusing. I'm indifferent.

@ysangkok
Copy link
Author

Ok, if the current behavior is to be kept, it would be nice to document it. How about a footnote in musig.md that says that the API supports a single signer? The footnote could be referenced each time a plural like "participants" or "public keys" is used.

@apoelstra
Copy link
Contributor

I'd rather not complicate the exposition for the sake of this usecase. The current text makes sense for n=1 (aside from being ungrammatical) and it never occurred to me that n=1 might not work. Though perhaps I am just too close to this.

@sipa
Copy link
Contributor

sipa commented Apr 3, 2020

I don't understand what's the issue here. Does the function not do exactly what you'd expect with 1 input?

Look at Python's sum function (https://docs.python.org/3/library/functions.html#sum). It also does not list a special case for only one input.

@ysangkok ysangkok closed this as completed Apr 3, 2020
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

5 participants