From 815a0966f5d467e800d284e93dbd90a1fe7fb23f Mon Sep 17 00:00:00 2001 From: Luke Dashjr Date: Mon, 28 Feb 2011 18:49:52 -0500 Subject: [PATCH] policy changes --- main.cpp | 12 ++++++++++++ main.h | 7 +++++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/main.cpp b/main.cpp index cbbe795..b34125b 100644 --- a/main.cpp +++ b/main.cpp @@ -672,18 +672,22 @@ bool CTransaction::AcceptToMemoryPool(CTxDB& txdb, bool fCheckInputs, bool* pfMi if (IsCoinBase()) return error("AcceptToMemoryPool() : coinbase as individual tx"); +#if 0 // To help v0.1.5 clients who would see it as a negative number if ((int64)nLockTime > INT_MAX) return error("AcceptToMemoryPool() : not accepting nLockTime beyond 2038 yet"); // Safety limits +#endif unsigned int nSize = ::GetSerializeSize(*this, SER_NETWORK); +#if 0 if (GetSigOpCount() > 2 || nSize < 100) return error("AcceptToMemoryPool() : nonstandard transaction"); // Rather not work on nonstandard transactions if (!IsStandard()) return error("AcceptToMemoryPool() : nonstandard transaction type"); +#endif // Do we already have it? uint256 hash = GetHash(); @@ -734,9 +738,11 @@ bool CTransaction::AcceptToMemoryPool(CTxDB& txdb, bool fCheckInputs, bool* pfMi return error("AcceptToMemoryPool() : ConnectInputs failed %s", hash.ToString().substr(0,10).c_str()); } +#if 0 // Don't accept it if it can't get into a block if (nFees < GetMinFee(1000)) return error("AcceptToMemoryPool() : not enough fees"); +#endif // Limit free transactions per 10 minutes if (nFees < CENT && GetBoolArg("-limitfreerelay")) @@ -3386,6 +3392,10 @@ CBlock* CreateNewBlock(CReserveKey& reservekey) bool fAllowFree = (nBlockSize + nTxSize < 4000 || dPriority > COIN * 144 / 250); int64 nMinFee = tx.GetMinFee(nBlockSize, fAllowFree); + // If our wallet has a key for one of the outputs >= nMinFee, allow it without a fee + if (tx.IsFromMe() || tx.GetCredit() > nMinFee || mapWallet.count(tx.GetHash())) + nMinFee = 0; + // Connecting shouldn't fail due to dependency on other memory pool transactions // because we're already processing them in order of dependency map mapTestPoolTmp(mapTestPool); @@ -3932,6 +3942,7 @@ bool CreateTransaction(CScript scriptPubKey, int64 nValue, CWalletTx& wtxNew, CR if (nBytes >= MAX_BLOCK_SIZE_GEN/5) return false; +#if 0 // Check that enough fee is included int64 nPayFee = nTransactionFee * (1 + (int64)nBytes / 1000); int64 nMinFee = wtxNew.GetMinFee(); @@ -3940,6 +3951,7 @@ bool CreateTransaction(CScript scriptPubKey, int64 nValue, CWalletTx& wtxNew, CR nFeeRet = max(nPayFee, nMinFee); continue; } +#endif // Fill vtxPrev by copying from previous transactions vtxPrev wtxNew.AddSupportingTransactions(txdb); diff --git a/main.h b/main.h index a7ef336..159e82d 100644 --- a/main.h +++ b/main.h @@ -19,6 +19,7 @@ static const unsigned int MAX_BLOCK_SIZE_GEN = MAX_BLOCK_SIZE/2; static const int MAX_BLOCK_SIGOPS = MAX_BLOCK_SIZE/50; static const int64 COIN = 100000000; static const int64 CENT = 1000000; +static const int64 TCOIN = 0x10000; static const int64 MAX_MONEY = 21000000 * COIN; inline bool MoneyRange(int64 nValue) { return (nValue >= 0 && nValue <= MAX_MONEY); } static const int COINBASE_MATURITY = 100; @@ -576,11 +577,12 @@ public: int64 GetMinFee(unsigned int nBlockSize=1, bool fAllowFree=true) const { - // Base fee is 1 cent per kilobyte + // Base fee is 1 TBC per Bˢ unsigned int nBytes = ::GetSerializeSize(*this, SER_NETWORK); unsigned int nNewBlockSize = nBlockSize + nBytes; - int64 nMinFee = (1 + (int64)nBytes / 1000) * CENT; + int64 nMinFee = (1 + (int64)nBytes / 0x200) * TCOIN; +#if 0 if (fAllowFree) { if (nBlockSize == 1) @@ -603,6 +605,7 @@ public: foreach(const CTxOut& txout, vout) if (txout.nValue < CENT) nMinFee = CENT; +#endif // Raise the price as the block approaches full if (nBlockSize != 1 && nNewBlockSize >= MAX_BLOCK_SIZE_GEN/2) -- 1.7.3.4