Author

Topic: Bitcoin-Qt fee calculation. Explain this code for me? (Read 1095 times)

legendary
Activity: 3472
Merit: 4801
It is my understanding that the "fee per kilobyte" is only supposed to be enforced by the client when the total size of the transaction exceeds 10 kilobytes, is this right?
The minimum anti-DOS fee per kb is only enforced for transactions which don't qualify as free (too small output, too large data, too low priority), but a _user configured_ fee per kilobyte applies to all transactions.

Ah, ok.

So I have to look at GetMinFee to see the anti-DOS fee per kb.  Thanks. I'll check on it and open a new topic if I'm still confused.
staff
Activity: 4284
Merit: 8808
It is my understanding that the "fee per kilobyte" is only supposed to be enforced by the client when the total size of the transaction exceeds 10 kilobytes, is this right?
The minimum anti-DOS fee per kb is only enforced for transactions which don't qualify as free (too small output, too large data, too low priority), but a _user configured_ fee per kilobyte applies to all transactions.
legendary
Activity: 3472
Merit: 4801
Ok, I just did a pull from git, I'm looking at:
Code:
bool CWallet::CreateTransaction(const vector >& vecSend, CWalletTx& wtxNew, CReserveKey& reservekey, int64& nFeeRet, std::string& strFailReason)
and I'm a bit confused.

I'm sure I must be overlooking something simple, but I just can't seem to see it.  Would someone here mind pointing out what I'm missing?

It is my understanding that the "fee per kilobyte" is only supposed to be enforced by the client when the total size of the transaction exceeds 10 kilobytes, is this right?

Code:
                int64 nPayFee = nTransactionFee * (1 + (int64)nBytes / 1000);
                bool fAllowFree = CTransaction::AllowFree(dPriority);
                int64 nMinFee = wtxNew.GetMinFee(1, fAllowFree, GMF_SEND);
                if (nFeeRet < max(nPayFee, nMinFee))
                {
                    nFeeRet = max(nPayFee, nMinFee);
                    continue;
                }

This code doesn't seem to have any sort of "if (int64)nBytes > 10240)" conditional?

It seems to set nPayFee to
Code:
nTransactionFee * (1 + (int64)nBytes / 1000)
regardless of the size of the transaction.

Then it sets:
Code:
nFeeRet = max(nPayFee, nMinFee);
which would seem to indicate that at a minimum the fee will always be nPayFee regardless of the size of the transaction.

Can someone please point out to me where in the code it tests for (int64)nBytes > 10240 ??
Jump to: