Merge pull request #56 from fsb4000/bad-fix
authorCryptoManiac <CryptoManiac@users.noreply.github.com>
Tue, 18 Nov 2014 21:15:18 +0000 (00:15 +0300)
committerCryptoManiac <CryptoManiac@users.noreply.github.com>
Tue, 18 Nov 2014 21:15:18 +0000 (00:15 +0300)
Bad fix

MSVC/mynovacoinqt/mynovacoinqt.vcxproj
MSVC/mynovacoinqt/mynovacoinqt.vcxproj.filters
src/kernelrecord.cpp
src/qt/mintingtablemodel.cpp
src/wallet.cpp

index 7780327..cd66c30 100644 (file)
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="utf-8"?>
+\feff<?xml version="1.0" encoding="utf-8"?>
 <Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
   <ItemGroup Label="ProjectConfigurations">
     <ProjectConfiguration Include="Debug|Win32">
@@ -286,6 +286,7 @@ C:\MyProjects\Deps\qt-everywhere-opensource-src-5.3.2-64\qtbase\bin\lrelease C:\
     </PreBuildEvent>
   </ItemDefinitionGroup>
   <ItemGroup>
+    <ClCompile Include="..\..\src\kernelrecord.cpp" />
     <ClCompile Include="..\..\src\qt\aboutdialog.cpp" />
     <ClCompile Include="..\..\src\qt\addressbookpage.cpp" />
     <ClCompile Include="..\..\src\qt\addresstablemodel.cpp" />
index e5b1238..04a11fd 100644 (file)
     <ClCompile Include="build\moc_mintingfilterproxy.cpp">
       <Filter>Generated Files</Filter>
     </ClCompile>
+    <ClCompile Include="..\..\src\kernelrecord.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
   </ItemGroup>
   <ItemGroup>
     <CustomBuild Include="..\..\src\qt\aboutdialog.h">
index eb68dd4..8c1d778 100644 (file)
@@ -77,11 +77,14 @@ int64 KernelRecord::getAge() const
 
 double KernelRecord::getProbToMintStake(double difficulty, int timeOffset) const
 {
-    double maxTarget = pow(static_cast<double>(2), 224);
-    double target = maxTarget / difficulty;
-    int dayWeight = (min((GetAdjustedTime() - nTime) + timeOffset, (int64)(nStakeMinAge+nStakeMaxAge)) - nStakeMinAge) / 86400;
-    uint64 coinAge = max(nValue * dayWeight / COIN, (int64)0);
-    return target * coinAge / pow(static_cast<double>(2), 256);
+    //double maxTarget = pow(static_cast<double>(2), 224);
+    //double target = maxTarget / difficulty;
+    //int dayWeight = (min((GetAdjustedTime() - nTime) + timeOffset, (int64)(nStakeMinAge+nStakeMaxAge)) - nStakeMinAge) / 86400;
+    //uint64 coinAge = max(nValue * dayWeight / COIN, (int64)0);
+    //return target * coinAge / pow(static_cast<double>(2), 256);
+    int Weight = (min((GetAdjustedTime() - nTime) + timeOffset, (int64)(nStakeMinAge+nStakeMaxAge)) - nStakeMinAge);
+    uint64 coinAge = max(nValue * Weight / (COIN * 86400), (int64)0);
+    return coinAge / (pow(static_cast<double>(2),32) * difficulty);
 }
 
 double KernelRecord::getProbToMintWithinNMinutes(double difficulty, int minutes)
index a6ab89b..4973480 100644 (file)
@@ -235,7 +235,6 @@ void MintingTableModel::update()
     if(!updated.empty())
     {
         priv->updateWallet(updated);
-        priv->refreshWallet();
     }
 }
 
index 08d269d..23dc013 100644 (file)
@@ -393,6 +393,7 @@ void CWallet::WalletUpdateSpent(const CTransaction &tx, bool fBlock)
                     wtx.MarkSpent(txin.prevout.n);
                     wtx.WriteToDisk();
                     NotifyTransactionChanged(this, txin.prevout.hash, CT_UPDATED);
+                    vMintingWalletUpdated.push_back(txin.prevout.hash);
                 }
             }
         }
@@ -410,6 +411,7 @@ void CWallet::WalletUpdateSpent(const CTransaction &tx, bool fBlock)
                     wtx.MarkUnspent(&txout - &tx.vout[0]);
                     wtx.WriteToDisk();
                     NotifyTransactionChanged(this, hash, CT_UPDATED);
+                    vMintingWalletUpdated.push_back(hash);
                 }
             }
         }
@@ -540,7 +542,7 @@ bool CWallet::AddToWallet(const CWalletTx& wtxIn)
 
         // Notify UI of new or updated transaction
         NotifyTransactionChanged(this, hash, fInsertedNew ? CT_NEW : CT_UPDATED);
-
+        vMintingWalletUpdated.push_back(hash);
         // notify an external script when a wallet transaction comes in or is updated
         std::string strCmd = GetArg("-walletnotify", "");
 
@@ -2116,6 +2118,7 @@ bool CWallet::CommitTransaction(CWalletTx& wtxNew, CReserveKey& reservekey)
                 coin.MarkSpent(txin.prevout.n);
                 coin.WriteToDisk();
                 NotifyTransactionChanged(this, coin.GetHash(), CT_UPDATED);
+                vMintingWalletUpdated.push_back(coin.GetHash());
             }
 
             if (fFileBacked)