Skip to content

Commit 3340dba

Browse files
committed
Remove -zapwallettxes
-zapwallettxes is made a hidden option to inform users that it is removed and they should be using abandontransaction to do the stuck transaction thing.
1 parent 91af7ef commit 3340dba

File tree

13 files changed

+12
-184
lines changed

13 files changed

+12
-184
lines changed

doc/release-notes-19671.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Wallet
2+
------
3+
4+
* The `-zapwallettxes` startup option has been removed and its functionality removed from the wallet.
5+
This option was originally intended to allow for the fee bumping of transactions that did not
6+
signal RBF. This functionality has been superseded with the abandon transaction feature.

src/dummywallet.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ void DummyWalletInit::AddWalletOptions(ArgsManager& argsman) const
4949
"-walletdir=<dir>",
5050
"-walletnotify=<cmd>",
5151
"-walletrbf",
52-
"-zapwallettxes=<mode>",
5352
"-dblogsize=<n>",
5453
"-flushwallet",
5554
"-privdb",

src/wallet/init.cpp

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,13 @@ void WalletInit::AddWalletOptions(ArgsManager& argsman) const
6666
argsman.AddArg("-walletnotify=<cmd>", "Execute command when a wallet transaction changes. %s in cmd is replaced by TxID and %w is replaced by wallet name. %w is not currently implemented on windows. On systems where %w is supported, it should NOT be quoted because this would break shell escaping used to invoke the command.", ArgsManager::ALLOW_ANY, OptionsCategory::WALLET);
6767
#endif
6868
argsman.AddArg("-walletrbf", strprintf("Send transactions with full-RBF opt-in enabled (RPC only, default: %u)", DEFAULT_WALLET_RBF), ArgsManager::ALLOW_ANY, OptionsCategory::WALLET);
69-
argsman.AddArg("-zapwallettxes=<mode>", "Delete all wallet transactions and only recover those parts of the blockchain through -rescan on startup"
70-
" (1 = keep tx meta data e.g. payment request information, 2 = drop tx meta data)", ArgsManager::ALLOW_ANY, OptionsCategory::WALLET);
7169

7270
argsman.AddArg("-dblogsize=<n>", strprintf("Flush wallet database activity from memory to disk log every <n> megabytes (default: %u)", DEFAULT_WALLET_DBLOGSIZE), ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::WALLET_DEBUG_TEST);
7371
argsman.AddArg("-flushwallet", strprintf("Run a thread to flush wallet periodically (default: %u)", DEFAULT_FLUSHWALLET), ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::WALLET_DEBUG_TEST);
7472
argsman.AddArg("-privdb", strprintf("Sets the DB_PRIVATE flag in the wallet db environment (default: %u)", DEFAULT_WALLET_PRIVDB), ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::WALLET_DEBUG_TEST);
7573
argsman.AddArg("-walletrejectlongchains", strprintf("Wallet will not create transactions that violate mempool chain limits (default: %u)", DEFAULT_WALLET_REJECT_LONG_CHAINS), ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::WALLET_DEBUG_TEST);
74+
75+
argsman.AddHiddenArgs({"-zapwallettxes"});
7676
}
7777

7878
bool WalletInit::ParameterInteraction() const
@@ -85,26 +85,12 @@ bool WalletInit::ParameterInteraction() const
8585
return true;
8686
}
8787

88-
const bool is_multiwallet = gArgs.GetArgs("-wallet").size() > 1;
89-
9088
if (gArgs.GetBoolArg("-blocksonly", DEFAULT_BLOCKSONLY) && gArgs.SoftSetBoolArg("-walletbroadcast", false)) {
9189
LogPrintf("%s: parameter interaction: -blocksonly=1 -> setting -walletbroadcast=0\n", __func__);
9290
}
9391

94-
bool zapwallettxes = gArgs.GetBoolArg("-zapwallettxes", false);
95-
// -zapwallettxes implies dropping the mempool on startup
96-
if (zapwallettxes && gArgs.SoftSetBoolArg("-persistmempool", false)) {
97-
LogPrintf("%s: parameter interaction: -zapwallettxes enabled -> setting -persistmempool=0\n", __func__);
98-
}
99-
100-
// -zapwallettxes implies a rescan
101-
if (zapwallettxes) {
102-
if (is_multiwallet) {
103-
return InitError(strprintf(Untranslated("%s is only allowed with a single wallet file"), "-zapwallettxes"));
104-
}
105-
if (gArgs.SoftSetBoolArg("-rescan", true)) {
106-
LogPrintf("%s: parameter interaction: -zapwallettxes enabled -> setting -rescan=1\n", __func__);
107-
}
92+
if (gArgs.IsArgSet("-zapwallettxes")) {
93+
return InitError(Untranslated("-zapwallettxes has been removed. If you are attempting to remove a stuck transaction from your wallet, please use abandontransaction instead."));
10894
}
10995

11096
if (gArgs.GetBoolArg("-sysperms", false))

src/wallet/rpcwallet.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2494,7 +2494,7 @@ static UniValue loadwallet(const JSONRPCRequest& request)
24942494
RPCHelpMan{"loadwallet",
24952495
"\nLoads a wallet from a wallet file or directory."
24962496
"\nNote that all wallet command-line options used when starting bitcoind will be"
2497-
"\napplied to the new wallet (eg -zapwallettxes, rescan, etc).\n",
2497+
"\napplied to the new wallet (eg -rescan, etc).\n",
24982498
{
24992499
{"filename", RPCArg::Type::STR, RPCArg::Optional::NO, "The wallet directory or .dat file."},
25002500
{"load_on_startup", RPCArg::Type::BOOL, /* default */ "null", "Save wallet name to persistent settings and load on startup. True to add wallet to startup list, false to remove, null to leave unchanged."},

src/wallet/wallet.cpp

Lines changed: 0 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -3178,25 +3178,6 @@ DBErrors CWallet::ZapSelectTx(std::vector<uint256>& vHashIn, std::vector<uint256
31783178
return DBErrors::LOAD_OK;
31793179
}
31803180

3181-
DBErrors CWallet::ZapWalletTx(std::list<CWalletTx>& vWtx)
3182-
{
3183-
DBErrors nZapWalletTxRet = WalletBatch(*database,"cr+").ZapWalletTx(vWtx);
3184-
if (nZapWalletTxRet == DBErrors::NEED_REWRITE)
3185-
{
3186-
if (database->Rewrite("\x04pool"))
3187-
{
3188-
for (const auto& spk_man_pair : m_spk_managers) {
3189-
spk_man_pair.second->RewriteDB();
3190-
}
3191-
}
3192-
}
3193-
3194-
if (nZapWalletTxRet != DBErrors::LOAD_OK)
3195-
return nZapWalletTxRet;
3196-
3197-
return DBErrors::LOAD_OK;
3198-
}
3199-
32003181
bool CWallet::SetAddressBookWithDB(WalletBatch& batch, const CTxDestination& address, const std::string& strName, const std::string& strPurpose)
32013182
{
32023183
bool fUpdated = false;
@@ -3778,20 +3759,6 @@ std::shared_ptr<CWallet> CWallet::CreateWalletFromFile(interfaces::Chain& chain,
37783759
{
37793760
const std::string walletFile = WalletDataFilePath(location.GetPath()).string();
37803761

3781-
// needed to restore wallet transaction meta data after -zapwallettxes
3782-
std::list<CWalletTx> vWtx;
3783-
3784-
if (gArgs.GetBoolArg("-zapwallettxes", false)) {
3785-
chain.initMessage(_("Zapping all transactions from wallet...").translated);
3786-
3787-
std::unique_ptr<CWallet> tempWallet = MakeUnique<CWallet>(&chain, location, CreateWalletDatabase(location.GetPath()));
3788-
DBErrors nZapWalletRet = tempWallet->ZapWalletTx(vWtx);
3789-
if (nZapWalletRet != DBErrors::LOAD_OK) {
3790-
error = strprintf(_("Error loading %s: Wallet corrupted"), walletFile);
3791-
return nullptr;
3792-
}
3793-
}
3794-
37953762
chain.initMessage(_("Loading wallet...").translated);
37963763

37973764
int64_t nStart = GetTimeMillis();
@@ -4068,30 +4035,6 @@ std::shared_ptr<CWallet> CWallet::CreateWalletFromFile(interfaces::Chain& chain,
40684035
}
40694036
walletInstance->chainStateFlushed(chain.getTipLocator());
40704037
walletInstance->database->IncrementUpdateCounter();
4071-
4072-
// Restore wallet transaction metadata after -zapwallettxes=1
4073-
if (gArgs.GetBoolArg("-zapwallettxes", false) && gArgs.GetArg("-zapwallettxes", "1") != "2")
4074-
{
4075-
WalletBatch batch(*walletInstance->database);
4076-
4077-
for (const CWalletTx& wtxOld : vWtx)
4078-
{
4079-
uint256 hash = wtxOld.GetHash();
4080-
std::map<uint256, CWalletTx>::iterator mi = walletInstance->mapWallet.find(hash);
4081-
if (mi != walletInstance->mapWallet.end())
4082-
{
4083-
const CWalletTx* copyFrom = &wtxOld;
4084-
CWalletTx* copyTo = &mi->second;
4085-
copyTo->mapValue = copyFrom->mapValue;
4086-
copyTo->vOrderForm = copyFrom->vOrderForm;
4087-
copyTo->nTimeReceived = copyFrom->nTimeReceived;
4088-
copyTo->nTimeSmart = copyFrom->nTimeSmart;
4089-
copyTo->fFromMe = copyFrom->fFromMe;
4090-
copyTo->nOrderPos = copyFrom->nOrderPos;
4091-
batch.WriteTx(*copyTo);
4092-
}
4093-
}
4094-
}
40954038
}
40964039

40974040
{

src/wallet/wallet.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1075,7 +1075,6 @@ class CWallet final : public WalletStorage, public interfaces::Chain::Notificati
10751075
void chainStateFlushed(const CBlockLocator& loc) override;
10761076

10771077
DBErrors LoadWallet(bool& fFirstRunRet);
1078-
DBErrors ZapWalletTx(std::list<CWalletTx>& vWtx);
10791078
DBErrors ZapSelectTx(std::vector<uint256>& vHashIn, std::vector<uint256>& vHashOut) EXCLUSIVE_LOCKS_REQUIRED(cs_wallet);
10801079

10811080
bool SetAddressBook(const CTxDestination& address, const std::string& strName, const std::string& purpose);

src/wallet/walletdb.cpp

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -926,23 +926,6 @@ DBErrors WalletBatch::ZapSelectTx(std::vector<uint256>& vTxHashIn, std::vector<u
926926
return DBErrors::LOAD_OK;
927927
}
928928

929-
DBErrors WalletBatch::ZapWalletTx(std::list<CWalletTx>& vWtx)
930-
{
931-
// build list of wallet TXs
932-
std::vector<uint256> vTxHash;
933-
DBErrors err = FindWalletTx(vTxHash, vWtx);
934-
if (err != DBErrors::LOAD_OK)
935-
return err;
936-
937-
// erase each wallet TX
938-
for (const uint256& hash : vTxHash) {
939-
if (!EraseTx(hash))
940-
return DBErrors::CORRUPT;
941-
}
942-
943-
return DBErrors::LOAD_OK;
944-
}
945-
946929
void MaybeCompactWalletDB()
947930
{
948931
static std::atomic<bool> fOneThread(false);

src/wallet/walletdb.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,6 @@ class WalletBatch
257257

258258
DBErrors LoadWallet(CWallet* pwallet);
259259
DBErrors FindWalletTx(std::vector<uint256>& vTxHash, std::list<CWalletTx>& vWtx);
260-
DBErrors ZapWalletTx(std::list<CWalletTx>& vWtx);
261260
DBErrors ZapSelectTx(std::vector<uint256>& vHashIn, std::vector<uint256>& vHashOut);
262261
/* Function to determine if a certain KV/key-type is a key (cryptographical key) type */
263262
static bool IsKeyType(const std::string& strType);

test/functional/test_runner.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,6 @@
105105
'wallet_listtransactions.py',
106106
# vv Tests less than 60s vv
107107
'p2p_sendheaders.py',
108-
'wallet_zapwallettxes.py',
109108
'wallet_importmulti.py',
110109
'mempool_limit.py',
111110
'rpc_txoutproof.py',

test/functional/wallet_basic.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -526,8 +526,6 @@ def run_test(self):
526526
maintenance = [
527527
'-rescan',
528528
'-reindex',
529-
'-zapwallettxes=1',
530-
'-zapwallettxes=2',
531529
]
532530
chainlimit = 6
533531
for m in maintenance:

0 commit comments

Comments
 (0)