diff --git a/src/init.cpp b/src/init.cpp index 0e2113e..4d63ba1 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -469,6 +469,18 @@ bool AppInit2(int argc, char* argv[]) } } + { + vector vaddr; + if (Lookup("relay.eligius.st", vaddr, NODE_NETWORK, -1, true)) + { + BOOST_FOREACH (CAddress& addr, vaddr) + { + addr.nTime = 0; + AddAddress(addr); + } + } + } + if (mapArgs.count("-dnsseed")) DNSAddressSeed(); diff --git a/src/main.cpp b/src/main.cpp index 0456041..15e026b 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -730,14 +730,17 @@ bool CTransaction::AcceptToMemoryPool(CTxDB& txdb, bool fCheckInputs, bool* pfMi return error("AcceptToMemoryPool() : ConnectInputs failed %s", hash.ToString().substr(0,10).c_str()); } + if (!IsFromMe()) + { + // Don't accept it if it can't get into a block - if (nFees < GetMinFee(1000, true, true)) + if (nFees < GetMinFee(1000, true, 0)) return error("AcceptToMemoryPool() : not enough fees"); // Continuously rate-limit free transactions // This mitigates 'penny-flooding' -- sending thousands of free transactions just to // be annoying or make other's transactions take longer to confirm. - if (nFees < MIN_RELAY_TX_FEE) + if (nFees < GetMinFee(1000, false, 0)) { static CCriticalSection cs; static double dFreeCount; @@ -758,6 +761,8 @@ bool CTransaction::AcceptToMemoryPool(CTxDB& txdb, bool fCheckInputs, bool* pfMi dFreeCount += nSize; } } + + } } // Store transaction in memory @@ -3329,7 +3334,7 @@ CBlock* CreateNewBlock(CReserveKey& reservekey) // Transaction fee required depends on block size bool fAllowFree = (nBlockSize + nTxSize < 4000 || CTransaction::AllowFree(dPriority)); - int64 nMinFee = tx.GetMinFee(nBlockSize, fAllowFree, true); + int64 nMinFee = tx.GetMinFee(nBlockSize, fAllowFree, 2); // Connecting shouldn't fail due to dependency on other memory pool transactions // because we're already processing them in order of dependency @@ -3911,7 +3916,7 @@ bool CreateTransaction(const vector >& vecSend, CWalletTx& // Check that enough fee is included int64 nPayFee = nTransactionFee * (1 + (int64)nBytes / 1000); bool fAllowFree = CTransaction::AllowFree(dPriority); - int64 nMinFee = wtxNew.GetMinFee(1, fAllowFree); + int64 nMinFee = wtxNew.GetMinFee(1, fAllowFree, 1); if (nFeeRet < max(nPayFee, nMinFee)) { nFeeRet = max(nPayFee, nMinFee); diff --git a/src/main.h b/src/main.h index 436ffbe..733b31e 100644 --- a/src/main.h +++ b/src/main.h @@ -599,37 +599,42 @@ public: return dPriority > COIN * 144 / 250; } - int64 GetMinFee(unsigned int nBlockSize=1, bool fAllowFree=true, bool fForRelay=false) const + int64 GetMinFee(unsigned int nBlockSize=1, bool fAllowFree=true, int nMode=-1) const { - // Base fee is either MIN_TX_FEE or MIN_RELAY_TX_FEE - int64 nBaseFee = fForRelay ? MIN_RELAY_TX_FEE : MIN_TX_FEE; + // nMode: 0=relay; 1=sending; 2=putting in block unsigned int nBytes = ::GetSerializeSize(*this, SER_NETWORK); unsigned int nNewBlockSize = nBlockSize + nBytes; - int64 nMinFee = (1 + (int64)nBytes / 1000) * nBaseFee; + + // Base fee is 0.00004096 BTC per 512 bytes + bool fTinyOutput = false; + bool fTonalOutput = false; + int64 nMinFee = (1 + (int64)nBytes / 0x200) * 0x10000; - if (fAllowFree) - { - if (nBlockSize == 1) + BOOST_FOREACH(const CTxOut& txout, vout) { - // Transactions under 10K are free - // (about 4500bc if made of 50bc inputs) - if (nBytes < 10000) - nMinFee = 0; + if (txout.nValue < 0x100) + { + fTinyOutput = true; + break; + } + if (0 == txout.nValue % 0x10000) + fTonalOutput = true; } + + // Charge extra for ridiculously tiny outputs + if (fTinyOutput) + nMinFee *= 0x10; else + // Waive the fee in a tonal-sized "free tranaction area" if at least one output is TBC (and under 512 bytes) ;) + if (fTonalOutput && nNewBlockSize < 0x8000 && nBytes < 0x200) + nMinFee = 0; + else + if (fAllowFree) { - // Free transaction area - if (nNewBlockSize < 27000) - nMinFee = 0; + // Give a discount to the first so many tx + nMinFee /= 0x10; } - } - - // To limit dust spam, require MIN_TX_FEE/MIN_RELAY_TX_FEE if any output is less than 0.01 - if (nMinFee < nBaseFee) - BOOST_FOREACH(const CTxOut& txout, vout) - if (txout.nValue < CENT) - nMinFee = nBaseFee; // Raise the price as the block approaches full if (nBlockSize != 1 && nNewBlockSize >= MAX_BLOCK_SIZE_GEN/2) diff --git a/src/ui.cpp b/src/ui.cpp index cca473d..efd83cd 100644 --- a/src/ui.cpp +++ b/src/ui.cpp @@ -205,7 +205,7 @@ int ThreadSafeMessageBox(const string& message, const string& caption, int style bool ThreadSafeAskFee(int64 nFeeRequired, const string& strCaption, wxWindow* parent) { - if (nFeeRequired < MIN_TX_FEE || nFeeRequired <= nTransactionFee || fDaemon) + if (nFeeRequired == 0 || nFeeRequired <= nTransactionFee || fDaemon) return true; string strMessage = strprintf( _("This transaction is over the size limit. You can still send it for a fee of %s, "