Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Minor error message fix #1160

Merged
merged 1 commit into from

5 participants

@petertodd

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");
@sipa 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"
@Diapolo
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.

@sipa 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
@jgarzik
Owner

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

@petertodd

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

@sipa
Owner

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

@petertodd

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

@Diapolo

NACK, as he included an already merged commit.

@sipa
Owner

Oh, thanks for noticing.

@Diapolo

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

@petertodd 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
@petertodd

@Diapolo Thanks. I think I fixed it.

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

@Diapolo

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

@gmaxwell gmaxwell merged commit 5b8def7 into bitcoin:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on May 4, 2012
  1. @petertodd

    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
View
8 src/bitcoinrpc.cpp
@@ -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.