mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-10 20:03:34 -03:00
Merge #17138: Remove wallet access to some node arguments
b96ed03962
[wallet] Remove pruning check for -rescan option (John Newbery)eea462de9c
[wallet] Remove package limit config access from wallet (John Newbery) Pull request description: Removes wallet access to `-limitancestorcount`, `-limitdescendantcount` and `-prune`: - `-limitancestorcount` and `-limitdescendantcount` are now accessed with a method `getPackageLimits` in the `Chain` interface. - `-prune` is not required. It was only used in wallet component initiation to prevent running `-rescan` when pruning was enabled. This check is not required. Partially addresses #17137. ACKs for top commit: MarcoFalke: Tested ACKb96ed03962
ryanofsky: Code review ACKb96ed03962
promag: Code review ACKb96ed03962
. ariard: ACKb96ed03
, check there isn't left anymore wallet access to node arguments. Tree-SHA512: 90c8e3e083acbd37724f1bccf63dab642cf9ae95cc5e684872a67443ae048b4fdbf57b52ea47c5a1da6489fd277278fe2d9bbe95e17f3d4965a1a0fbdeb815bf
This commit is contained in:
commit
a3af5b5c13
4 changed files with 15 additions and 5 deletions
|
@ -298,6 +298,11 @@ public:
|
|||
{
|
||||
::mempool.GetTransactionAncestry(txid, ancestors, descendants);
|
||||
}
|
||||
void getPackageLimits(unsigned int& limit_ancestor_count, unsigned int& limit_descendant_count) override
|
||||
{
|
||||
limit_ancestor_count = gArgs.GetArg("-limitancestorcount", DEFAULT_ANCESTOR_LIMIT);
|
||||
limit_descendant_count = gArgs.GetArg("-limitdescendantcount", DEFAULT_DESCENDANT_LIMIT);
|
||||
}
|
||||
bool checkChainLimits(const CTransactionRef& tx) override
|
||||
{
|
||||
LockPoints lp;
|
||||
|
|
|
@ -163,6 +163,11 @@ public:
|
|||
//! Calculate mempool ancestor and descendant counts for the given transaction.
|
||||
virtual void getTransactionAncestry(const uint256& txid, size_t& ancestors, size_t& descendants) = 0;
|
||||
|
||||
//! Get the node's package limits.
|
||||
//! Currently only returns the ancestor and descendant count limits, but could be enhanced to
|
||||
//! return more policy settings.
|
||||
virtual void getPackageLimits(unsigned int& limit_ancestor_count, unsigned int& limit_descendant_count) = 0;
|
||||
|
||||
//! Check if transaction will pass the mempool's chain limits.
|
||||
virtual bool checkChainLimits(const CTransactionRef& tx) = 0;
|
||||
|
||||
|
|
|
@ -122,8 +122,6 @@ bool WalletInit::ParameterInteraction() const
|
|||
|
||||
if (gArgs.GetBoolArg("-sysperms", false))
|
||||
return InitError("-sysperms is not allowed in combination with enabled wallet functionality");
|
||||
if (gArgs.GetArg("-prune", 0) && gArgs.GetBoolArg("-rescan", false))
|
||||
return InitError(_("Rescans are not possible in pruned mode. You will need to use -reindex which will download the whole blockchain again.").translated);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -27,7 +27,6 @@
|
|||
#include <util/rbf.h>
|
||||
#include <util/translation.h>
|
||||
#include <util/validation.h>
|
||||
#include <validation.h>
|
||||
#include <wallet/coincontrol.h>
|
||||
#include <wallet/fees.h>
|
||||
|
||||
|
@ -2739,8 +2738,11 @@ bool CWallet::SelectCoins(const std::vector<COutput>& vAvailableCoins, const CAm
|
|||
}
|
||||
std::vector<OutputGroup> groups = GroupOutputs(vCoins, !coin_control.m_avoid_partial_spends);
|
||||
|
||||
size_t max_ancestors = (size_t)std::max<int64_t>(1, gArgs.GetArg("-limitancestorcount", DEFAULT_ANCESTOR_LIMIT));
|
||||
size_t max_descendants = (size_t)std::max<int64_t>(1, gArgs.GetArg("-limitdescendantcount", DEFAULT_DESCENDANT_LIMIT));
|
||||
unsigned int limit_ancestor_count;
|
||||
unsigned int limit_descendant_count;
|
||||
chain().getPackageLimits(limit_ancestor_count, limit_descendant_count);
|
||||
size_t max_ancestors = (size_t)std::max<int64_t>(1, limit_ancestor_count);
|
||||
size_t max_descendants = (size_t)std::max<int64_t>(1, limit_descendant_count);
|
||||
bool fRejectLongChains = gArgs.GetBoolArg("-walletrejectlongchains", DEFAULT_WALLET_REJECT_LONG_CHAINS);
|
||||
|
||||
bool res = nTargetValue <= nValueFromPresetInputs ||
|
||||
|
|
Loading…
Reference in a new issue