Skip to content
This repository

Minor error message fix #1160

Merged
merged 1 commit into from almost 2 years ago

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)
999 999
         strAccount = AccountFromValue(params[2]);
1000 1000
 
1001 1001
     // Gather public keys
1002  
-    if ((nRequired < 1) || ((int)keys.size() < nRequired))
  1002
+    if (nRequired < 1)
  1003
+        throw runtime_error("must require at least one key");
2
Pieter Wuille Collaborator
sipa added a note April 28, 2012

"must require" sounds strange

Peter Todd
petertodd added a note April 28, 2012

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)
986 986
     if (fHelp || params.size() < 2 || params.size() > 3)
987 987
     {
988 988
         string msg = "addmultisigaddress <nrequired> <'[\"key\",\"key\"]'> [account]\n"
989  
-            "Add a nrequired-to-sign multisignature address to the wallet\"\n"
  989
+            "Add an n-required-to-sign multisignature address to the wallet\"\n"
4
P. Kaufmann
Diapolo added a note April 29, 2012

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

Peter Todd
petertodd added a note April 29, 2012

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 Collaborator
sipa added a note April 29, 2012

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

Peter Todd
petertodd added a note April 29, 2012

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
Collaborator
jgarzik commented May 01, 2012

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

Peter Todd

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

Pieter Wuille
Collaborator
sipa commented May 01, 2012

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
Diapolo commented May 03, 2012

NACK, as he included an already merged commit.

Pieter Wuille
Collaborator
sipa commented May 03, 2012

Oh, thanks for noticing.

P. Kaufmann
Diapolo commented May 03, 2012

@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 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
Diapolo commented May 03, 2012

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

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

Showing 1 unique commit by 1 author.

May 04, 2012
Peter Todd 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
This page is out of date. Refresh to see the latest.

Showing 1 changed file with 5 additions and 3 deletions. Show diff stats Hide diff stats

  1. 8  src/bitcoinrpc.cpp
8  src/bitcoinrpc.cpp
@@ -999,10 +999,12 @@ Value addmultisigaddress(const Array& params, bool fHelp)
999 999
         strAccount = AccountFromValue(params[2]);
1000 1000
 
1001 1001
     // Gather public keys
1002  
-    if ((nRequired < 1) || ((int)keys.size() < nRequired))
  1002
+    if (nRequired < 1)
  1003
+        throw runtime_error("a multisignature address must require at least one key to redeem");
  1004
+    if ((int)keys.size() < nRequired)
1003 1005
         throw runtime_error(
1004  
-            strprintf("wrong number of keys"
1005  
-                      "(got %d, need at least %d)", keys.size(), nRequired));
  1006
+            strprintf("not enough keys supplied "
  1007
+                      "(got %d keys, but need at least %d to redeem)", keys.size(), nRequired));
1006 1008
     std::vector<CKey> pubkeys;
1007 1009
     pubkeys.resize(keys.size());
1008 1010
     for (unsigned int i = 0; i < keys.size(); i++)
Commit_comment_tip

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.