From 63071de429b3e0552ddffee72b0c993a7c4ea6a4 Mon Sep 17 00:00:00 2001 From: MASM fan Date: Wed, 12 Feb 2014 00:00:10 +0400 Subject: [PATCH] Add -confchange=0 option. This option cold be used to modify a behavior for IsConfirmed() function. --- src/init.cpp | 4 ++++ src/wallet.cpp | 1 - src/wallet.h | 4 ++++ 3 files changed, 8 insertions(+), 1 deletions(-) diff --git a/src/init.cpp b/src/init.cpp index 4c88efd..66ffda6 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -29,6 +29,7 @@ using namespace boost; CWallet* pwalletMain; CClientUIInterface uiInterface; std::string strWalletFileName; +bool fConfChange; unsigned int nNodeLifespan; unsigned int nDerivationMethodIndex; unsigned int nMinerSleep; @@ -289,6 +290,7 @@ std::string HelpMessage() " -rpcconnect= " + _("Send commands to node running on (default: 127.0.0.1)") + "\n" + " -blocknotify= " + _("Execute command when the best block changes (%s in cmd is replaced by block hash)") + "\n" + " -walletnotify= " + _("Execute command when a wallet transaction changes (%s in cmd is replaced by TxID)") + "\n" + + " -confchange " + _("Require a confirmations for change (default: 0)") + "\n" + " -upgradewallet " + _("Upgrade wallet to latest format") + "\n" + " -keypool= " + _("Set key pool size to (default: 100)") + "\n" + " -rescan " + _("Rescan the block chain for missing wallet transactions") + "\n" + @@ -469,6 +471,8 @@ bool AppInit2() InitWarning(_("Warning: -paytxfee is set very high! This is the transaction fee you will pay if you send a transaction.")); } + fConfChange = GetBoolArg("-confchange", false); + if (mapArgs.count("-mininput")) { if (!ParseMoney(mapArgs["-mininput"], nMinimumInputValue)) diff --git a/src/wallet.cpp b/src/wallet.cpp index 0f00b4d..85262f7 100644 --- a/src/wallet.cpp +++ b/src/wallet.cpp @@ -16,7 +16,6 @@ using namespace std; extern int nStakeMaxAge; - ////////////////////////////////////////////////////////////////////////////// // // mapWallet diff --git a/src/wallet.h b/src/wallet.h index 6f5ff57..f7a05ad 100644 --- a/src/wallet.h +++ b/src/wallet.h @@ -19,6 +19,7 @@ #include "walletdb.h" extern bool fWalletUnlockMintOnly; +extern bool fConfChange; class CAccountingEntry; class CWalletTx; class CReserveKey; @@ -650,6 +651,8 @@ public: return true; if (!IsFromMe()) // using wtx's cached debit return false; + if (fConfChange) + return false; // If no confirmations but it's from us, we can still // consider it confirmed if all dependencies are confirmed @@ -681,6 +684,7 @@ public: vWorkQueue.push_back(mapPrev[txin.prevout.hash]); } } + return true; } -- 1.7.1