Skip to content

Commit

Permalink
[Config] Ignore prune mode if txindex is set
Browse files Browse the repository at this point in the history
  • Loading branch information
CaveSpectre11 committed Nov 23, 2020
1 parent e993b7b commit 5d49651
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/init.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) 2009-2010 Satoshi Nakamoto
// Copyright (c) 2009-2019 The Bitcoin Core developers
// Copyright (c) 2015-2019 The PIVX developers
// Copyright (c) 2018-2019 The Veil developers
// Copyright (c) 2018-2020 The Veil developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.

Expand Down Expand Up @@ -1000,7 +1000,7 @@ bool AppInitParameterInteraction()
// if using block pruning, then disallow txindex
if (gArgs.GetArg("-prune", 0)) {
if (gArgs.GetBoolArg("-txindex", DEFAULT_TXINDEX))
return InitError(_("Prune mode is incompatible with -txindex."));
InitWarning(_("Ignoring Prune Mode: Incompatible with -txindex."));
}

// -bind and -whitebind can't be set when not listening
Expand Down Expand Up @@ -1123,6 +1123,10 @@ bool AppInitParameterInteraction()
if (nPruneArg < 0) {
return InitError(_("Prune cannot be configured with a negative value."));
}
if (nPruneArg && gArgs.GetBoolArg("-txindex", DEFAULT_TXINDEX)) {
// We already warned them that it's getting ignored
nPruneArg = 0;
}
nPruneTarget = (uint64_t) nPruneArg * 1024 * 1024;
if (nPruneArg == 1) { // manual pruning: -prune=1
LogPrintf("Block pruning enabled. Use RPC call pruneblockchain(height) to manually prune block and undo files.\n");
Expand Down

0 comments on commit 5d49651

Please sign in to comment.