14 #include <test/util/setup_common.h> 16 #include <boost/test/unit_test.hpp> 23 for (
int i = 0; i < 2; i++) {
32 std::unique_ptr<interfaces::Chain> chain =
43 LOCK(keystore.GetLegacyScriptPubKeyMan()->cs_KeyStore);
47 result = keystore.GetLegacyScriptPubKeyMan()->IsMine(scriptPubKey);
51 BOOST_CHECK(keystore.GetLegacyScriptPubKeyMan()->AddKey(keys[0]));
52 result = keystore.GetLegacyScriptPubKeyMan()->IsMine(scriptPubKey);
61 LOCK(keystore.GetLegacyScriptPubKeyMan()->cs_KeyStore);
65 result = keystore.GetLegacyScriptPubKeyMan()->IsMine(scriptPubKey);
70 keystore.GetLegacyScriptPubKeyMan()->AddKey(uncompressedKey));
71 result = keystore.GetLegacyScriptPubKeyMan()->IsMine(scriptPubKey);
80 LOCK(keystore.GetLegacyScriptPubKeyMan()->cs_KeyStore);
84 result = keystore.GetLegacyScriptPubKeyMan()->IsMine(scriptPubKey);
88 BOOST_CHECK(keystore.GetLegacyScriptPubKeyMan()->AddKey(keys[0]));
89 result = keystore.GetLegacyScriptPubKeyMan()->IsMine(scriptPubKey);
98 LOCK(keystore.GetLegacyScriptPubKeyMan()->cs_KeyStore);
102 result = keystore.GetLegacyScriptPubKeyMan()->IsMine(scriptPubKey);
107 keystore.GetLegacyScriptPubKeyMan()->AddKey(uncompressedKey));
108 result = keystore.GetLegacyScriptPubKeyMan()->IsMine(scriptPubKey);
117 LOCK(keystore.GetLegacyScriptPubKeyMan()->cs_KeyStore);
123 result = keystore.GetLegacyScriptPubKeyMan()->IsMine(scriptPubKey);
128 keystore.GetLegacyScriptPubKeyMan()->AddCScript(redeemScript));
129 result = keystore.GetLegacyScriptPubKeyMan()->IsMine(scriptPubKey);
133 BOOST_CHECK(keystore.GetLegacyScriptPubKeyMan()->AddKey(keys[0]));
134 result = keystore.GetLegacyScriptPubKeyMan()->IsMine(scriptPubKey);
143 LOCK(keystore.GetLegacyScriptPubKeyMan()->cs_KeyStore);
152 keystore.GetLegacyScriptPubKeyMan()->AddCScript(redeemscript));
153 BOOST_CHECK(keystore.GetLegacyScriptPubKeyMan()->AddCScript(
154 redeemscript_inner));
156 keystore.GetLegacyScriptPubKeyMan()->AddCScript(scriptPubKey));
157 BOOST_CHECK(keystore.GetLegacyScriptPubKeyMan()->AddKey(keys[0]));
158 result = keystore.GetLegacyScriptPubKeyMan()->IsMine(scriptPubKey);
167 LOCK(keystore.GetLegacyScriptPubKeyMan()->cs_KeyStore);
173 result = keystore.GetLegacyScriptPubKeyMan()->IsMine(scriptPubKey);
178 keystore.GetLegacyScriptPubKeyMan()->AddKey(uncompressedKey));
180 result = keystore.GetLegacyScriptPubKeyMan()->IsMine(scriptPubKey);
184 BOOST_CHECK(keystore.GetLegacyScriptPubKeyMan()->AddKey(keys[1]));
186 result = keystore.GetLegacyScriptPubKeyMan()->IsMine(scriptPubKey);
191 keystore.GetLegacyScriptPubKeyMan()->AddCScript(scriptPubKey));
193 result = keystore.GetLegacyScriptPubKeyMan()->IsMine(scriptPubKey);
202 LOCK(keystore.GetLegacyScriptPubKeyMan()->cs_KeyStore);
204 keystore.GetLegacyScriptPubKeyMan()->AddKey(uncompressedKey));
205 BOOST_CHECK(keystore.GetLegacyScriptPubKeyMan()->AddKey(keys[1]));
212 result = keystore.GetLegacyScriptPubKeyMan()->IsMine(scriptPubKey);
217 keystore.GetLegacyScriptPubKeyMan()->AddCScript(redeemScript));
218 result = keystore.GetLegacyScriptPubKeyMan()->IsMine(scriptPubKey);
227 LOCK(keystore.GetLegacyScriptPubKeyMan()->cs_KeyStore);
228 BOOST_CHECK(keystore.GetLegacyScriptPubKeyMan()->AddKey(keys[0]));
230 scriptPubKey.
clear();
233 result = keystore.GetLegacyScriptPubKeyMan()->IsMine(scriptPubKey);
242 LOCK(keystore.GetLegacyScriptPubKeyMan()->cs_KeyStore);
243 BOOST_CHECK(keystore.GetLegacyScriptPubKeyMan()->AddKey(keys[0]));
245 scriptPubKey.
clear();
248 result = keystore.GetLegacyScriptPubKeyMan()->IsMine(scriptPubKey);
static std::unique_ptr< BerkeleyDatabase > CreateDummy()
Return object for accessing dummy database with no read/write capabilities.
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.
CScript GetScriptForRawPubKey(const CPubKey &pubKey)
Generate a P2PK script for the given pubkey.
NodeContext struct containing references to chain state and connection state.
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.
std::vector< uint8_t > ToByteVector(const T &in)
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)
const CChainParams & Params()
Return the currently selected parameters.
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.
The WalletLocation class provides wallet information.
An encapsulated secp256k1 private key.
#define BOOST_CHECK(expr)
std::unique_ptr< Chain > MakeChain(NodeContext &node, const CChainParams ¶ms)
Return implementation of Chain interface.