scripted-diff: Replace WalletDatabase::Create* with CreateWalletDatabase
-BEGIN VERIFY SCRIPT-
sed -i -e 's/WalletDatabase::Create(/CreateWalletDatabase(/g' `git grep -l "WalletDatabase::Create("`
sed -i -e 's/WalletDatabase::CreateDummy(/CreateDummyWalletDatabase(/g' `git grep -l "WalletDatabase::CreateDummy("`
sed -i -e 's/WalletDatabase::CreateMock(/CreateMockWalletDatabase(/g' `git grep -l "WalletDatabase::CreateMock("`
-END VERIFY SCRIPT-
This commit is contained in:
1 parent
45c08f8a7b
commit
d6045d0ac6
12 files changed
+46
-46
No files matched your search
@@ -31,7 +31,7 @@ static void CoinSelection(benchmark::State& state)
|
|||||||
{
|
{
|
||||||
NodeContext node;
|
NodeContext node;
|
||||||
auto chain = interfaces::MakeChain(node);
|
auto chain = interfaces::MakeChain(node);
|
||||||
CWallet wallet(chain.get(), WalletLocation(), WalletDatabase::CreateDummy());
|
CWallet wallet(chain.get(), WalletLocation(), CreateDummyWalletDatabase());
|
||||||
wallet.SetupLegacyScriptPubKeyMan();
|
wallet.SetupLegacyScriptPubKeyMan();
|
||||||
std::vector<std::unique_ptr<CWalletTx>> wtxs;
|
std::vector<std::unique_ptr<CWalletTx>> wtxs;
|
||||||
LOCK(wallet.cs_wallet);
|
LOCK(wallet.cs_wallet);
|
||||||
@@ -65,7 +65,7 @@ static void CoinSelection(benchmark::State& state)
|
|||||||
typedef std::set<CInputCoin> CoinSet;
|
typedef std::set<CInputCoin> CoinSet;
|
||||||
static NodeContext testNode;
|
static NodeContext testNode;
|
||||||
static auto testChain = interfaces::MakeChain(testNode);
|
static auto testChain = interfaces::MakeChain(testNode);
|
||||||
static CWallet testWallet(testChain.get(), WalletLocation(), WalletDatabase::CreateDummy());
|
static CWallet testWallet(testChain.get(), WalletLocation(), CreateDummyWalletDatabase());
|
||||||
std::vector<std::unique_ptr<CWalletTx>> wtxn;
|
std::vector<std::unique_ptr<CWalletTx>> wtxn;
|
||||||
|
|
||||||
// Copied from src/wallet/test/coinselector_tests.cpp
|
// Copied from src/wallet/test/coinselector_tests.cpp
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ static void WalletBalance(benchmark::State& state, const bool set_dirty, const b
|
|||||||
|
|
||||||
NodeContext node;
|
NodeContext node;
|
||||||
std::unique_ptr<interfaces::Chain> chain = interfaces::MakeChain(node);
|
std::unique_ptr<interfaces::Chain> chain = interfaces::MakeChain(node);
|
||||||
CWallet wallet{chain.get(), WalletLocation(), WalletDatabase::CreateMock()};
|
CWallet wallet{chain.get(), WalletLocation(), CreateMockWalletDatabase()};
|
||||||
{
|
{
|
||||||
wallet.SetupLegacyScriptPubKeyMan();
|
wallet.SetupLegacyScriptPubKeyMan();
|
||||||
bool first_run;
|
bool first_run;
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ void EditAddressAndSubmit(
|
|||||||
void TestAddAddressesToSendBook(interfaces::Node& node)
|
void TestAddAddressesToSendBook(interfaces::Node& node)
|
||||||
{
|
{
|
||||||
TestChain100Setup test;
|
TestChain100Setup test;
|
||||||
std::shared_ptr<CWallet> wallet = std::make_shared<CWallet>(node.context()->chain.get(), WalletLocation(), WalletDatabase::CreateMock());
|
std::shared_ptr<CWallet> wallet = std::make_shared<CWallet>(node.context()->chain.get(), WalletLocation(), CreateMockWalletDatabase());
|
||||||
wallet->SetupLegacyScriptPubKeyMan();
|
wallet->SetupLegacyScriptPubKeyMan();
|
||||||
bool firstRun;
|
bool firstRun;
|
||||||
wallet->LoadWallet(firstRun);
|
wallet->LoadWallet(firstRun);
|
||||||
|
|||||||
@@ -140,7 +140,7 @@ void TestGUI(interfaces::Node& node)
|
|||||||
}
|
}
|
||||||
node.context()->connman = std::move(test.m_node.connman);
|
node.context()->connman = std::move(test.m_node.connman);
|
||||||
node.context()->mempool = std::move(test.m_node.mempool);
|
node.context()->mempool = std::move(test.m_node.mempool);
|
||||||
std::shared_ptr<CWallet> wallet = std::make_shared<CWallet>(node.context()->chain.get(), WalletLocation(), WalletDatabase::CreateMock());
|
std::shared_ptr<CWallet> wallet = std::make_shared<CWallet>(node.context()->chain.get(), WalletLocation(), CreateMockWalletDatabase());
|
||||||
bool firstRun;
|
bool firstRun;
|
||||||
wallet->LoadWallet(firstRun);
|
wallet->LoadWallet(firstRun);
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -116,7 +116,7 @@ bool RecoverDatabaseFile(const fs::path& file_path)
|
|||||||
}
|
}
|
||||||
|
|
||||||
DbTxn* ptxn = env->TxnBegin();
|
DbTxn* ptxn = env->TxnBegin();
|
||||||
CWallet dummyWallet(nullptr, WalletLocation(), WalletDatabase::CreateDummy());
|
CWallet dummyWallet(nullptr, WalletLocation(), CreateDummyWalletDatabase());
|
||||||
for (KeyValPair& row : salvagedData)
|
for (KeyValPair& row : salvagedData)
|
||||||
{
|
{
|
||||||
/* Filter for only private key type KV pairs to be added to the salvaged wallet */
|
/* Filter for only private key type KV pairs to be added to the salvaged wallet */
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ typedef std::set<CInputCoin> CoinSet;
|
|||||||
static std::vector<COutput> vCoins;
|
static std::vector<COutput> vCoins;
|
||||||
static NodeContext testNode;
|
static NodeContext testNode;
|
||||||
static auto testChain = interfaces::MakeChain(testNode);
|
static auto testChain = interfaces::MakeChain(testNode);
|
||||||
static CWallet testWallet(testChain.get(), WalletLocation(), WalletDatabase::CreateDummy());
|
static CWallet testWallet(testChain.get(), WalletLocation(), CreateDummyWalletDatabase());
|
||||||
static CAmount balance = 0;
|
static CAmount balance = 0;
|
||||||
|
|
||||||
CoinEligibilityFilter filter_standard(1, 6, 0);
|
CoinEligibilityFilter filter_standard(1, 6, 0);
|
||||||
@@ -283,7 +283,7 @@ BOOST_AUTO_TEST_CASE(bnb_search_test)
|
|||||||
// Make sure that can use BnB when there are preset inputs
|
// Make sure that can use BnB when there are preset inputs
|
||||||
empty_wallet();
|
empty_wallet();
|
||||||
{
|
{
|
||||||
std::unique_ptr<CWallet> wallet = MakeUnique<CWallet>(m_chain.get(), WalletLocation(), WalletDatabase::CreateMock());
|
std::unique_ptr<CWallet> wallet = MakeUnique<CWallet>(m_chain.get(), WalletLocation(), CreateMockWalletDatabase());
|
||||||
bool firstRun;
|
bool firstRun;
|
||||||
wallet->LoadWallet(firstRun);
|
wallet->LoadWallet(firstRun);
|
||||||
wallet->SetupLegacyScriptPubKeyMan();
|
wallet->SetupLegacyScriptPubKeyMan();
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ BOOST_AUTO_TEST_CASE(ismine_standard)
|
|||||||
|
|
||||||
// P2PK compressed
|
// P2PK compressed
|
||||||
{
|
{
|
||||||
CWallet keystore(chain.get(), WalletLocation(), WalletDatabase::CreateDummy());
|
CWallet keystore(chain.get(), WalletLocation(), CreateDummyWalletDatabase());
|
||||||
keystore.SetupLegacyScriptPubKeyMan();
|
keystore.SetupLegacyScriptPubKeyMan();
|
||||||
LOCK(keystore.GetLegacyScriptPubKeyMan()->cs_KeyStore);
|
LOCK(keystore.GetLegacyScriptPubKeyMan()->cs_KeyStore);
|
||||||
scriptPubKey = GetScriptForRawPubKey(pubkeys[0]);
|
scriptPubKey = GetScriptForRawPubKey(pubkeys[0]);
|
||||||
@@ -52,7 +52,7 @@ BOOST_AUTO_TEST_CASE(ismine_standard)
|
|||||||
|
|
||||||
// P2PK uncompressed
|
// P2PK uncompressed
|
||||||
{
|
{
|
||||||
CWallet keystore(chain.get(), WalletLocation(), WalletDatabase::CreateDummy());
|
CWallet keystore(chain.get(), WalletLocation(), CreateDummyWalletDatabase());
|
||||||
keystore.SetupLegacyScriptPubKeyMan();
|
keystore.SetupLegacyScriptPubKeyMan();
|
||||||
LOCK(keystore.GetLegacyScriptPubKeyMan()->cs_KeyStore);
|
LOCK(keystore.GetLegacyScriptPubKeyMan()->cs_KeyStore);
|
||||||
scriptPubKey = GetScriptForRawPubKey(uncompressedPubkey);
|
scriptPubKey = GetScriptForRawPubKey(uncompressedPubkey);
|
||||||
@@ -69,7 +69,7 @@ BOOST_AUTO_TEST_CASE(ismine_standard)
|
|||||||
|
|
||||||
// P2PKH compressed
|
// P2PKH compressed
|
||||||
{
|
{
|
||||||
CWallet keystore(chain.get(), WalletLocation(), WalletDatabase::CreateDummy());
|
CWallet keystore(chain.get(), WalletLocation(), CreateDummyWalletDatabase());
|
||||||
keystore.SetupLegacyScriptPubKeyMan();
|
keystore.SetupLegacyScriptPubKeyMan();
|
||||||
LOCK(keystore.GetLegacyScriptPubKeyMan()->cs_KeyStore);
|
LOCK(keystore.GetLegacyScriptPubKeyMan()->cs_KeyStore);
|
||||||
scriptPubKey = GetScriptForDestination(PKHash(pubkeys[0]));
|
scriptPubKey = GetScriptForDestination(PKHash(pubkeys[0]));
|
||||||
@@ -86,7 +86,7 @@ BOOST_AUTO_TEST_CASE(ismine_standard)
|
|||||||
|
|
||||||
// P2PKH uncompressed
|
// P2PKH uncompressed
|
||||||
{
|
{
|
||||||
CWallet keystore(chain.get(), WalletLocation(), WalletDatabase::CreateDummy());
|
CWallet keystore(chain.get(), WalletLocation(), CreateDummyWalletDatabase());
|
||||||
keystore.SetupLegacyScriptPubKeyMan();
|
keystore.SetupLegacyScriptPubKeyMan();
|
||||||
LOCK(keystore.GetLegacyScriptPubKeyMan()->cs_KeyStore);
|
LOCK(keystore.GetLegacyScriptPubKeyMan()->cs_KeyStore);
|
||||||
scriptPubKey = GetScriptForDestination(PKHash(uncompressedPubkey));
|
scriptPubKey = GetScriptForDestination(PKHash(uncompressedPubkey));
|
||||||
@@ -103,7 +103,7 @@ BOOST_AUTO_TEST_CASE(ismine_standard)
|
|||||||
|
|
||||||
// P2SH
|
// P2SH
|
||||||
{
|
{
|
||||||
CWallet keystore(chain.get(), WalletLocation(), WalletDatabase::CreateDummy());
|
CWallet keystore(chain.get(), WalletLocation(), CreateDummyWalletDatabase());
|
||||||
keystore.SetupLegacyScriptPubKeyMan();
|
keystore.SetupLegacyScriptPubKeyMan();
|
||||||
LOCK(keystore.GetLegacyScriptPubKeyMan()->cs_KeyStore);
|
LOCK(keystore.GetLegacyScriptPubKeyMan()->cs_KeyStore);
|
||||||
|
|
||||||
@@ -127,7 +127,7 @@ BOOST_AUTO_TEST_CASE(ismine_standard)
|
|||||||
|
|
||||||
// (P2PKH inside) P2SH inside P2SH (invalid)
|
// (P2PKH inside) P2SH inside P2SH (invalid)
|
||||||
{
|
{
|
||||||
CWallet keystore(chain.get(), WalletLocation(), WalletDatabase::CreateDummy());
|
CWallet keystore(chain.get(), WalletLocation(), CreateDummyWalletDatabase());
|
||||||
keystore.SetupLegacyScriptPubKeyMan();
|
keystore.SetupLegacyScriptPubKeyMan();
|
||||||
LOCK(keystore.GetLegacyScriptPubKeyMan()->cs_KeyStore);
|
LOCK(keystore.GetLegacyScriptPubKeyMan()->cs_KeyStore);
|
||||||
|
|
||||||
@@ -145,7 +145,7 @@ BOOST_AUTO_TEST_CASE(ismine_standard)
|
|||||||
|
|
||||||
// (P2PKH inside) P2SH inside P2WSH (invalid)
|
// (P2PKH inside) P2SH inside P2WSH (invalid)
|
||||||
{
|
{
|
||||||
CWallet keystore(chain.get(), WalletLocation(), WalletDatabase::CreateDummy());
|
CWallet keystore(chain.get(), WalletLocation(), CreateDummyWalletDatabase());
|
||||||
keystore.SetupLegacyScriptPubKeyMan();
|
keystore.SetupLegacyScriptPubKeyMan();
|
||||||
LOCK(keystore.GetLegacyScriptPubKeyMan()->cs_KeyStore);
|
LOCK(keystore.GetLegacyScriptPubKeyMan()->cs_KeyStore);
|
||||||
|
|
||||||
@@ -163,7 +163,7 @@ BOOST_AUTO_TEST_CASE(ismine_standard)
|
|||||||
|
|
||||||
// P2WPKH inside P2WSH (invalid)
|
// P2WPKH inside P2WSH (invalid)
|
||||||
{
|
{
|
||||||
CWallet keystore(chain.get(), WalletLocation(), WalletDatabase::CreateDummy());
|
CWallet keystore(chain.get(), WalletLocation(), CreateDummyWalletDatabase());
|
||||||
keystore.SetupLegacyScriptPubKeyMan();
|
keystore.SetupLegacyScriptPubKeyMan();
|
||||||
LOCK(keystore.GetLegacyScriptPubKeyMan()->cs_KeyStore);
|
LOCK(keystore.GetLegacyScriptPubKeyMan()->cs_KeyStore);
|
||||||
|
|
||||||
@@ -179,7 +179,7 @@ BOOST_AUTO_TEST_CASE(ismine_standard)
|
|||||||
|
|
||||||
// (P2PKH inside) P2WSH inside P2WSH (invalid)
|
// (P2PKH inside) P2WSH inside P2WSH (invalid)
|
||||||
{
|
{
|
||||||
CWallet keystore(chain.get(), WalletLocation(), WalletDatabase::CreateDummy());
|
CWallet keystore(chain.get(), WalletLocation(), CreateDummyWalletDatabase());
|
||||||
keystore.SetupLegacyScriptPubKeyMan();
|
keystore.SetupLegacyScriptPubKeyMan();
|
||||||
LOCK(keystore.GetLegacyScriptPubKeyMan()->cs_KeyStore);
|
LOCK(keystore.GetLegacyScriptPubKeyMan()->cs_KeyStore);
|
||||||
|
|
||||||
@@ -197,7 +197,7 @@ BOOST_AUTO_TEST_CASE(ismine_standard)
|
|||||||
|
|
||||||
// P2WPKH compressed
|
// P2WPKH compressed
|
||||||
{
|
{
|
||||||
CWallet keystore(chain.get(), WalletLocation(), WalletDatabase::CreateDummy());
|
CWallet keystore(chain.get(), WalletLocation(), CreateDummyWalletDatabase());
|
||||||
keystore.SetupLegacyScriptPubKeyMan();
|
keystore.SetupLegacyScriptPubKeyMan();
|
||||||
LOCK(keystore.GetLegacyScriptPubKeyMan()->cs_KeyStore);
|
LOCK(keystore.GetLegacyScriptPubKeyMan()->cs_KeyStore);
|
||||||
BOOST_CHECK(keystore.GetLegacyScriptPubKeyMan()->AddKey(keys[0]));
|
BOOST_CHECK(keystore.GetLegacyScriptPubKeyMan()->AddKey(keys[0]));
|
||||||
@@ -212,7 +212,7 @@ BOOST_AUTO_TEST_CASE(ismine_standard)
|
|||||||
|
|
||||||
// P2WPKH uncompressed
|
// P2WPKH uncompressed
|
||||||
{
|
{
|
||||||
CWallet keystore(chain.get(), WalletLocation(), WalletDatabase::CreateDummy());
|
CWallet keystore(chain.get(), WalletLocation(), CreateDummyWalletDatabase());
|
||||||
keystore.SetupLegacyScriptPubKeyMan();
|
keystore.SetupLegacyScriptPubKeyMan();
|
||||||
LOCK(keystore.GetLegacyScriptPubKeyMan()->cs_KeyStore);
|
LOCK(keystore.GetLegacyScriptPubKeyMan()->cs_KeyStore);
|
||||||
BOOST_CHECK(keystore.GetLegacyScriptPubKeyMan()->AddKey(uncompressedKey));
|
BOOST_CHECK(keystore.GetLegacyScriptPubKeyMan()->AddKey(uncompressedKey));
|
||||||
@@ -231,7 +231,7 @@ BOOST_AUTO_TEST_CASE(ismine_standard)
|
|||||||
|
|
||||||
// scriptPubKey multisig
|
// scriptPubKey multisig
|
||||||
{
|
{
|
||||||
CWallet keystore(chain.get(), WalletLocation(), WalletDatabase::CreateDummy());
|
CWallet keystore(chain.get(), WalletLocation(), CreateDummyWalletDatabase());
|
||||||
keystore.SetupLegacyScriptPubKeyMan();
|
keystore.SetupLegacyScriptPubKeyMan();
|
||||||
LOCK(keystore.GetLegacyScriptPubKeyMan()->cs_KeyStore);
|
LOCK(keystore.GetLegacyScriptPubKeyMan()->cs_KeyStore);
|
||||||
|
|
||||||
@@ -262,7 +262,7 @@ BOOST_AUTO_TEST_CASE(ismine_standard)
|
|||||||
|
|
||||||
// P2SH multisig
|
// P2SH multisig
|
||||||
{
|
{
|
||||||
CWallet keystore(chain.get(), WalletLocation(), WalletDatabase::CreateDummy());
|
CWallet keystore(chain.get(), WalletLocation(), CreateDummyWalletDatabase());
|
||||||
keystore.SetupLegacyScriptPubKeyMan();
|
keystore.SetupLegacyScriptPubKeyMan();
|
||||||
LOCK(keystore.GetLegacyScriptPubKeyMan()->cs_KeyStore);
|
LOCK(keystore.GetLegacyScriptPubKeyMan()->cs_KeyStore);
|
||||||
BOOST_CHECK(keystore.GetLegacyScriptPubKeyMan()->AddKey(uncompressedKey));
|
BOOST_CHECK(keystore.GetLegacyScriptPubKeyMan()->AddKey(uncompressedKey));
|
||||||
@@ -283,7 +283,7 @@ BOOST_AUTO_TEST_CASE(ismine_standard)
|
|||||||
|
|
||||||
// P2WSH multisig with compressed keys
|
// P2WSH multisig with compressed keys
|
||||||
{
|
{
|
||||||
CWallet keystore(chain.get(), WalletLocation(), WalletDatabase::CreateDummy());
|
CWallet keystore(chain.get(), WalletLocation(), CreateDummyWalletDatabase());
|
||||||
keystore.SetupLegacyScriptPubKeyMan();
|
keystore.SetupLegacyScriptPubKeyMan();
|
||||||
LOCK(keystore.GetLegacyScriptPubKeyMan()->cs_KeyStore);
|
LOCK(keystore.GetLegacyScriptPubKeyMan()->cs_KeyStore);
|
||||||
BOOST_CHECK(keystore.GetLegacyScriptPubKeyMan()->AddKey(keys[0]));
|
BOOST_CHECK(keystore.GetLegacyScriptPubKeyMan()->AddKey(keys[0]));
|
||||||
@@ -309,7 +309,7 @@ BOOST_AUTO_TEST_CASE(ismine_standard)
|
|||||||
|
|
||||||
// P2WSH multisig with uncompressed key
|
// P2WSH multisig with uncompressed key
|
||||||
{
|
{
|
||||||
CWallet keystore(chain.get(), WalletLocation(), WalletDatabase::CreateDummy());
|
CWallet keystore(chain.get(), WalletLocation(), CreateDummyWalletDatabase());
|
||||||
keystore.SetupLegacyScriptPubKeyMan();
|
keystore.SetupLegacyScriptPubKeyMan();
|
||||||
LOCK(keystore.GetLegacyScriptPubKeyMan()->cs_KeyStore);
|
LOCK(keystore.GetLegacyScriptPubKeyMan()->cs_KeyStore);
|
||||||
BOOST_CHECK(keystore.GetLegacyScriptPubKeyMan()->AddKey(uncompressedKey));
|
BOOST_CHECK(keystore.GetLegacyScriptPubKeyMan()->AddKey(uncompressedKey));
|
||||||
@@ -335,7 +335,7 @@ BOOST_AUTO_TEST_CASE(ismine_standard)
|
|||||||
|
|
||||||
// P2WSH multisig wrapped in P2SH
|
// P2WSH multisig wrapped in P2SH
|
||||||
{
|
{
|
||||||
CWallet keystore(chain.get(), WalletLocation(), WalletDatabase::CreateDummy());
|
CWallet keystore(chain.get(), WalletLocation(), CreateDummyWalletDatabase());
|
||||||
keystore.SetupLegacyScriptPubKeyMan();
|
keystore.SetupLegacyScriptPubKeyMan();
|
||||||
LOCK(keystore.GetLegacyScriptPubKeyMan()->cs_KeyStore);
|
LOCK(keystore.GetLegacyScriptPubKeyMan()->cs_KeyStore);
|
||||||
|
|
||||||
@@ -362,7 +362,7 @@ BOOST_AUTO_TEST_CASE(ismine_standard)
|
|||||||
|
|
||||||
// OP_RETURN
|
// OP_RETURN
|
||||||
{
|
{
|
||||||
CWallet keystore(chain.get(), WalletLocation(), WalletDatabase::CreateDummy());
|
CWallet keystore(chain.get(), WalletLocation(), CreateDummyWalletDatabase());
|
||||||
keystore.SetupLegacyScriptPubKeyMan();
|
keystore.SetupLegacyScriptPubKeyMan();
|
||||||
LOCK(keystore.GetLegacyScriptPubKeyMan()->cs_KeyStore);
|
LOCK(keystore.GetLegacyScriptPubKeyMan()->cs_KeyStore);
|
||||||
BOOST_CHECK(keystore.GetLegacyScriptPubKeyMan()->AddKey(keys[0]));
|
BOOST_CHECK(keystore.GetLegacyScriptPubKeyMan()->AddKey(keys[0]));
|
||||||
@@ -376,7 +376,7 @@ BOOST_AUTO_TEST_CASE(ismine_standard)
|
|||||||
|
|
||||||
// witness unspendable
|
// witness unspendable
|
||||||
{
|
{
|
||||||
CWallet keystore(chain.get(), WalletLocation(), WalletDatabase::CreateDummy());
|
CWallet keystore(chain.get(), WalletLocation(), CreateDummyWalletDatabase());
|
||||||
keystore.SetupLegacyScriptPubKeyMan();
|
keystore.SetupLegacyScriptPubKeyMan();
|
||||||
LOCK(keystore.GetLegacyScriptPubKeyMan()->cs_KeyStore);
|
LOCK(keystore.GetLegacyScriptPubKeyMan()->cs_KeyStore);
|
||||||
BOOST_CHECK(keystore.GetLegacyScriptPubKeyMan()->AddKey(keys[0]));
|
BOOST_CHECK(keystore.GetLegacyScriptPubKeyMan()->AddKey(keys[0]));
|
||||||
@@ -390,7 +390,7 @@ BOOST_AUTO_TEST_CASE(ismine_standard)
|
|||||||
|
|
||||||
// witness unknown
|
// witness unknown
|
||||||
{
|
{
|
||||||
CWallet keystore(chain.get(), WalletLocation(), WalletDatabase::CreateDummy());
|
CWallet keystore(chain.get(), WalletLocation(), CreateDummyWalletDatabase());
|
||||||
keystore.SetupLegacyScriptPubKeyMan();
|
keystore.SetupLegacyScriptPubKeyMan();
|
||||||
LOCK(keystore.GetLegacyScriptPubKeyMan()->cs_KeyStore);
|
LOCK(keystore.GetLegacyScriptPubKeyMan()->cs_KeyStore);
|
||||||
BOOST_CHECK(keystore.GetLegacyScriptPubKeyMan()->AddKey(keys[0]));
|
BOOST_CHECK(keystore.GetLegacyScriptPubKeyMan()->AddKey(keys[0]));
|
||||||
@@ -404,7 +404,7 @@ BOOST_AUTO_TEST_CASE(ismine_standard)
|
|||||||
|
|
||||||
// Nonstandard
|
// Nonstandard
|
||||||
{
|
{
|
||||||
CWallet keystore(chain.get(), WalletLocation(), WalletDatabase::CreateDummy());
|
CWallet keystore(chain.get(), WalletLocation(), CreateDummyWalletDatabase());
|
||||||
keystore.SetupLegacyScriptPubKeyMan();
|
keystore.SetupLegacyScriptPubKeyMan();
|
||||||
LOCK(keystore.GetLegacyScriptPubKeyMan()->cs_KeyStore);
|
LOCK(keystore.GetLegacyScriptPubKeyMan()->cs_KeyStore);
|
||||||
BOOST_CHECK(keystore.GetLegacyScriptPubKeyMan()->AddKey(keys[0]));
|
BOOST_CHECK(keystore.GetLegacyScriptPubKeyMan()->AddKey(keys[0]));
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ BOOST_AUTO_TEST_CASE(CanProvide)
|
|||||||
// Set up wallet and keyman variables.
|
// Set up wallet and keyman variables.
|
||||||
NodeContext node;
|
NodeContext node;
|
||||||
std::unique_ptr<interfaces::Chain> chain = interfaces::MakeChain(node);
|
std::unique_ptr<interfaces::Chain> chain = interfaces::MakeChain(node);
|
||||||
CWallet wallet(chain.get(), WalletLocation(), WalletDatabase::CreateDummy());
|
CWallet wallet(chain.get(), WalletLocation(), CreateDummyWalletDatabase());
|
||||||
LegacyScriptPubKeyMan& keyman = *wallet.GetOrCreateLegacyScriptPubKeyMan();
|
LegacyScriptPubKeyMan& keyman = *wallet.GetOrCreateLegacyScriptPubKeyMan();
|
||||||
|
|
||||||
// Make a 1 of 2 multisig script
|
// Make a 1 of 2 multisig script
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
WalletTestingSetup::WalletTestingSetup(const std::string& chainName)
|
WalletTestingSetup::WalletTestingSetup(const std::string& chainName)
|
||||||
: TestingSetup(chainName),
|
: TestingSetup(chainName),
|
||||||
m_wallet(m_chain.get(), WalletLocation(), WalletDatabase::CreateMock())
|
m_wallet(m_chain.get(), WalletLocation(), CreateMockWalletDatabase())
|
||||||
{
|
{
|
||||||
bool fFirstRun;
|
bool fFirstRun;
|
||||||
m_wallet.LoadWallet(fFirstRun);
|
m_wallet.LoadWallet(fFirstRun);
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ BOOST_FIXTURE_TEST_CASE(scan_for_wallet_transactions, TestChain100Setup)
|
|||||||
|
|
||||||
// Verify ScanForWalletTransactions fails to read an unknown start block.
|
// Verify ScanForWalletTransactions fails to read an unknown start block.
|
||||||
{
|
{
|
||||||
CWallet wallet(chain.get(), WalletLocation(), WalletDatabase::CreateDummy());
|
CWallet wallet(chain.get(), WalletLocation(), CreateDummyWalletDatabase());
|
||||||
{
|
{
|
||||||
LOCK(wallet.cs_wallet);
|
LOCK(wallet.cs_wallet);
|
||||||
wallet.SetLastBlockProcessed(::ChainActive().Height(), ::ChainActive().Tip()->GetBlockHash());
|
wallet.SetLastBlockProcessed(::ChainActive().Height(), ::ChainActive().Tip()->GetBlockHash());
|
||||||
@@ -99,7 +99,7 @@ BOOST_FIXTURE_TEST_CASE(scan_for_wallet_transactions, TestChain100Setup)
|
|||||||
// Verify ScanForWalletTransactions picks up transactions in both the old
|
// Verify ScanForWalletTransactions picks up transactions in both the old
|
||||||
// and new block files.
|
// and new block files.
|
||||||
{
|
{
|
||||||
CWallet wallet(chain.get(), WalletLocation(), WalletDatabase::CreateDummy());
|
CWallet wallet(chain.get(), WalletLocation(), CreateDummyWalletDatabase());
|
||||||
{
|
{
|
||||||
LOCK(wallet.cs_wallet);
|
LOCK(wallet.cs_wallet);
|
||||||
wallet.SetLastBlockProcessed(::ChainActive().Height(), ::ChainActive().Tip()->GetBlockHash());
|
wallet.SetLastBlockProcessed(::ChainActive().Height(), ::ChainActive().Tip()->GetBlockHash());
|
||||||
@@ -125,7 +125,7 @@ BOOST_FIXTURE_TEST_CASE(scan_for_wallet_transactions, TestChain100Setup)
|
|||||||
// Verify ScanForWalletTransactions only picks transactions in the new block
|
// Verify ScanForWalletTransactions only picks transactions in the new block
|
||||||
// file.
|
// file.
|
||||||
{
|
{
|
||||||
CWallet wallet(chain.get(), WalletLocation(), WalletDatabase::CreateDummy());
|
CWallet wallet(chain.get(), WalletLocation(), CreateDummyWalletDatabase());
|
||||||
{
|
{
|
||||||
LOCK(wallet.cs_wallet);
|
LOCK(wallet.cs_wallet);
|
||||||
wallet.SetLastBlockProcessed(::ChainActive().Height(), ::ChainActive().Tip()->GetBlockHash());
|
wallet.SetLastBlockProcessed(::ChainActive().Height(), ::ChainActive().Tip()->GetBlockHash());
|
||||||
@@ -150,7 +150,7 @@ BOOST_FIXTURE_TEST_CASE(scan_for_wallet_transactions, TestChain100Setup)
|
|||||||
|
|
||||||
// Verify ScanForWalletTransactions scans no blocks.
|
// Verify ScanForWalletTransactions scans no blocks.
|
||||||
{
|
{
|
||||||
CWallet wallet(chain.get(), WalletLocation(), WalletDatabase::CreateDummy());
|
CWallet wallet(chain.get(), WalletLocation(), CreateDummyWalletDatabase());
|
||||||
{
|
{
|
||||||
LOCK(wallet.cs_wallet);
|
LOCK(wallet.cs_wallet);
|
||||||
wallet.SetLastBlockProcessed(::ChainActive().Height(), ::ChainActive().Tip()->GetBlockHash());
|
wallet.SetLastBlockProcessed(::ChainActive().Height(), ::ChainActive().Tip()->GetBlockHash());
|
||||||
@@ -189,7 +189,7 @@ BOOST_FIXTURE_TEST_CASE(importmulti_rescan, TestChain100Setup)
|
|||||||
// before the missing block, and success for a key whose creation time is
|
// before the missing block, and success for a key whose creation time is
|
||||||
// after.
|
// after.
|
||||||
{
|
{
|
||||||
std::shared_ptr<CWallet> wallet = std::make_shared<CWallet>(chain.get(), WalletLocation(), WalletDatabase::CreateDummy());
|
std::shared_ptr<CWallet> wallet = std::make_shared<CWallet>(chain.get(), WalletLocation(), CreateDummyWalletDatabase());
|
||||||
wallet->SetupLegacyScriptPubKeyMan();
|
wallet->SetupLegacyScriptPubKeyMan();
|
||||||
WITH_LOCK(wallet->cs_wallet, wallet->SetLastBlockProcessed(newTip->nHeight, newTip->GetBlockHash()));
|
WITH_LOCK(wallet->cs_wallet, wallet->SetLastBlockProcessed(newTip->nHeight, newTip->GetBlockHash()));
|
||||||
AddWallet(wallet);
|
AddWallet(wallet);
|
||||||
@@ -254,7 +254,7 @@ BOOST_FIXTURE_TEST_CASE(importwallet_rescan, TestChain100Setup)
|
|||||||
|
|
||||||
// Import key into wallet and call dumpwallet to create backup file.
|
// Import key into wallet and call dumpwallet to create backup file.
|
||||||
{
|
{
|
||||||
std::shared_ptr<CWallet> wallet = std::make_shared<CWallet>(chain.get(), WalletLocation(), WalletDatabase::CreateDummy());
|
std::shared_ptr<CWallet> wallet = std::make_shared<CWallet>(chain.get(), WalletLocation(), CreateDummyWalletDatabase());
|
||||||
{
|
{
|
||||||
auto spk_man = wallet->GetOrCreateLegacyScriptPubKeyMan();
|
auto spk_man = wallet->GetOrCreateLegacyScriptPubKeyMan();
|
||||||
LOCK2(wallet->cs_wallet, spk_man->cs_KeyStore);
|
LOCK2(wallet->cs_wallet, spk_man->cs_KeyStore);
|
||||||
@@ -276,7 +276,7 @@ BOOST_FIXTURE_TEST_CASE(importwallet_rescan, TestChain100Setup)
|
|||||||
// Call importwallet RPC and verify all blocks with timestamps >= BLOCK_TIME
|
// Call importwallet RPC and verify all blocks with timestamps >= BLOCK_TIME
|
||||||
// were scanned, and no prior blocks were scanned.
|
// were scanned, and no prior blocks were scanned.
|
||||||
{
|
{
|
||||||
std::shared_ptr<CWallet> wallet = std::make_shared<CWallet>(chain.get(), WalletLocation(), WalletDatabase::CreateDummy());
|
std::shared_ptr<CWallet> wallet = std::make_shared<CWallet>(chain.get(), WalletLocation(), CreateDummyWalletDatabase());
|
||||||
LOCK(wallet->cs_wallet);
|
LOCK(wallet->cs_wallet);
|
||||||
wallet->SetupLegacyScriptPubKeyMan();
|
wallet->SetupLegacyScriptPubKeyMan();
|
||||||
|
|
||||||
@@ -312,7 +312,7 @@ BOOST_FIXTURE_TEST_CASE(coin_mark_dirty_immature_credit, TestChain100Setup)
|
|||||||
NodeContext node;
|
NodeContext node;
|
||||||
auto chain = interfaces::MakeChain(node);
|
auto chain = interfaces::MakeChain(node);
|
||||||
|
|
||||||
CWallet wallet(chain.get(), WalletLocation(), WalletDatabase::CreateDummy());
|
CWallet wallet(chain.get(), WalletLocation(), CreateDummyWalletDatabase());
|
||||||
auto spk_man = wallet.GetOrCreateLegacyScriptPubKeyMan();
|
auto spk_man = wallet.GetOrCreateLegacyScriptPubKeyMan();
|
||||||
CWalletTx wtx(&wallet, m_coinbase_txns.back());
|
CWalletTx wtx(&wallet, m_coinbase_txns.back());
|
||||||
|
|
||||||
@@ -486,7 +486,7 @@ public:
|
|||||||
ListCoinsTestingSetup()
|
ListCoinsTestingSetup()
|
||||||
{
|
{
|
||||||
CreateAndProcessBlock({}, GetScriptForRawPubKey(coinbaseKey.GetPubKey()));
|
CreateAndProcessBlock({}, GetScriptForRawPubKey(coinbaseKey.GetPubKey()));
|
||||||
wallet = MakeUnique<CWallet>(m_chain.get(), WalletLocation(), WalletDatabase::CreateMock());
|
wallet = MakeUnique<CWallet>(m_chain.get(), WalletLocation(), CreateMockWalletDatabase());
|
||||||
{
|
{
|
||||||
LOCK2(wallet->cs_wallet, ::cs_main);
|
LOCK2(wallet->cs_wallet, ::cs_main);
|
||||||
wallet->SetLastBlockProcessed(::ChainActive().Height(), ::ChainActive().Tip()->GetBlockHash());
|
wallet->SetLastBlockProcessed(::ChainActive().Height(), ::ChainActive().Tip()->GetBlockHash());
|
||||||
@@ -604,7 +604,7 @@ BOOST_FIXTURE_TEST_CASE(wallet_disableprivkeys, TestChain100Setup)
|
|||||||
{
|
{
|
||||||
NodeContext node;
|
NodeContext node;
|
||||||
auto chain = interfaces::MakeChain(node);
|
auto chain = interfaces::MakeChain(node);
|
||||||
std::shared_ptr<CWallet> wallet = std::make_shared<CWallet>(chain.get(), WalletLocation(), WalletDatabase::CreateDummy());
|
std::shared_ptr<CWallet> wallet = std::make_shared<CWallet>(chain.get(), WalletLocation(), CreateDummyWalletDatabase());
|
||||||
wallet->SetupLegacyScriptPubKeyMan();
|
wallet->SetupLegacyScriptPubKeyMan();
|
||||||
wallet->SetMinVersion(FEATURE_LATEST);
|
wallet->SetMinVersion(FEATURE_LATEST);
|
||||||
wallet->SetWalletFlag(WALLET_FLAG_DISABLE_PRIVATE_KEYS);
|
wallet->SetWalletFlag(WALLET_FLAG_DISABLE_PRIVATE_KEYS);
|
||||||
|
|||||||
@@ -3705,7 +3705,7 @@ bool CWallet::Verify(interfaces::Chain& chain, const WalletLocation& location, b
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Keep same database environment instance across Verify/Recover calls below.
|
// Keep same database environment instance across Verify/Recover calls below.
|
||||||
std::unique_ptr<WalletDatabase> database = WalletDatabase::Create(wallet_path);
|
std::unique_ptr<WalletDatabase> database = CreateWalletDatabase(wallet_path);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (!WalletBatch::VerifyEnvironment(wallet_path, error_string)) {
|
if (!WalletBatch::VerifyEnvironment(wallet_path, error_string)) {
|
||||||
@@ -3729,7 +3729,7 @@ std::shared_ptr<CWallet> CWallet::CreateWalletFromFile(interfaces::Chain& chain,
|
|||||||
if (gArgs.GetBoolArg("-zapwallettxes", false)) {
|
if (gArgs.GetBoolArg("-zapwallettxes", false)) {
|
||||||
chain.initMessage(_("Zapping all transactions from wallet...").translated);
|
chain.initMessage(_("Zapping all transactions from wallet...").translated);
|
||||||
|
|
||||||
std::unique_ptr<CWallet> tempWallet = MakeUnique<CWallet>(&chain, location, WalletDatabase::Create(location.GetPath()));
|
std::unique_ptr<CWallet> tempWallet = MakeUnique<CWallet>(&chain, location, CreateWalletDatabase(location.GetPath()));
|
||||||
DBErrors nZapWalletRet = tempWallet->ZapWalletTx(vWtx);
|
DBErrors nZapWalletRet = tempWallet->ZapWalletTx(vWtx);
|
||||||
if (nZapWalletRet != DBErrors::LOAD_OK) {
|
if (nZapWalletRet != DBErrors::LOAD_OK) {
|
||||||
error = strprintf(_("Error loading %s: Wallet corrupted"), walletFile);
|
error = strprintf(_("Error loading %s: Wallet corrupted"), walletFile);
|
||||||
@@ -3743,7 +3743,7 @@ std::shared_ptr<CWallet> CWallet::CreateWalletFromFile(interfaces::Chain& chain,
|
|||||||
bool fFirstRun = true;
|
bool fFirstRun = true;
|
||||||
// TODO: Can't use std::make_shared because we need a custom deleter but
|
// TODO: Can't use std::make_shared because we need a custom deleter but
|
||||||
// should be possible to use std::allocate_shared.
|
// should be possible to use std::allocate_shared.
|
||||||
std::shared_ptr<CWallet> walletInstance(new CWallet(&chain, location, WalletDatabase::Create(location.GetPath())), ReleaseWallet);
|
std::shared_ptr<CWallet> walletInstance(new CWallet(&chain, location, CreateWalletDatabase(location.GetPath())), ReleaseWallet);
|
||||||
DBErrors nLoadWalletRet = walletInstance->LoadWallet(fFirstRun);
|
DBErrors nLoadWalletRet = walletInstance->LoadWallet(fFirstRun);
|
||||||
if (nLoadWalletRet != DBErrors::LOAD_OK) {
|
if (nLoadWalletRet != DBErrors::LOAD_OK) {
|
||||||
if (nLoadWalletRet == DBErrors::CORRUPT) {
|
if (nLoadWalletRet == DBErrors::CORRUPT) {
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ static std::shared_ptr<CWallet> CreateWallet(const std::string& name, const fs::
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
// dummy chain interface
|
// dummy chain interface
|
||||||
std::shared_ptr<CWallet> wallet_instance(new CWallet(nullptr /* chain */, WalletLocation(name), WalletDatabase::Create(path)), WalletToolReleaseWallet);
|
std::shared_ptr<CWallet> wallet_instance(new CWallet(nullptr /* chain */, WalletLocation(name), CreateWalletDatabase(path)), WalletToolReleaseWallet);
|
||||||
LOCK(wallet_instance->cs_wallet);
|
LOCK(wallet_instance->cs_wallet);
|
||||||
bool first_run = true;
|
bool first_run = true;
|
||||||
DBErrors load_wallet_ret = wallet_instance->LoadWallet(first_run);
|
DBErrors load_wallet_ret = wallet_instance->LoadWallet(first_run);
|
||||||
@@ -57,7 +57,7 @@ static std::shared_ptr<CWallet> LoadWallet(const std::string& name, const fs::pa
|
|||||||
}
|
}
|
||||||
|
|
||||||
// dummy chain interface
|
// dummy chain interface
|
||||||
std::shared_ptr<CWallet> wallet_instance(new CWallet(nullptr /* chain */, WalletLocation(name), WalletDatabase::Create(path)), WalletToolReleaseWallet);
|
std::shared_ptr<CWallet> wallet_instance(new CWallet(nullptr /* chain */, WalletLocation(name), CreateWalletDatabase(path)), WalletToolReleaseWallet);
|
||||||
DBErrors load_wallet_ret;
|
DBErrors load_wallet_ret;
|
||||||
try {
|
try {
|
||||||
bool first_run;
|
bool first_run;
|
||||||
@@ -107,7 +107,7 @@ static void WalletShowInfo(CWallet* wallet_instance)
|
|||||||
static bool SalvageWallet(const fs::path& path)
|
static bool SalvageWallet(const fs::path& path)
|
||||||
{
|
{
|
||||||
// Create a Database handle to allow for the db to be initialized before recovery
|
// Create a Database handle to allow for the db to be initialized before recovery
|
||||||
std::unique_ptr<WalletDatabase> database = WalletDatabase::Create(path);
|
std::unique_ptr<WalletDatabase> database = CreateWalletDatabase(path);
|
||||||
|
|
||||||
// Initialize the environment before recovery
|
// Initialize the environment before recovery
|
||||||
bilingual_str error_string;
|
bilingual_str error_string;
|
||||||
|
|||||||
Reference in new issue
Block a user