]> Git Repo - VerusCoin.git/commitdiff
Sanity checks for estimates
authorGavin Andresen <[email protected]>
Mon, 23 Jun 2014 14:58:59 +0000 (10:58 -0400)
committerGavin Andresen <[email protected]>
Thu, 3 Jul 2014 17:44:56 +0000 (13:44 -0400)
Require at least 11 samples before giving fee/priority estimates.

And have wallet-created transactions go throught the fee-sanity-check
code path.

src/main.cpp
src/main.h
src/txmempool.cpp

index 6be1a29c6cc898ba5a9686aa1b80d5653073b915..d1ddf1600dcb97dc36d71daf58d0f66e602b6025 100644 (file)
@@ -1129,10 +1129,10 @@ int CMerkleTx::GetBlocksToMaturity() const
 }
 
 
-bool CMerkleTx::AcceptToMemoryPool(bool fLimitFree)
+bool CMerkleTx::AcceptToMemoryPool(bool fLimitFree, bool fRejectInsaneFee)
 {
     CValidationState state;
-    return ::AcceptToMemoryPool(mempool, state, *this, fLimitFree, NULL);
+    return ::AcceptToMemoryPool(mempool, state, *this, fLimitFree, NULL, fRejectInsaneFee);
 }
 
 
index e8df17dda00523b76cc63161664902e88c623c66..4c7b7fd8d4cb54d579906a84ad4a0f17951f7f58 100644 (file)
@@ -452,7 +452,7 @@ public:
     int GetDepthInMainChain() const { CBlockIndex *pindexRet; return GetDepthInMainChain(pindexRet); }
     bool IsInMainChain() const { CBlockIndex *pindexRet; return GetDepthInMainChainINTERNAL(pindexRet) > 0; }
     int GetBlocksToMaturity() const;
-    bool AcceptToMemoryPool(bool fLimitFree=true);
+    bool AcceptToMemoryPool(bool fLimitFree=true, bool fRejectInsaneFee=true);
 };
 
 
index 97a426dd355a381c4b6a444f705a7547f3767b0a..0a8ad96aace420e615f352de0d5d9135529887a7 100644 (file)
@@ -251,8 +251,13 @@ public:
             std::sort(sortedFeeSamples.begin(), sortedFeeSamples.end(),
                       std::greater<CFeeRate>());
         }
-        if (sortedFeeSamples.size() == 0)
+        if (sortedFeeSamples.size() < 11)
+        {
+            // Eleven is Gavin's Favorite Number
+            // ... but we also take a maximum of 10 samples per block so eleven means
+            // we're getting samples from at least two different blocks
             return CFeeRate(0);
+        }
 
         int nBucketSize = history.at(nBlocksToConfirm).FeeSamples();
 
@@ -281,7 +286,7 @@ public:
             std::sort(sortedPrioritySamples.begin(), sortedPrioritySamples.end(),
                       std::greater<double>());
         }
-        if (sortedPrioritySamples.size() == 0)
+        if (sortedPrioritySamples.size() < 11)
             return -1.0;
 
         int nBucketSize = history.at(nBlocksToConfirm).PrioritySamples();
This page took 0.04384 seconds and 4 git commands to generate.