Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Minor error message fix #1160

Merged
merged 1 commit into from

5 participants

Peter Todd Jeff Garzik Pieter Wuille P. Kaufmann Gregory Maxwell
Peter Todd

No description provided.

src/bitcoinrpc.cpp
@@ -999,7 +999,9 @@ Value addmultisigaddress(const Array& params, bool fHelp)
strAccount = AccountFromValue(params[2]);
// Gather public keys
- if ((nRequired < 1) || ((int)keys.size() < nRequired))
+ if (nRequired < 1)
+ throw runtime_error("must require at least one key");
Pieter Wuille Owner
sipa added a note

"must require" sounds strange

See my update below for a better version. Also a small grammer fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
src/bitcoinrpc.cpp
@@ -986,7 +986,7 @@ Value addmultisigaddress(const Array& params, bool fHelp)
if (fHelp || params.size() < 2 || params.size() > 3)
{
string msg = "addmultisigaddress <nrequired> <'[\"key\",\"key\"]'> [account]\n"
- "Add a nrequired-to-sign multisignature address to the wallet\"\n"
+ "Add an n-required-to-sign multisignature address to the wallet\"\n"
P. Kaufmann
Diapolo added a note

Should read "Add a n-required...", as "an" goes before words that begin with vowels. Perhaps the devs intended to use the spelling "nrequired"?

Ha, yeah you're right. Elementary school was a long time ago...

The term nrequired is always capitalized as nRequired elsewhere in the code, so I think it's meant to read as two words.

Pieter Wuille Owner
sipa added a note

n is just the prefix given to variable names that hold numbers

Ahh, Hungarian.

Since it's user facing though, I'd still use the english writing convention of n-required for the rpc docs.

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

NAK for "Grammer", ACK for "fixed non-sensical error message"

Peter Todd

Sure, I'll delete "grammer" if that's the consensus.

Pieter Wuille
Owner

Not sure whether it's intentional or not, but it's called "grammar" in English.

Peter Todd

I need to follow this up for the pull request "Me and my buddies fixed them spelling."

P. Kaufmann

NACK, as he included an already merged commit.

Pieter Wuille
Owner

Oh, thanks for noticing.

P. Kaufmann

@retep You have to rebase to current master, so that only your commit goes into this pull-req.
e.g. rebase origin upstream

Peter Todd petertodd Fixed non-sensical error message
Previously trying to create a multisig address that required less than
one signature would output something like the following:

"wrong number of keys(got 1, need at least 0)"
86c47a5
Peter Todd

@Diapolo Thanks. I think I fixed it.

Sorry, this is the first time I've used github pull requests before.

P. Kaufmann

Looks good now :) and I had a hard time learning Git, too ... don't worry.

Gregory Maxwell gmaxwell merged commit 5b8def7 into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on May 4, 2012
  1. Peter Todd

    Fixed non-sensical error message

    petertodd authored
    Previously trying to create a multisig address that required less than
    one signature would output something like the following:
    
    "wrong number of keys(got 1, need at least 0)"
This page is out of date. Refresh to see the latest.
Showing with 5 additions and 3 deletions.
  1. +5 −3 src/bitcoinrpc.cpp
8 src/bitcoinrpc.cpp
View
@@ -999,10 +999,12 @@ Value addmultisigaddress(const Array& params, bool fHelp)
strAccount = AccountFromValue(params[2]);
// Gather public keys
- if ((nRequired < 1) || ((int)keys.size() < nRequired))
+ if (nRequired < 1)
+ throw runtime_error("a multisignature address must require at least one key to redeem");
+ if ((int)keys.size() < nRequired)
throw runtime_error(
- strprintf("wrong number of keys"
- "(got %d, need at least %d)", keys.size(), nRequired));
+ strprintf("not enough keys supplied "
+ "(got %d keys, but need at least %d to redeem)", keys.size(), nRequired));
std::vector<CKey> pubkeys;
pubkeys.resize(keys.size());
for (unsigned int i = 0; i < keys.size(); i++)
Something went wrong with that request. Please try again.