|
16 | 16 |
|
17 | 17 | #include <boost/test/unit_test.hpp> |
18 | 18 |
|
19 | | -typedef std::vector<unsigned char> valtype; |
20 | | - |
21 | 19 | BOOST_FIXTURE_TEST_SUITE(multisig_tests, BasicTestingSetup) |
22 | 20 |
|
23 | 21 | CScript |
@@ -173,95 +171,6 @@ BOOST_AUTO_TEST_CASE(multisig_IsStandard) |
173 | 171 | BOOST_CHECK(!::IsStandard(malformed[i], whichType)); |
174 | 172 | } |
175 | 173 |
|
176 | | -BOOST_AUTO_TEST_CASE(multisig_Solver1) |
177 | | -{ |
178 | | - // Tests Solver() that returns lists of keys that are |
179 | | - // required to satisfy a ScriptPubKey |
180 | | - // |
181 | | - // Also tests IsMine() and ExtractDestination() |
182 | | - // |
183 | | - // Note: ExtractDestination for the multisignature transactions |
184 | | - // always returns false for this release, even if you have |
185 | | - // one key that would satisfy an (a|b) or 2-of-3 keys needed |
186 | | - // to spend an escrow transaction. |
187 | | - // |
188 | | - CBasicKeyStore keystore, emptykeystore, partialkeystore; |
189 | | - CKey key[3]; |
190 | | - CTxDestination keyaddr[3]; |
191 | | - for (int i = 0; i < 3; i++) |
192 | | - { |
193 | | - key[i].MakeNewKey(true); |
194 | | - keystore.AddKey(key[i]); |
195 | | - keyaddr[i] = key[i].GetPubKey().GetID(); |
196 | | - } |
197 | | - partialkeystore.AddKey(key[0]); |
198 | | - |
199 | | - { |
200 | | - std::vector<valtype> solutions; |
201 | | - txnouttype whichType; |
202 | | - CScript s; |
203 | | - s << ToByteVector(key[0].GetPubKey()) << OP_CHECKSIG; |
204 | | - BOOST_CHECK(Solver(s, whichType, solutions)); |
205 | | - BOOST_CHECK(solutions.size() == 1); |
206 | | - CTxDestination addr; |
207 | | - BOOST_CHECK(ExtractDestination(s, addr)); |
208 | | - BOOST_CHECK(addr == keyaddr[0]); |
209 | | - BOOST_CHECK(IsMine(keystore, s)); |
210 | | - BOOST_CHECK(!IsMine(emptykeystore, s)); |
211 | | - } |
212 | | - { |
213 | | - std::vector<valtype> solutions; |
214 | | - txnouttype whichType; |
215 | | - CScript s; |
216 | | - s << OP_DUP << OP_HASH160 << ToByteVector(key[0].GetPubKey().GetID()) << OP_EQUALVERIFY << OP_CHECKSIG; |
217 | | - BOOST_CHECK(Solver(s, whichType, solutions)); |
218 | | - BOOST_CHECK(solutions.size() == 1); |
219 | | - CTxDestination addr; |
220 | | - BOOST_CHECK(ExtractDestination(s, addr)); |
221 | | - BOOST_CHECK(addr == keyaddr[0]); |
222 | | - BOOST_CHECK(IsMine(keystore, s)); |
223 | | - BOOST_CHECK(!IsMine(emptykeystore, s)); |
224 | | - } |
225 | | - { |
226 | | - std::vector<valtype> solutions; |
227 | | - txnouttype whichType; |
228 | | - CScript s; |
229 | | - s << OP_2 << ToByteVector(key[0].GetPubKey()) << ToByteVector(key[1].GetPubKey()) << OP_2 << OP_CHECKMULTISIG; |
230 | | - BOOST_CHECK(Solver(s, whichType, solutions)); |
231 | | - BOOST_CHECK_EQUAL(solutions.size(), 4U); |
232 | | - CTxDestination addr; |
233 | | - BOOST_CHECK(!ExtractDestination(s, addr)); |
234 | | - BOOST_CHECK(IsMine(keystore, s)); |
235 | | - BOOST_CHECK(!IsMine(emptykeystore, s)); |
236 | | - BOOST_CHECK(!IsMine(partialkeystore, s)); |
237 | | - } |
238 | | - { |
239 | | - std::vector<valtype> solutions; |
240 | | - txnouttype whichType; |
241 | | - CScript s; |
242 | | - s << OP_1 << ToByteVector(key[0].GetPubKey()) << ToByteVector(key[1].GetPubKey()) << OP_2 << OP_CHECKMULTISIG; |
243 | | - BOOST_CHECK(Solver(s, whichType, solutions)); |
244 | | - BOOST_CHECK_EQUAL(solutions.size(), 4U); |
245 | | - std::vector<CTxDestination> addrs; |
246 | | - int nRequired; |
247 | | - BOOST_CHECK(ExtractDestinations(s, whichType, addrs, nRequired)); |
248 | | - BOOST_CHECK(addrs[0] == keyaddr[0]); |
249 | | - BOOST_CHECK(addrs[1] == keyaddr[1]); |
250 | | - BOOST_CHECK(nRequired == 1); |
251 | | - BOOST_CHECK(IsMine(keystore, s)); |
252 | | - BOOST_CHECK(!IsMine(emptykeystore, s)); |
253 | | - BOOST_CHECK(!IsMine(partialkeystore, s)); |
254 | | - } |
255 | | - { |
256 | | - std::vector<valtype> solutions; |
257 | | - txnouttype whichType; |
258 | | - CScript s; |
259 | | - s << OP_2 << ToByteVector(key[0].GetPubKey()) << ToByteVector(key[1].GetPubKey()) << ToByteVector(key[2].GetPubKey()) << OP_3 << OP_CHECKMULTISIG; |
260 | | - BOOST_CHECK(Solver(s, whichType, solutions)); |
261 | | - BOOST_CHECK(solutions.size() == 5); |
262 | | - } |
263 | | -} |
264 | | - |
265 | 174 | BOOST_AUTO_TEST_CASE(multisig_Sign) |
266 | 175 | { |
267 | 176 | // Test SignSignature() (and therefore the version of Solver() that signs transactions) |
|
0 commit comments