mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-06-07 13:18:43 +02:00
Move some static functions out of wallet.h/cpp
This commit just moves a few function declarations and updates callers. Function bodies are moved in two followup MOVEONLY commits. This change is desirable because wallet.h/cpp are monolithic and hard to navigate, so pulling things out and grouping together pieces of related functionality should improve the organization. Another proximate motivation is the wallet process separation work in https://github.com/bitcoin/bitcoin/pull/10973, where (at least initially) parameter parsing and fee estimation are still done in the main process rather than the wallet process, and having functions that run in different processes scrambled up throughout wallet.cpp is unnecessarily confusing.
This commit is contained in:
@@ -30,6 +30,7 @@
|
||||
#include "util.h"
|
||||
#include "ui_interface.h"
|
||||
#include "utilmoneystr.h"
|
||||
#include "wallet/fees.h"
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
@@ -494,7 +495,7 @@ void CWallet::Flush(bool shutdown)
|
||||
dbw->Flush(shutdown);
|
||||
}
|
||||
|
||||
bool CWallet::Verify()
|
||||
bool WalletVerify()
|
||||
{
|
||||
if (gArgs.GetBoolArg("-disablewallet", DEFAULT_DISABLE_WALLET))
|
||||
return true;
|
||||
@@ -2599,7 +2600,7 @@ bool CWallet::FundTransaction(CMutableTransaction& tx, CAmount& nFeeRet, int& nC
|
||||
return true;
|
||||
}
|
||||
|
||||
static CFeeRate GetDiscardRate(const CBlockPolicyEstimator& estimator)
|
||||
CFeeRate GetDiscardRate(const CBlockPolicyEstimator& estimator)
|
||||
{
|
||||
unsigned int highest_target = estimator.HighestTargetTracked(FeeEstimateHorizon::LONG_HALFLIFE);
|
||||
CFeeRate discard_rate = estimator.estimateSmartFee(highest_target, nullptr /* FeeCalculation */, false /* conservative */);
|
||||
@@ -3031,12 +3032,12 @@ bool CWallet::AddAccountingEntry(const CAccountingEntry& acentry, CWalletDB *pwa
|
||||
return true;
|
||||
}
|
||||
|
||||
CAmount CWallet::GetRequiredFee(unsigned int nTxBytes)
|
||||
CAmount GetRequiredFee(unsigned int nTxBytes)
|
||||
{
|
||||
return std::max(minTxFee.GetFee(nTxBytes), ::minRelayTxFee.GetFee(nTxBytes));
|
||||
return std::max(CWallet::minTxFee.GetFee(nTxBytes), ::minRelayTxFee.GetFee(nTxBytes));
|
||||
}
|
||||
|
||||
CAmount CWallet::GetMinimumFee(unsigned int nTxBytes, const CCoinControl& coin_control, const CTxMemPool& pool, const CBlockPolicyEstimator& estimator, FeeCalculation *feeCalc)
|
||||
CAmount GetMinimumFee(unsigned int nTxBytes, const CCoinControl& coin_control, const CTxMemPool& pool, const CBlockPolicyEstimator& estimator, FeeCalculation *feeCalc)
|
||||
{
|
||||
/* User control of how to calculate fee uses the following parameter precedence:
|
||||
1. coin_control.m_feerate
|
||||
@@ -3068,7 +3069,7 @@ CAmount CWallet::GetMinimumFee(unsigned int nTxBytes, const CCoinControl& coin_c
|
||||
fee_needed = estimator.estimateSmartFee(target, feeCalc, conservative_estimate).GetFee(nTxBytes);
|
||||
if (fee_needed == 0) {
|
||||
// if we don't have enough data for estimateSmartFee, then use fallbackFee
|
||||
fee_needed = fallbackFee.GetFee(nTxBytes);
|
||||
fee_needed = CWallet::fallbackFee.GetFee(nTxBytes);
|
||||
if (feeCalc) feeCalc->reason = FeeReason::FALLBACK;
|
||||
}
|
||||
// Obey mempool min fee when using smart fee estimation
|
||||
@@ -3888,7 +3889,7 @@ std::vector<std::string> CWallet::GetDestValues(const std::string& prefix) const
|
||||
return values;
|
||||
}
|
||||
|
||||
std::string CWallet::GetWalletHelpString(bool showDebug)
|
||||
std::string GetWalletHelpString(bool showDebug)
|
||||
{
|
||||
std::string strUsage = HelpMessageGroup(_("Wallet options:"));
|
||||
strUsage += HelpMessageOpt("-disablewallet", _("Do not load the wallet and disable wallet RPC calls"));
|
||||
@@ -4121,7 +4122,7 @@ CWallet* CWallet::CreateWalletFromFile(const std::string walletFile)
|
||||
return walletInstance;
|
||||
}
|
||||
|
||||
bool CWallet::InitLoadWallet()
|
||||
bool InitLoadWallet()
|
||||
{
|
||||
if (gArgs.GetBoolArg("-disablewallet", DEFAULT_DISABLE_WALLET)) {
|
||||
LogPrintf("Wallet disabled!\n");
|
||||
@@ -4129,7 +4130,7 @@ bool CWallet::InitLoadWallet()
|
||||
}
|
||||
|
||||
for (const std::string& walletFile : gArgs.GetArgs("-wallet")) {
|
||||
CWallet * const pwallet = CreateWalletFromFile(walletFile);
|
||||
CWallet * const pwallet = CWallet::CreateWalletFromFile(walletFile);
|
||||
if (!pwallet) {
|
||||
return false;
|
||||
}
|
||||
@@ -4153,7 +4154,7 @@ void CWallet::postInitProcess(CScheduler& scheduler)
|
||||
}
|
||||
}
|
||||
|
||||
bool CWallet::ParameterInteraction()
|
||||
bool WalletParameterInteraction()
|
||||
{
|
||||
gArgs.SoftSetArg("-wallet", DEFAULT_WALLET_DAT);
|
||||
const bool is_multiwallet = gArgs.GetArgs("-wallet").size() > 1;
|
||||
|
||||
Reference in New Issue
Block a user