mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-04-01 19:35:52 +02:00
bitcoin-wallet tool: Drop MakeChain calls
Pass null Chain interface pointer to CWallet. This is needed to drop libbitcoin_server dependency and avoid linking node code.
This commit is contained in:
@@ -3112,7 +3112,6 @@ bool CWallet::CommitTransaction(CTransactionRef tx, mapValue_t mapValue, std::ve
|
||||
|
||||
DBErrors CWallet::LoadWallet(bool& fFirstRunRet)
|
||||
{
|
||||
auto locked_chain = chain().lock();
|
||||
LOCK(cs_wallet);
|
||||
|
||||
fFirstRunRet = false;
|
||||
@@ -3976,7 +3975,7 @@ bool CWallet::Verify(interfaces::Chain& chain, const WalletLocation& location, b
|
||||
|
||||
if (salvage_wallet) {
|
||||
// Recover readable keypairs:
|
||||
CWallet dummyWallet(chain, WalletLocation(), WalletDatabase::CreateDummy());
|
||||
CWallet dummyWallet(&chain, WalletLocation(), WalletDatabase::CreateDummy());
|
||||
std::string backup_filename;
|
||||
if (!WalletBatch::Recover(wallet_path, (void *)&dummyWallet, WalletBatch::RecoverKeysOnlyFilter, backup_filename)) {
|
||||
return false;
|
||||
@@ -3996,7 +3995,7 @@ std::shared_ptr<CWallet> CWallet::CreateWalletFromFile(interfaces::Chain& chain,
|
||||
if (gArgs.GetBoolArg("-zapwallettxes", false)) {
|
||||
chain.initMessage(_("Zapping all transactions from wallet..."));
|
||||
|
||||
std::unique_ptr<CWallet> tempWallet = MakeUnique<CWallet>(chain, location, WalletDatabase::Create(location.GetPath()));
|
||||
std::unique_ptr<CWallet> tempWallet = MakeUnique<CWallet>(&chain, location, WalletDatabase::Create(location.GetPath()));
|
||||
DBErrors nZapWalletRet = tempWallet->ZapWalletTx(vWtx);
|
||||
if (nZapWalletRet != DBErrors::LOAD_OK) {
|
||||
chain.initError(strprintf(_("Error loading %s: Wallet corrupted"), walletFile));
|
||||
@@ -4010,7 +4009,7 @@ std::shared_ptr<CWallet> CWallet::CreateWalletFromFile(interfaces::Chain& chain,
|
||||
bool fFirstRun = true;
|
||||
// TODO: Can't use std::make_shared because we need a custom deleter but
|
||||
// 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, WalletDatabase::Create(location.GetPath())), ReleaseWallet);
|
||||
DBErrors nLoadWalletRet = walletInstance->LoadWallet(fFirstRun);
|
||||
if (nLoadWalletRet != DBErrors::LOAD_OK)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user