Merge branch 'bugfix_multisig' of https://github.com/coderrr/bitcoin

pull/741/merge
Gavin Andresen 13 years ago
commit 73e86eedd5

@ -1436,7 +1436,7 @@ bool IsMine(const CKeyStore &keystore, const CScript& scriptPubKey)
// them) enable spend-out-from-under-you attacks, especially // them) enable spend-out-from-under-you attacks, especially
// in shared-wallet situations. // in shared-wallet situations.
vector<valtype> keys(vSolutions.begin()+1, vSolutions.begin()+vSolutions.size()-1); vector<valtype> keys(vSolutions.begin()+1, vSolutions.begin()+vSolutions.size()-1);
return HaveKeys(vSolutions, keystore); return HaveKeys(keys, keystore) == keys.size();
} }
} }
return false; return false;

@ -174,7 +174,7 @@ BOOST_AUTO_TEST_CASE(multisig_Solver1)
// one key that would satisfy an (a|b) or 2-of-3 keys needed // one key that would satisfy an (a|b) or 2-of-3 keys needed
// to spend an escrow transaction. // to spend an escrow transaction.
// //
CBasicKeyStore keystore, emptykeystore; CBasicKeyStore keystore, emptykeystore, partialkeystore;
CKey key[3]; CKey key[3];
CBitcoinAddress keyaddr[3]; CBitcoinAddress keyaddr[3];
for (int i = 0; i < 3; i++) for (int i = 0; i < 3; i++)
@ -183,6 +183,7 @@ BOOST_AUTO_TEST_CASE(multisig_Solver1)
keystore.AddKey(key[i]); keystore.AddKey(key[i]);
keyaddr[i].SetPubKey(key[i].GetPubKey()); keyaddr[i].SetPubKey(key[i].GetPubKey());
} }
partialkeystore.AddKey(key[0]);
{ {
vector<valtype> solutions; vector<valtype> solutions;
@ -221,6 +222,7 @@ BOOST_AUTO_TEST_CASE(multisig_Solver1)
BOOST_CHECK(!ExtractAddress(s, addr)); BOOST_CHECK(!ExtractAddress(s, addr));
BOOST_CHECK(IsMine(keystore, s)); BOOST_CHECK(IsMine(keystore, s));
BOOST_CHECK(!IsMine(emptykeystore, s)); BOOST_CHECK(!IsMine(emptykeystore, s));
BOOST_CHECK(!IsMine(partialkeystore, s));
} }
{ {
vector<valtype> solutions; vector<valtype> solutions;
@ -237,6 +239,7 @@ BOOST_AUTO_TEST_CASE(multisig_Solver1)
BOOST_CHECK(nRequired = 1); BOOST_CHECK(nRequired = 1);
BOOST_CHECK(IsMine(keystore, s)); BOOST_CHECK(IsMine(keystore, s));
BOOST_CHECK(!IsMine(emptykeystore, s)); BOOST_CHECK(!IsMine(emptykeystore, s));
BOOST_CHECK(!IsMine(partialkeystore, s));
} }
{ {
vector<valtype> solutions; vector<valtype> solutions;

Loading…
Cancel
Save