diff options
author | Cozz Lovan <cozzlovan@yahoo.com> | 2013-08-12 16:59:09 +0200 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@gmail.com> | 2013-11-14 14:25:04 +0100 |
commit | 8dfd8c62dccac96afbda5ad0e66e68ee4820481f (patch) | |
tree | dc517aecc0dd6d3973a2e91dbf9ead2284c74673 /src | |
parent | 6ad44f569335d57a56e5b28582255439980f9b73 (diff) |
pass nBytes as parameter to GetMinFee(..)
Diffstat (limited to 'src')
-rw-r--r-- | src/main.cpp | 5 | ||||
-rw-r--r-- | src/main.h | 2 | ||||
-rw-r--r-- | src/wallet.cpp | 2 |
3 files changed, 4 insertions, 5 deletions
diff --git a/src/main.cpp b/src/main.cpp index 72245137ed..15fc8a24c3 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -599,12 +599,11 @@ bool CheckTransaction(const CTransaction& tx, CValidationState &state) return true; } -int64_t GetMinFee(const CTransaction& tx, bool fAllowFree, enum GetMinFee_mode mode) +int64_t GetMinFee(const CTransaction& tx, unsigned int nBytes, bool fAllowFree, enum GetMinFee_mode mode) { // Base fee is either nMinTxFee or nMinRelayTxFee int64_t nBaseFee = (mode == GMF_RELAY) ? tx.nMinRelayTxFee : tx.nMinTxFee; - unsigned int nBytes = ::GetSerializeSize(tx, SER_NETWORK, PROTOCOL_VERSION); int64_t nMinFee = (1 + (int64_t)nBytes / 1000) * nBaseFee; if (fAllowFree) @@ -740,7 +739,7 @@ bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransa unsigned int nSize = ::GetSerializeSize(tx, SER_NETWORK, PROTOCOL_VERSION); // Don't accept it if it can't get into a block - int64_t txMinFee = GetMinFee(tx, true, GMF_RELAY); + int64_t txMinFee = GetMinFee(tx, nSize, true, GMF_RELAY); if (fLimitFree && nFees < txMinFee) return state.DoS(0, error("AcceptToMemoryPool : not enough fees %s, %"PRId64" < %"PRId64, hash.ToString().c_str(), nFees, txMinFee), diff --git a/src/main.h b/src/main.h index b02aa60665..cf803ae25e 100644 --- a/src/main.h +++ b/src/main.h @@ -258,7 +258,7 @@ enum GetMinFee_mode GMF_SEND, }; -int64_t GetMinFee(const CTransaction& tx, bool fAllowFree, enum GetMinFee_mode mode); +int64_t GetMinFee(const CTransaction& tx, unsigned int nBytes, bool fAllowFree, enum GetMinFee_mode mode); // // Check transaction inputs, and make sure any diff --git a/src/wallet.cpp b/src/wallet.cpp index 6e49ef7b8e..868716cb2c 100644 --- a/src/wallet.cpp +++ b/src/wallet.cpp @@ -1334,7 +1334,7 @@ bool CWallet::CreateTransaction(const vector<pair<CScript, int64_t> >& vecSend, // Check that enough fee is included int64_t nPayFee = nTransactionFee * (1 + (int64_t)nBytes / 1000); bool fAllowFree = AllowFree(dPriority); - int64_t nMinFee = GetMinFee(wtxNew, fAllowFree, GMF_SEND); + int64_t nMinFee = GetMinFee(wtxNew, nBytes, fAllowFree, GMF_SEND); if (nFeeRet < max(nPayFee, nMinFee)) { nFeeRet = max(nPayFee, nMinFee); |