9 #include <test/util/setup_common.h> 13 #include <boost/test/unit_test.hpp> 22 for (
int i = 0; i < 2; i++) {
30 std::unique_ptr<interfaces::Chain>& chain =
m_node.
chain;
39 LOCK(keystore.GetLegacyScriptPubKeyMan()->cs_KeyStore);
43 result = keystore.GetLegacyScriptPubKeyMan()->IsMine(scriptPubKey);
47 BOOST_CHECK(keystore.GetLegacyScriptPubKeyMan()->AddKey(keys[0]));
48 result = keystore.GetLegacyScriptPubKeyMan()->IsMine(scriptPubKey);
56 LOCK(keystore.GetLegacyScriptPubKeyMan()->cs_KeyStore);
60 result = keystore.GetLegacyScriptPubKeyMan()->IsMine(scriptPubKey);
64 BOOST_CHECK(keystore.GetLegacyScriptPubKeyMan()->AddKey(uncompressedKey));
65 result = keystore.GetLegacyScriptPubKeyMan()->IsMine(scriptPubKey);
73 LOCK(keystore.GetLegacyScriptPubKeyMan()->cs_KeyStore);
77 result = keystore.GetLegacyScriptPubKeyMan()->IsMine(scriptPubKey);
81 BOOST_CHECK(keystore.GetLegacyScriptPubKeyMan()->AddKey(keys[0]));
82 result = keystore.GetLegacyScriptPubKeyMan()->IsMine(scriptPubKey);
90 LOCK(keystore.GetLegacyScriptPubKeyMan()->cs_KeyStore);
94 result = keystore.GetLegacyScriptPubKeyMan()->IsMine(scriptPubKey);
98 BOOST_CHECK(keystore.GetLegacyScriptPubKeyMan()->AddKey(uncompressedKey));
99 result = keystore.GetLegacyScriptPubKeyMan()->IsMine(scriptPubKey);
107 LOCK(keystore.GetLegacyScriptPubKeyMan()->cs_KeyStore);
113 result = keystore.GetLegacyScriptPubKeyMan()->IsMine(scriptPubKey);
117 BOOST_CHECK(keystore.GetLegacyScriptPubKeyMan()->AddCScript(redeemScript));
118 result = keystore.GetLegacyScriptPubKeyMan()->IsMine(scriptPubKey);
122 BOOST_CHECK(keystore.GetLegacyScriptPubKeyMan()->AddKey(keys[0]));
123 result = keystore.GetLegacyScriptPubKeyMan()->IsMine(scriptPubKey);
131 LOCK(keystore.GetLegacyScriptPubKeyMan()->cs_KeyStore);
137 BOOST_CHECK(keystore.GetLegacyScriptPubKeyMan()->AddCScript(redeemscript));
138 BOOST_CHECK(keystore.GetLegacyScriptPubKeyMan()->AddCScript(redeemscript_inner));
139 BOOST_CHECK(keystore.GetLegacyScriptPubKeyMan()->AddCScript(scriptPubKey));
140 BOOST_CHECK(keystore.GetLegacyScriptPubKeyMan()->AddKey(keys[0]));
141 result = keystore.GetLegacyScriptPubKeyMan()->IsMine(scriptPubKey);
149 LOCK(keystore.GetLegacyScriptPubKeyMan()->cs_KeyStore);
155 BOOST_CHECK(keystore.GetLegacyScriptPubKeyMan()->AddCScript(witnessscript));
156 BOOST_CHECK(keystore.GetLegacyScriptPubKeyMan()->AddCScript(redeemscript));
157 BOOST_CHECK(keystore.GetLegacyScriptPubKeyMan()->AddCScript(scriptPubKey));
158 BOOST_CHECK(keystore.GetLegacyScriptPubKeyMan()->AddKey(keys[0]));
159 result = keystore.GetLegacyScriptPubKeyMan()->IsMine(scriptPubKey);
167 LOCK(keystore.GetLegacyScriptPubKeyMan()->cs_KeyStore);
172 BOOST_CHECK(keystore.GetLegacyScriptPubKeyMan()->AddCScript(witnessscript));
173 BOOST_CHECK(keystore.GetLegacyScriptPubKeyMan()->AddCScript(scriptPubKey));
174 BOOST_CHECK(keystore.GetLegacyScriptPubKeyMan()->AddKey(keys[0]));
175 result = keystore.GetLegacyScriptPubKeyMan()->IsMine(scriptPubKey);
183 LOCK(keystore.GetLegacyScriptPubKeyMan()->cs_KeyStore);
189 BOOST_CHECK(keystore.GetLegacyScriptPubKeyMan()->AddCScript(witnessscript_inner));
190 BOOST_CHECK(keystore.GetLegacyScriptPubKeyMan()->AddCScript(witnessscript));
191 BOOST_CHECK(keystore.GetLegacyScriptPubKeyMan()->AddCScript(scriptPubKey));
192 BOOST_CHECK(keystore.GetLegacyScriptPubKeyMan()->AddKey(keys[0]));
193 result = keystore.GetLegacyScriptPubKeyMan()->IsMine(scriptPubKey);
201 LOCK(keystore.GetLegacyScriptPubKeyMan()->cs_KeyStore);
202 BOOST_CHECK(keystore.GetLegacyScriptPubKeyMan()->AddKey(keys[0]));
207 BOOST_CHECK(keystore.GetLegacyScriptPubKeyMan()->AddCScript(scriptPubKey));
208 result = keystore.GetLegacyScriptPubKeyMan()->IsMine(scriptPubKey);
216 LOCK(keystore.GetLegacyScriptPubKeyMan()->cs_KeyStore);
217 BOOST_CHECK(keystore.GetLegacyScriptPubKeyMan()->AddKey(uncompressedKey));
222 result = keystore.GetLegacyScriptPubKeyMan()->IsMine(scriptPubKey);
226 BOOST_CHECK(keystore.GetLegacyScriptPubKeyMan()->AddCScript(scriptPubKey));
227 result = keystore.GetLegacyScriptPubKeyMan()->IsMine(scriptPubKey);
235 LOCK(keystore.GetLegacyScriptPubKeyMan()->cs_KeyStore);
240 result = keystore.GetLegacyScriptPubKeyMan()->IsMine(scriptPubKey);
244 BOOST_CHECK(keystore.GetLegacyScriptPubKeyMan()->AddKey(uncompressedKey));
246 result = keystore.GetLegacyScriptPubKeyMan()->IsMine(scriptPubKey);
250 BOOST_CHECK(keystore.GetLegacyScriptPubKeyMan()->AddKey(keys[1]));
252 result = keystore.GetLegacyScriptPubKeyMan()->IsMine(scriptPubKey);
256 BOOST_CHECK(keystore.GetLegacyScriptPubKeyMan()->AddCScript(scriptPubKey));
258 result = keystore.GetLegacyScriptPubKeyMan()->IsMine(scriptPubKey);
266 LOCK(keystore.GetLegacyScriptPubKeyMan()->cs_KeyStore);
267 BOOST_CHECK(keystore.GetLegacyScriptPubKeyMan()->AddKey(uncompressedKey));
268 BOOST_CHECK(keystore.GetLegacyScriptPubKeyMan()->AddKey(keys[1]));
274 result = keystore.GetLegacyScriptPubKeyMan()->IsMine(scriptPubKey);
278 BOOST_CHECK(keystore.GetLegacyScriptPubKeyMan()->AddCScript(redeemScript));
279 result = keystore.GetLegacyScriptPubKeyMan()->IsMine(scriptPubKey);
287 LOCK(keystore.GetLegacyScriptPubKeyMan()->cs_KeyStore);
288 BOOST_CHECK(keystore.GetLegacyScriptPubKeyMan()->AddKey(keys[0]));
289 BOOST_CHECK(keystore.GetLegacyScriptPubKeyMan()->AddKey(keys[1]));
295 result = keystore.GetLegacyScriptPubKeyMan()->IsMine(scriptPubKey);
299 BOOST_CHECK(keystore.GetLegacyScriptPubKeyMan()->AddCScript(witnessScript));
300 result = keystore.GetLegacyScriptPubKeyMan()->IsMine(scriptPubKey);
304 BOOST_CHECK(keystore.GetLegacyScriptPubKeyMan()->AddCScript(scriptPubKey));
305 result = keystore.GetLegacyScriptPubKeyMan()->IsMine(scriptPubKey);
313 LOCK(keystore.GetLegacyScriptPubKeyMan()->cs_KeyStore);
314 BOOST_CHECK(keystore.GetLegacyScriptPubKeyMan()->AddKey(uncompressedKey));
315 BOOST_CHECK(keystore.GetLegacyScriptPubKeyMan()->AddKey(keys[1]));
321 result = keystore.GetLegacyScriptPubKeyMan()->IsMine(scriptPubKey);
325 BOOST_CHECK(keystore.GetLegacyScriptPubKeyMan()->AddCScript(witnessScript));
326 result = keystore.GetLegacyScriptPubKeyMan()->IsMine(scriptPubKey);
330 BOOST_CHECK(keystore.GetLegacyScriptPubKeyMan()->AddCScript(scriptPubKey));
331 result = keystore.GetLegacyScriptPubKeyMan()->IsMine(scriptPubKey);
339 LOCK(keystore.GetLegacyScriptPubKeyMan()->cs_KeyStore);
346 result = keystore.GetLegacyScriptPubKeyMan()->IsMine(scriptPubKey);
350 BOOST_CHECK(keystore.GetLegacyScriptPubKeyMan()->AddCScript(redeemScript));
351 BOOST_CHECK(keystore.GetLegacyScriptPubKeyMan()->AddCScript(witnessScript));
352 result = keystore.GetLegacyScriptPubKeyMan()->IsMine(scriptPubKey);
356 BOOST_CHECK(keystore.GetLegacyScriptPubKeyMan()->AddKey(keys[0]));
357 BOOST_CHECK(keystore.GetLegacyScriptPubKeyMan()->AddKey(keys[1]));
358 result = keystore.GetLegacyScriptPubKeyMan()->IsMine(scriptPubKey);
366 LOCK(keystore.GetLegacyScriptPubKeyMan()->cs_KeyStore);
367 BOOST_CHECK(keystore.GetLegacyScriptPubKeyMan()->AddKey(keys[0]));
369 scriptPubKey.
clear();
372 result = keystore.GetLegacyScriptPubKeyMan()->IsMine(scriptPubKey);
380 LOCK(keystore.GetLegacyScriptPubKeyMan()->cs_KeyStore);
381 BOOST_CHECK(keystore.GetLegacyScriptPubKeyMan()->AddKey(keys[0]));
383 scriptPubKey.
clear();
386 result = keystore.GetLegacyScriptPubKeyMan()->IsMine(scriptPubKey);
394 LOCK(keystore.GetLegacyScriptPubKeyMan()->cs_KeyStore);
395 BOOST_CHECK(keystore.GetLegacyScriptPubKeyMan()->AddKey(keys[0]));
397 scriptPubKey.
clear();
400 result = keystore.GetLegacyScriptPubKeyMan()->IsMine(scriptPubKey);
408 LOCK(keystore.GetLegacyScriptPubKeyMan()->cs_KeyStore);
409 BOOST_CHECK(keystore.GetLegacyScriptPubKeyMan()->AddKey(keys[0]));
411 scriptPubKey.
clear();
414 result = keystore.GetLegacyScriptPubKeyMan()->IsMine(scriptPubKey);
void SetupLegacyScriptPubKeyMan()
Make a LegacyScriptPubKeyMan and set it for all types, internal, and external.
CPubKey GetPubKey() const
Compute the public key from a private key.
std::vector< unsigned char > ParseHex(const char *psz)
std::unique_ptr< interfaces::Chain > chain
CScript GetScriptForRawPubKey(const CPubKey &pubKey)
Generate a P2PK script for the given pubkey.
BOOST_AUTO_TEST_CASE(ismine_standard)
An encapsulated public key.
void MakeNewKey(bool fCompressed)
Generate a new private key using a cryptographic PRNG.
isminetype
IsMine() return codes, which depend on ScriptPubKeyMan implementation.
std::unique_ptr< WalletDatabase > CreateDummyWalletDatabase()
Return object for accessing dummy database with no read/write capabilities.
CScript GetScriptForDestination(const CTxDestination &dest)
Generate a Bitcoin scriptPubKey for the given CTxDestination.
#define BOOST_FIXTURE_TEST_SUITE(a, b)
#define BOOST_CHECK_EQUAL(v1, v2)
Serialized script, used inside transaction inputs and outputs.
#define BOOST_AUTO_TEST_SUITE_END()
A CWallet maintains a set of transactions and balances, and provides the ability to create new transa...
CScript GetScriptForMultisig(int nRequired, const std::vector< CPubKey > &keys)
Generate a multisig script.
An encapsulated private key.
#define BOOST_CHECK(expr)
std::vector< unsigned char > ToByteVector(const T &in)