mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-04-21 04:09:09 +02:00
Remove WalletLocation class
This removes a source of complexity and indirection that makes it harder to understand path checking code. Path checks will be simplified in upcoming commits. There is no change in behavior in this commit other than a slightly more descriptive error message in `loadwallet` if the default "" wallet can't be found. (The error message is improved more in upcoming commit "wallet: Remove path checking code from loadwallet RPC".)
This commit is contained in:
@@ -35,7 +35,7 @@ BOOST_AUTO_TEST_CASE(ismine_standard)
|
||||
|
||||
// P2PK compressed
|
||||
{
|
||||
CWallet keystore(chain.get(), WalletLocation(), CreateDummyWalletDatabase());
|
||||
CWallet keystore(chain.get(), "", CreateDummyWalletDatabase());
|
||||
keystore.SetupLegacyScriptPubKeyMan();
|
||||
LOCK(keystore.GetLegacyScriptPubKeyMan()->cs_KeyStore);
|
||||
scriptPubKey = GetScriptForRawPubKey(pubkeys[0]);
|
||||
@@ -52,7 +52,7 @@ BOOST_AUTO_TEST_CASE(ismine_standard)
|
||||
|
||||
// P2PK uncompressed
|
||||
{
|
||||
CWallet keystore(chain.get(), WalletLocation(), CreateDummyWalletDatabase());
|
||||
CWallet keystore(chain.get(), "", CreateDummyWalletDatabase());
|
||||
keystore.SetupLegacyScriptPubKeyMan();
|
||||
LOCK(keystore.GetLegacyScriptPubKeyMan()->cs_KeyStore);
|
||||
scriptPubKey = GetScriptForRawPubKey(uncompressedPubkey);
|
||||
@@ -69,7 +69,7 @@ BOOST_AUTO_TEST_CASE(ismine_standard)
|
||||
|
||||
// P2PKH compressed
|
||||
{
|
||||
CWallet keystore(chain.get(), WalletLocation(), CreateDummyWalletDatabase());
|
||||
CWallet keystore(chain.get(), "", CreateDummyWalletDatabase());
|
||||
keystore.SetupLegacyScriptPubKeyMan();
|
||||
LOCK(keystore.GetLegacyScriptPubKeyMan()->cs_KeyStore);
|
||||
scriptPubKey = GetScriptForDestination(PKHash(pubkeys[0]));
|
||||
@@ -86,7 +86,7 @@ BOOST_AUTO_TEST_CASE(ismine_standard)
|
||||
|
||||
// P2PKH uncompressed
|
||||
{
|
||||
CWallet keystore(chain.get(), WalletLocation(), CreateDummyWalletDatabase());
|
||||
CWallet keystore(chain.get(), "", CreateDummyWalletDatabase());
|
||||
keystore.SetupLegacyScriptPubKeyMan();
|
||||
LOCK(keystore.GetLegacyScriptPubKeyMan()->cs_KeyStore);
|
||||
scriptPubKey = GetScriptForDestination(PKHash(uncompressedPubkey));
|
||||
@@ -103,7 +103,7 @@ BOOST_AUTO_TEST_CASE(ismine_standard)
|
||||
|
||||
// P2SH
|
||||
{
|
||||
CWallet keystore(chain.get(), WalletLocation(), CreateDummyWalletDatabase());
|
||||
CWallet keystore(chain.get(), "", CreateDummyWalletDatabase());
|
||||
keystore.SetupLegacyScriptPubKeyMan();
|
||||
LOCK(keystore.GetLegacyScriptPubKeyMan()->cs_KeyStore);
|
||||
|
||||
@@ -127,7 +127,7 @@ BOOST_AUTO_TEST_CASE(ismine_standard)
|
||||
|
||||
// (P2PKH inside) P2SH inside P2SH (invalid)
|
||||
{
|
||||
CWallet keystore(chain.get(), WalletLocation(), CreateDummyWalletDatabase());
|
||||
CWallet keystore(chain.get(), "", CreateDummyWalletDatabase());
|
||||
keystore.SetupLegacyScriptPubKeyMan();
|
||||
LOCK(keystore.GetLegacyScriptPubKeyMan()->cs_KeyStore);
|
||||
|
||||
@@ -145,7 +145,7 @@ BOOST_AUTO_TEST_CASE(ismine_standard)
|
||||
|
||||
// (P2PKH inside) P2SH inside P2WSH (invalid)
|
||||
{
|
||||
CWallet keystore(chain.get(), WalletLocation(), CreateDummyWalletDatabase());
|
||||
CWallet keystore(chain.get(), "", CreateDummyWalletDatabase());
|
||||
keystore.SetupLegacyScriptPubKeyMan();
|
||||
LOCK(keystore.GetLegacyScriptPubKeyMan()->cs_KeyStore);
|
||||
|
||||
@@ -163,7 +163,7 @@ BOOST_AUTO_TEST_CASE(ismine_standard)
|
||||
|
||||
// P2WPKH inside P2WSH (invalid)
|
||||
{
|
||||
CWallet keystore(chain.get(), WalletLocation(), CreateDummyWalletDatabase());
|
||||
CWallet keystore(chain.get(), "", CreateDummyWalletDatabase());
|
||||
keystore.SetupLegacyScriptPubKeyMan();
|
||||
LOCK(keystore.GetLegacyScriptPubKeyMan()->cs_KeyStore);
|
||||
|
||||
@@ -179,7 +179,7 @@ BOOST_AUTO_TEST_CASE(ismine_standard)
|
||||
|
||||
// (P2PKH inside) P2WSH inside P2WSH (invalid)
|
||||
{
|
||||
CWallet keystore(chain.get(), WalletLocation(), CreateDummyWalletDatabase());
|
||||
CWallet keystore(chain.get(), "", CreateDummyWalletDatabase());
|
||||
keystore.SetupLegacyScriptPubKeyMan();
|
||||
LOCK(keystore.GetLegacyScriptPubKeyMan()->cs_KeyStore);
|
||||
|
||||
@@ -197,7 +197,7 @@ BOOST_AUTO_TEST_CASE(ismine_standard)
|
||||
|
||||
// P2WPKH compressed
|
||||
{
|
||||
CWallet keystore(chain.get(), WalletLocation(), CreateDummyWalletDatabase());
|
||||
CWallet keystore(chain.get(), "", CreateDummyWalletDatabase());
|
||||
keystore.SetupLegacyScriptPubKeyMan();
|
||||
LOCK(keystore.GetLegacyScriptPubKeyMan()->cs_KeyStore);
|
||||
BOOST_CHECK(keystore.GetLegacyScriptPubKeyMan()->AddKey(keys[0]));
|
||||
@@ -212,7 +212,7 @@ BOOST_AUTO_TEST_CASE(ismine_standard)
|
||||
|
||||
// P2WPKH uncompressed
|
||||
{
|
||||
CWallet keystore(chain.get(), WalletLocation(), CreateDummyWalletDatabase());
|
||||
CWallet keystore(chain.get(), "", CreateDummyWalletDatabase());
|
||||
keystore.SetupLegacyScriptPubKeyMan();
|
||||
LOCK(keystore.GetLegacyScriptPubKeyMan()->cs_KeyStore);
|
||||
BOOST_CHECK(keystore.GetLegacyScriptPubKeyMan()->AddKey(uncompressedKey));
|
||||
@@ -231,7 +231,7 @@ BOOST_AUTO_TEST_CASE(ismine_standard)
|
||||
|
||||
// scriptPubKey multisig
|
||||
{
|
||||
CWallet keystore(chain.get(), WalletLocation(), CreateDummyWalletDatabase());
|
||||
CWallet keystore(chain.get(), "", CreateDummyWalletDatabase());
|
||||
keystore.SetupLegacyScriptPubKeyMan();
|
||||
LOCK(keystore.GetLegacyScriptPubKeyMan()->cs_KeyStore);
|
||||
|
||||
@@ -262,7 +262,7 @@ BOOST_AUTO_TEST_CASE(ismine_standard)
|
||||
|
||||
// P2SH multisig
|
||||
{
|
||||
CWallet keystore(chain.get(), WalletLocation(), CreateDummyWalletDatabase());
|
||||
CWallet keystore(chain.get(), "", CreateDummyWalletDatabase());
|
||||
keystore.SetupLegacyScriptPubKeyMan();
|
||||
LOCK(keystore.GetLegacyScriptPubKeyMan()->cs_KeyStore);
|
||||
BOOST_CHECK(keystore.GetLegacyScriptPubKeyMan()->AddKey(uncompressedKey));
|
||||
@@ -283,7 +283,7 @@ BOOST_AUTO_TEST_CASE(ismine_standard)
|
||||
|
||||
// P2WSH multisig with compressed keys
|
||||
{
|
||||
CWallet keystore(chain.get(), WalletLocation(), CreateDummyWalletDatabase());
|
||||
CWallet keystore(chain.get(), "", CreateDummyWalletDatabase());
|
||||
keystore.SetupLegacyScriptPubKeyMan();
|
||||
LOCK(keystore.GetLegacyScriptPubKeyMan()->cs_KeyStore);
|
||||
BOOST_CHECK(keystore.GetLegacyScriptPubKeyMan()->AddKey(keys[0]));
|
||||
@@ -309,7 +309,7 @@ BOOST_AUTO_TEST_CASE(ismine_standard)
|
||||
|
||||
// P2WSH multisig with uncompressed key
|
||||
{
|
||||
CWallet keystore(chain.get(), WalletLocation(), CreateDummyWalletDatabase());
|
||||
CWallet keystore(chain.get(), "", CreateDummyWalletDatabase());
|
||||
keystore.SetupLegacyScriptPubKeyMan();
|
||||
LOCK(keystore.GetLegacyScriptPubKeyMan()->cs_KeyStore);
|
||||
BOOST_CHECK(keystore.GetLegacyScriptPubKeyMan()->AddKey(uncompressedKey));
|
||||
@@ -335,7 +335,7 @@ BOOST_AUTO_TEST_CASE(ismine_standard)
|
||||
|
||||
// P2WSH multisig wrapped in P2SH
|
||||
{
|
||||
CWallet keystore(chain.get(), WalletLocation(), CreateDummyWalletDatabase());
|
||||
CWallet keystore(chain.get(), "", CreateDummyWalletDatabase());
|
||||
keystore.SetupLegacyScriptPubKeyMan();
|
||||
LOCK(keystore.GetLegacyScriptPubKeyMan()->cs_KeyStore);
|
||||
|
||||
@@ -362,7 +362,7 @@ BOOST_AUTO_TEST_CASE(ismine_standard)
|
||||
|
||||
// OP_RETURN
|
||||
{
|
||||
CWallet keystore(chain.get(), WalletLocation(), CreateDummyWalletDatabase());
|
||||
CWallet keystore(chain.get(), "", CreateDummyWalletDatabase());
|
||||
keystore.SetupLegacyScriptPubKeyMan();
|
||||
LOCK(keystore.GetLegacyScriptPubKeyMan()->cs_KeyStore);
|
||||
BOOST_CHECK(keystore.GetLegacyScriptPubKeyMan()->AddKey(keys[0]));
|
||||
@@ -376,7 +376,7 @@ BOOST_AUTO_TEST_CASE(ismine_standard)
|
||||
|
||||
// witness unspendable
|
||||
{
|
||||
CWallet keystore(chain.get(), WalletLocation(), CreateDummyWalletDatabase());
|
||||
CWallet keystore(chain.get(), "", CreateDummyWalletDatabase());
|
||||
keystore.SetupLegacyScriptPubKeyMan();
|
||||
LOCK(keystore.GetLegacyScriptPubKeyMan()->cs_KeyStore);
|
||||
BOOST_CHECK(keystore.GetLegacyScriptPubKeyMan()->AddKey(keys[0]));
|
||||
@@ -390,7 +390,7 @@ BOOST_AUTO_TEST_CASE(ismine_standard)
|
||||
|
||||
// witness unknown
|
||||
{
|
||||
CWallet keystore(chain.get(), WalletLocation(), CreateDummyWalletDatabase());
|
||||
CWallet keystore(chain.get(), "", CreateDummyWalletDatabase());
|
||||
keystore.SetupLegacyScriptPubKeyMan();
|
||||
LOCK(keystore.GetLegacyScriptPubKeyMan()->cs_KeyStore);
|
||||
BOOST_CHECK(keystore.GetLegacyScriptPubKeyMan()->AddKey(keys[0]));
|
||||
@@ -404,7 +404,7 @@ BOOST_AUTO_TEST_CASE(ismine_standard)
|
||||
|
||||
// Nonstandard
|
||||
{
|
||||
CWallet keystore(chain.get(), WalletLocation(), CreateDummyWalletDatabase());
|
||||
CWallet keystore(chain.get(), "", CreateDummyWalletDatabase());
|
||||
keystore.SetupLegacyScriptPubKeyMan();
|
||||
LOCK(keystore.GetLegacyScriptPubKeyMan()->cs_KeyStore);
|
||||
BOOST_CHECK(keystore.GetLegacyScriptPubKeyMan()->AddKey(keys[0]));
|
||||
|
||||
Reference in New Issue
Block a user