PPCoin: bug fix: malformed coinstake transaction created when balance is 0
authorSunny King <p2pcoin@gmail.com>
Sat, 18 Feb 2012 16:36:06 +0000 (16:36 +0000)
committerSunny King <p2pcoin@gmail.com>
Sat, 18 Feb 2012 16:36:06 +0000 (16:36 +0000)
        introduced with coinstake transaction (71a5b227)

src/wallet.cpp

index 8405d16..52d77ac 100644 (file)
@@ -1073,6 +1073,8 @@ bool CWallet::CreateCoinStake(CScript scriptPubKey, CTransaction& txNew)
         int64 nValueIn = 0;
         if (!SelectCoins(GetBalance(), txNew.nTime, setCoins, nValueIn))
             return false;
+        if (setCoins.empty())
+            return false;
         int64 nCredit = 0;
         BOOST_FOREACH(PAIRTYPE(const CWalletTx*, unsigned int) pcoin, setCoins)
         {