Permalink
Browse files

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)"
  • Loading branch information...
1 parent 1210aa4 commit 86c47a563611ac14461dca3774bf1e5fe9eca546 @petertodd petertodd committed Apr 28, 2012
Showing with 5 additions and 3 deletions.
  1. +5 −3 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++)

0 comments on commit 86c47a5

Please sign in to comment.