From d8a8ed49f8cb4f48577466a88e93e5ff5639f054 Mon Sep 17 00:00:00 2001 From: furszy Date: Sat, 19 Sep 2020 19:49:15 -0300 Subject: [PATCH 1/3] Wallet:AvailableCoins include delegated and coldStaking flags inside coinControl. --- src/coincontrol.h | 7 +++++++ src/qt/walletmodel.cpp | 12 ++++++++++-- src/rpc/masternode.cpp | 7 +++++-- src/wallet/rpcwallet.cpp | 2 -- src/wallet/wallet.cpp | 33 +++++++++++++++++++-------------- src/wallet/wallet.h | 2 -- 6 files changed, 41 insertions(+), 22 deletions(-) diff --git a/src/coincontrol.h b/src/coincontrol.h index 4a72a4fa8aef..c455e105883a 100644 --- a/src/coincontrol.h +++ b/src/coincontrol.h @@ -28,6 +28,11 @@ class CCoinControl bool fOverrideFeeRate; //! Feerate to use if overrideFeeRate is true CFeeRate nFeeRate; + //! Flag to decide whether delegations utxo are included in the calculation or not. + bool fIncludeDelegated{true}; + //! Flag to decide whether cold staking utxo are included in the calculation or not + //! (always false in spending process for obvious reasons). + bool fIncludeColdStaking{false}; CCoinControl() { @@ -46,6 +51,8 @@ class CCoinControl fOverrideFeeRate = false; fSplitBlock = false; nSplitBlock = 1; + fIncludeDelegated = true; + fIncludeColdStaking = false; } bool HasSelected() const diff --git a/src/qt/walletmodel.cpp b/src/qt/walletmodel.cpp index 147b1270681a..68a4c16ec324 100644 --- a/src/qt/walletmodel.cpp +++ b/src/qt/walletmodel.cpp @@ -7,6 +7,7 @@ #include "walletmodel.h" #include "addresstablemodel.h" +#include "coincontrol.h" #include "guiconstants.h" #include "optionsmodel.h" #include "recentrequeststablemodel.h" @@ -99,7 +100,12 @@ CAmount WalletModel::getBalance(const CCoinControl* coinControl, bool fIncludeDe if (coinControl) { CAmount nBalance = 0; std::vector vCoins; - wallet->AvailableCoins(&vCoins, coinControl, fIncludeDelegated); + + // Refactor me.. + CCoinControl _coinControl = *coinControl; + _coinControl.fIncludeDelegated = fIncludeDelegated; + + wallet->AvailableCoins(&vCoins, &_coinControl); for (const COutput& out : vCoins) { bool fSkip = fUnlockedOnly && isLockedCoin(out.tx->GetHash(), out.i); if (out.fSpendable && !fSkip) @@ -851,7 +857,9 @@ void WalletModel::getOutputs(const std::vector& vOutpoints, std::vect bool WalletModel::getMNCollateralCandidate(COutPoint& outPoint) { std::vector vCoins; - wallet->AvailableCoins(&vCoins, nullptr, false, false, ONLY_10000); + CCoinControl coinControl; + coinControl.fIncludeDelegated = false; + wallet->AvailableCoins(&vCoins, &coinControl, ONLY_10000); for (const COutput& out : vCoins) { // skip locked collaterals if (!isLockedCoin(out.tx->GetHash(), out.i)) { diff --git a/src/rpc/masternode.cpp b/src/rpc/masternode.cpp index 31ad2469b940..ec1ee334e28a 100644 --- a/src/rpc/masternode.cpp +++ b/src/rpc/masternode.cpp @@ -1,9 +1,10 @@ // Copyright (c) 2009-2012 The Bitcoin developers // Copyright (c) 2015-2020 The PIVX developers // Distributed under the MIT/X11 software license, see the accompanying -// file COPYING or http://www.opensource.org/licenses/mit-license.php. +// file COPYING or https://www.opensource.org/licenses/mit-license.php. #include "activemasternode.h" +#include "coincontrol.h" #include "db.h" #include "init.h" #include "main.h" @@ -401,7 +402,9 @@ UniValue getmasternodeoutputs (const JSONRPCRequest& request) // Find possible candidates std::vector possibleCoins; - pwalletMain->AvailableCoins(&possibleCoins, nullptr, false, false, ONLY_10000); + CCoinControl coinControl; + coinControl.fIncludeDelegated = false; + pwalletMain->AvailableCoins(&possibleCoins, &coinControl, ONLY_10000); UniValue ret(UniValue::VARR); for (COutput& out : possibleCoins) { diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index f0505388f4ed..aac4224f48bc 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -3201,8 +3201,6 @@ UniValue listunspent(const JSONRPCRequest& request) LOCK2(cs_main, pwalletMain->cs_wallet); pwalletMain->AvailableCoins(&vecOutputs, &coinControl, // coin control - true, // include delegated - false, // include cold staking ALL_COINS, // coin type false, // only confirmed false // use IX diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index a5c304f60558..f3f7ea8c39d2 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -2006,8 +2006,6 @@ bool CWallet::GetMasternodeVinAndKeys(CTxIn& txinRet, CPubKey& pubKeyRet, CKey& */ bool CWallet::AvailableCoins(std::vector* pCoins, // --> populates when != nullptr const CCoinControl* coinControl, // Default: nullptr - bool fIncludeDelegated, // Default: true - bool fIncludeColdStaking, // Default: false AvailableCoinsType nCoinType, // Default: ALL_COINS bool fOnlyConfirmed, // Default: true bool fUseIX // Default: false @@ -2016,7 +2014,8 @@ bool CWallet::AvailableCoins(std::vector* pCoins, // --> populates if (pCoins) pCoins->clear(); const bool fCoinsSelected = (coinControl != nullptr) && coinControl->HasSelected(); // include delegated coins when coinControl is active - if (!fIncludeDelegated && fCoinsSelected) + bool fIncludeDelegated = true; + if (coinControl && !coinControl->fIncludeDelegated && fCoinsSelected) fIncludeDelegated = true; { @@ -2063,7 +2062,7 @@ bool CWallet::AvailableCoins(std::vector* pCoins, // --> populates // --Skip P2CS outputs // skip cold coins - if (mine == ISMINE_COLD && (!fIncludeColdStaking || !HasDelegator(pcoin->vout[i]))) continue; + if (mine == ISMINE_COLD && ((coinControl && !coinControl->fIncludeColdStaking) || !HasDelegator(pcoin->vout[i]))) continue; // skip delegated coins if (mine == ISMINE_SPENDABLE_DELEGATED && !fIncludeDelegated) continue; @@ -2071,7 +2070,7 @@ bool CWallet::AvailableCoins(std::vector* pCoins, // --> populates bool spendable = ((mine & ISMINE_SPENDABLE) != ISMINE_NO) || (((mine & ISMINE_WATCH_ONLY) != ISMINE_NO) && (coinControl && coinControl->fAllowWatchOnly && solvable)) || - ((mine & ((fIncludeColdStaking ? ISMINE_COLD : ISMINE_NO) | + ((mine & (coinControl && (coinControl->fIncludeColdStaking ? ISMINE_COLD : ISMINE_NO) | (fIncludeDelegated ? ISMINE_SPENDABLE_DELEGATED : ISMINE_NO) )) != ISMINE_NO); // found valid coin @@ -2087,10 +2086,10 @@ std::map > CWallet::AvailableCoinsByAddres { std::vector vCoins; // include cold + CCoinControl coinControl; + coinControl.fIncludeColdStaking = true; AvailableCoins(&vCoins, - nullptr, // coin control - true, // fIncludeDelegated - true, // fIncludeColdStaking + &coinControl, // coin control ALL_COINS, // coin type fConfirmed); // only confirmed @@ -2160,10 +2159,11 @@ bool CWallet::StakeableCoins(std::vector* pCoins) const bool fIncludeCold = (sporkManager.IsSporkActive(SPORK_17_COLDSTAKING_ENFORCEMENT) && GetBoolArg("-coldstaking", DEFAULT_COLDSTAKING)); + CCoinControl coinControl; + coinControl.fIncludeDelegated = false; + coinControl.fIncludeColdStaking = fIncludeCold; return AvailableCoins(pCoins, - nullptr, // coin control - false, // fIncludeDelegated - fIncludeCold, // fIncludeColdStaking + &coinControl, // coin control STAKEABLE_COINS); // coin type } @@ -2415,10 +2415,15 @@ bool CWallet::CreateTransaction(const std::vector& vecSend, LOCK2(cs_main, cs_wallet); { std::vector vAvailableCoins; + + // Refactor me.. + CCoinControl _coinControl; + if (coinControl) { + _coinControl = *coinControl; + } + _coinControl.fIncludeDelegated = fIncludeDelegated; AvailableCoins(&vAvailableCoins, - coinControl, - fIncludeDelegated, - false, // fIncludeColdStaking + &_coinControl, coin_type, true, // fOnlyConfirmed useIX); diff --git a/src/wallet/wallet.h b/src/wallet/wallet.h index ce8e177f0a42..408b1c4a66d8 100644 --- a/src/wallet/wallet.h +++ b/src/wallet/wallet.h @@ -386,8 +386,6 @@ class CWallet : public CCryptoKeyStore, public CValidationInterface //! >> Available coins (generic) bool AvailableCoins(std::vector* pCoins, // --> populates when != nullptr const CCoinControl* coinControl = nullptr, - bool fIncludeDelegated = true, - bool fIncludeColdStaking = false, AvailableCoinsType nCoinType = ALL_COINS, bool fOnlyConfirmed = true, bool fUseIX = false From dc32f54b21d66ef69a39d3fe41ba5e41aa9d0dd8 Mon Sep 17 00:00:00 2001 From: furszy Date: Sat, 19 Sep 2020 20:59:31 -0300 Subject: [PATCH 2/3] Wallet:AvailableCoins remove unused useIX flag --- src/qt/walletmodel.cpp | 1 - src/wallet/rpcwallet.cpp | 5 ++--- src/wallet/wallet.cpp | 25 +++++++------------------ src/wallet/wallet.h | 6 ++---- 4 files changed, 11 insertions(+), 26 deletions(-) diff --git a/src/qt/walletmodel.cpp b/src/qt/walletmodel.cpp index 68a4c16ec324..f3dd49326965 100644 --- a/src/qt/walletmodel.cpp +++ b/src/qt/walletmodel.cpp @@ -418,7 +418,6 @@ WalletModel::SendCoinsReturn WalletModel::prepareTransaction(WalletModelTransact coinControl, recipients[0].inputType, true, - recipients[0].useSwiftTX, 0, fIncludeDelegations); transaction.setTransactionFee(nFeeRequired); diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index aac4224f48bc..753beb78dffd 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -1097,7 +1097,7 @@ UniValue CreateColdStakeDelegation(const UniValue& params, CWalletTx& wtxNew, CR // Create the transaction CAmount nFeeRequired; - if (!pwalletMain->CreateTransaction(scriptPubKey, nValue, wtxNew, reservekey, nFeeRequired, strError, nullptr, ALL_COINS, /*fUseIX*/ false, (CAmount)0, fUseDelegated)) { + if (!pwalletMain->CreateTransaction(scriptPubKey, nValue, wtxNew, reservekey, nFeeRequired, strError, nullptr, ALL_COINS, (CAmount)0, fUseDelegated)) { if (nValue + nFeeRequired > currBalance) strError = strprintf("Error: This transaction requires a transaction fee of at least %s because of its amount, complexity, or use of recently received funds!", FormatMoney(nFeeRequired)); LogPrintf("%s : %s\n", __func__, strError); @@ -3202,8 +3202,7 @@ UniValue listunspent(const JSONRPCRequest& request) pwalletMain->AvailableCoins(&vecOutputs, &coinControl, // coin control ALL_COINS, // coin type - false, // only confirmed - false // use IX + false // only confirmed ); for (const COutput& out : vecOutputs) { if (out.nDepth < nMinDepth || out.nDepth > nMaxDepth) diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index f3f7ea8c39d2..e3804b5f9ad5 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -1910,15 +1910,13 @@ void CWallet::GetAvailableP2CSCoins(std::vector& vCoins) const { /** * Test if the transaction is spendable. */ -bool CheckTXAvailability(const CWalletTx* pcoin, bool fOnlyConfirmed, bool fUseIX, int& nDepth) +bool CheckTXAvailability(const CWalletTx* pcoin, bool fOnlyConfirmed, int& nDepth) { if (!CheckFinalTx(*pcoin)) return false; if (fOnlyConfirmed && !pcoin->IsTrusted()) return false; if (pcoin->GetBlocksToMaturity() > 0) return false; nDepth = pcoin->GetDepthInMainChain(false); - // do not use IX for inputs that have less then 6 blockchain confirmations - if (fUseIX && nDepth < 6) return false; // We should not consider coins which aren't at least in our mempool // It's possible for these to be conflicted via ancestors which we may never be able to detect @@ -1971,7 +1969,7 @@ bool CWallet::GetMasternodeVinAndKeys(CTxIn& txinRet, CPubKey& pubKeyRet, CKey& // Check availability int nDepth = 0; - if (!CheckTXAvailability(&wtx, true, false, nDepth)) { + if (!CheckTXAvailability(&wtx, true, nDepth)) { strError = "Not available collateral transaction"; return error("%s: tx %s not available", __func__, strTxHash); } @@ -2007,8 +2005,7 @@ bool CWallet::GetMasternodeVinAndKeys(CTxIn& txinRet, CPubKey& pubKeyRet, CKey& bool CWallet::AvailableCoins(std::vector* pCoins, // --> populates when != nullptr const CCoinControl* coinControl, // Default: nullptr AvailableCoinsType nCoinType, // Default: ALL_COINS - bool fOnlyConfirmed, // Default: true - bool fUseIX // Default: false + bool fOnlyConfirmed // Default: true ) const { if (pCoins) pCoins->clear(); @@ -2026,7 +2023,7 @@ bool CWallet::AvailableCoins(std::vector* pCoins, // --> populates // Check if the tx is selectable int nDepth; - if (!CheckTXAvailability(pcoin, fOnlyConfirmed, fUseIX, nDepth)) + if (!CheckTXAvailability(pcoin, fOnlyConfirmed, nDepth)) continue; // Check min depth requirement for stake inputs @@ -2385,12 +2382,9 @@ bool CWallet::CreateTransaction(const std::vector& vecSend, const CCoinControl* coinControl, AvailableCoinsType coin_type, bool sign, - bool useIX, CAmount nFeePay, bool fIncludeDelegated) { - if (useIX && nFeePay < CENT) nFeePay = CENT; - CAmount nValue = 0; int nChangePosRequest = nChangePosInOut; @@ -2425,8 +2419,7 @@ bool CWallet::CreateTransaction(const std::vector& vecSend, AvailableCoins(&vAvailableCoins, &_coinControl, coin_type, - true, // fOnlyConfirmed - useIX); + true); // fOnlyConfirmed nFeeRet = 0; if (nFeePay > 0) nFeeRet = nFeePay; @@ -2478,10 +2471,6 @@ bool CWallet::CreateTransaction(const std::vector& vecSend, strFailReason = _("Insufficient funds."); } - if (useIX) { - strFailReason += " " + _("SwiftX requires inputs with at least 6 confirmations, you might need to wait a few minutes and try again."); - } - return false; } @@ -2663,12 +2652,12 @@ bool CWallet::CreateTransaction(const std::vector& vecSend, return true; } -bool CWallet::CreateTransaction(CScript scriptPubKey, const CAmount& nValue, CWalletTx& wtxNew, CReserveKey& reservekey, CAmount& nFeeRet, std::string& strFailReason, const CCoinControl* coinControl, AvailableCoinsType coin_type, bool useIX, CAmount nFeePay, bool fIncludeDelegated) +bool CWallet::CreateTransaction(CScript scriptPubKey, const CAmount& nValue, CWalletTx& wtxNew, CReserveKey& reservekey, CAmount& nFeeRet, std::string& strFailReason, const CCoinControl* coinControl, AvailableCoinsType coin_type, CAmount nFeePay, bool fIncludeDelegated) { std::vector vecSend; vecSend.emplace_back(scriptPubKey, nValue, false); int nChangePosInOut = -1; - return CreateTransaction(vecSend, wtxNew, reservekey, nFeeRet, nChangePosInOut, strFailReason, coinControl, coin_type, true, useIX, nFeePay, fIncludeDelegated); + return CreateTransaction(vecSend, wtxNew, reservekey, nFeeRet, nChangePosInOut, strFailReason, coinControl, coin_type, true, nFeePay, fIncludeDelegated); } bool CWallet::CreateCoinStake( diff --git a/src/wallet/wallet.h b/src/wallet/wallet.h index 408b1c4a66d8..ddb894674411 100644 --- a/src/wallet/wallet.h +++ b/src/wallet/wallet.h @@ -387,8 +387,7 @@ class CWallet : public CCryptoKeyStore, public CValidationInterface bool AvailableCoins(std::vector* pCoins, // --> populates when != nullptr const CCoinControl* coinControl = nullptr, AvailableCoinsType nCoinType = ALL_COINS, - bool fOnlyConfirmed = true, - bool fUseIX = false + bool fOnlyConfirmed = true ) const; //! >> Available coins (spending) bool SelectCoinsToSpend(const std::vector& vAvailableCoins, const CAmount& nTargetValue, std::set >& setCoinsRet, CAmount& nValueRet, const CCoinControl* coinControl = nullptr) const; @@ -548,10 +547,9 @@ class CWallet : public CCryptoKeyStore, public CValidationInterface const CCoinControl* coinControl = NULL, AvailableCoinsType coin_type = ALL_COINS, bool sign = true, - bool useIX = false, CAmount nFeePay = 0, bool fIncludeDelegated = false); - bool CreateTransaction(CScript scriptPubKey, const CAmount& nValue, CWalletTx& wtxNew, CReserveKey& reservekey, CAmount& nFeeRet, std::string& strFailReason, const CCoinControl* coinControl = NULL, AvailableCoinsType coin_type = ALL_COINS, bool useIX = false, CAmount nFeePay = 0, bool fIncludeDelegated = false); + bool CreateTransaction(CScript scriptPubKey, const CAmount& nValue, CWalletTx& wtxNew, CReserveKey& reservekey, CAmount& nFeeRet, std::string& strFailReason, const CCoinControl* coinControl = NULL, AvailableCoinsType coin_type = ALL_COINS, CAmount nFeePay = 0, bool fIncludeDelegated = false); // enumeration for CommitResult (return status of CommitTransaction) enum CommitStatus From c712a469c261916696da57b3dcaf0442748b063b Mon Sep 17 00:00:00 2001 From: furszy Date: Sat, 19 Sep 2020 21:14:56 -0300 Subject: [PATCH 3/3] Include fOnlyTrusted in CoinControl, removing field from AvailableCoins method signature. --- src/coincontrol.h | 3 +++ src/wallet/rpcwallet.cpp | 6 +++--- src/wallet/wallet.cpp | 14 +++++++------- src/wallet/wallet.h | 4 +--- 4 files changed, 14 insertions(+), 13 deletions(-) diff --git a/src/coincontrol.h b/src/coincontrol.h index c455e105883a..08907caadd85 100644 --- a/src/coincontrol.h +++ b/src/coincontrol.h @@ -33,6 +33,8 @@ class CCoinControl //! Flag to decide whether cold staking utxo are included in the calculation or not //! (always false in spending process for obvious reasons). bool fIncludeColdStaking{false}; + //! Whether should only select trusted coins. + bool fOnlyTrusted{true}; CCoinControl() { @@ -53,6 +55,7 @@ class CCoinControl nSplitBlock = 1; fIncludeDelegated = true; fIncludeColdStaking = false; + fOnlyTrusted = true; } bool HasSelected() const diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index 753beb78dffd..be52ba7c4668 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -3194,6 +3194,7 @@ UniValue listunspent(const JSONRPCRequest& request) CCoinControl coinControl; coinControl.fAllowWatchOnly = nWatchonlyConfig == 2; + coinControl.fOnlyTrusted = false; UniValue results(UniValue::VARR); std::vector vecOutputs; @@ -3201,9 +3202,8 @@ UniValue listunspent(const JSONRPCRequest& request) LOCK2(cs_main, pwalletMain->cs_wallet); pwalletMain->AvailableCoins(&vecOutputs, &coinControl, // coin control - ALL_COINS, // coin type - false // only confirmed - ); + ALL_COINS); // coin type + for (const COutput& out : vecOutputs) { if (out.nDepth < nMinDepth || out.nDepth > nMaxDepth) continue; diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index e3804b5f9ad5..b6c20fe36ffe 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -2004,8 +2004,7 @@ bool CWallet::GetMasternodeVinAndKeys(CTxIn& txinRet, CPubKey& pubKeyRet, CKey& */ bool CWallet::AvailableCoins(std::vector* pCoins, // --> populates when != nullptr const CCoinControl* coinControl, // Default: nullptr - AvailableCoinsType nCoinType, // Default: ALL_COINS - bool fOnlyConfirmed // Default: true + AvailableCoinsType nCoinType // Default: ALL_COINS ) const { if (pCoins) pCoins->clear(); @@ -2015,6 +2014,7 @@ bool CWallet::AvailableCoins(std::vector* pCoins, // --> populates if (coinControl && !coinControl->fIncludeDelegated && fCoinsSelected) fIncludeDelegated = true; + bool fOnlyTrusted = (coinControl && coinControl->fOnlyTrusted) || !coinControl; { LOCK2(cs_main, cs_wallet); for (std::map::const_iterator it = mapWallet.begin(); it != mapWallet.end(); ++it) { @@ -2023,7 +2023,7 @@ bool CWallet::AvailableCoins(std::vector* pCoins, // --> populates // Check if the tx is selectable int nDepth; - if (!CheckTXAvailability(pcoin, fOnlyConfirmed, nDepth)) + if (!CheckTXAvailability(pcoin, fOnlyTrusted, nDepth)) continue; // Check min depth requirement for stake inputs @@ -2085,10 +2085,10 @@ std::map > CWallet::AvailableCoinsByAddres // include cold CCoinControl coinControl; coinControl.fIncludeColdStaking = true; + coinControl.fOnlyTrusted = fConfirmed; AvailableCoins(&vCoins, &coinControl, // coin control - ALL_COINS, // coin type - fConfirmed); // only confirmed + ALL_COINS); // coin type std::map > mapCoins; for (COutput& out : vCoins) { @@ -2416,10 +2416,10 @@ bool CWallet::CreateTransaction(const std::vector& vecSend, _coinControl = *coinControl; } _coinControl.fIncludeDelegated = fIncludeDelegated; + _coinControl.fOnlyTrusted = true; AvailableCoins(&vAvailableCoins, &_coinControl, - coin_type, - true); // fOnlyConfirmed + coin_type); nFeeRet = 0; if (nFeePay > 0) nFeeRet = nFeePay; diff --git a/src/wallet/wallet.h b/src/wallet/wallet.h index ddb894674411..56ffaebdf834 100644 --- a/src/wallet/wallet.h +++ b/src/wallet/wallet.h @@ -386,9 +386,7 @@ class CWallet : public CCryptoKeyStore, public CValidationInterface //! >> Available coins (generic) bool AvailableCoins(std::vector* pCoins, // --> populates when != nullptr const CCoinControl* coinControl = nullptr, - AvailableCoinsType nCoinType = ALL_COINS, - bool fOnlyConfirmed = true - ) const; + AvailableCoinsType nCoinType = ALL_COINS) const; //! >> Available coins (spending) bool SelectCoinsToSpend(const std::vector& vAvailableCoins, const CAmount& nTargetValue, std::set >& setCoinsRet, CAmount& nValueRet, const CCoinControl* coinControl = nullptr) const; bool SelectCoinsMinConf(const CAmount& nTargetValue, int nConfMine, int nConfTheirs, std::vector vCoins, std::set >& setCoinsRet, CAmount& nValueRet) const;