Add -confchange=0 option.
authorMASM fan <masmfan@gmail.com>
Tue, 11 Feb 2014 20:00:10 +0000 (00:00 +0400)
committerMASM fan <masmfan@gmail.com>
Tue, 11 Feb 2014 20:00:10 +0000 (00:00 +0400)
This option cold be used to modify a behavior for IsConfirmed() function.

src/init.cpp
src/wallet.cpp
src/wallet.h

index 4c88efd..66ffda6 100644 (file)
@@ -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=<ip>       " + _("Send commands to node running on <ip> (default: 127.0.0.1)") + "\n" +
         "  -blocknotify=<cmd>     " + _("Execute command when the best block changes (%s in cmd is replaced by block hash)") + "\n" +
         "  -walletnotify=<cmd>    " + _("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=<n>           " + _("Set key pool size to <n> (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))
index 0f00b4d..85262f7 100644 (file)
@@ -16,7 +16,6 @@
 using namespace std;
 extern int nStakeMaxAge;
 
-
 //////////////////////////////////////////////////////////////////////////////
 //
 // mapWallet
index 6f5ff57..f7a05ad 100644 (file)
@@ -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;
     }