| 1164 | } |
| 1165 | |
| 1166 | CAmount GetMinRelayFee(const CTransaction& tx, unsigned int nBytes, bool fAllowFree) |
| 1167 | { |
| 1168 | { |
| 1169 | LOCK(mempool.cs); |
| 1170 | uint256 hash = tx.GetHash(); |
| 1171 | double dPriorityDelta = 0; |
| 1172 | CAmount nFeeDelta = 0; |
| 1173 | mempool.ApplyDeltas(hash, dPriorityDelta, nFeeDelta); |
| 1174 | if (dPriorityDelta > 0 || nFeeDelta > 0) |
| 1175 | return 0; |
| 1176 | } |
| 1177 | |
| 1178 | CAmount nMinFee = ::minRelayTxFee.GetFee(nBytes); |
| 1179 | |
| 1180 | if (fAllowFree) |
| 1181 | { |
| 1182 | // There is a free transaction area in blocks created by most miners, |
| 1183 | // * If we are relaying we allow transactions up to DEFAULT_BLOCK_PRIORITY_SIZE - 1000 |
| 1184 | // to be considered to fall into this category. We don't want to encourage sending |
| 1185 | // multiple transactions instead of one big transaction to avoid fees. |
| 1186 | if (nBytes < (DEFAULT_BLOCK_PRIORITY_SIZE - 1000)) |
| 1187 | nMinFee = 0; |
| 1188 | } |
| 1189 | |
| 1190 | if (!MoneyRange(nMinFee)) |
| 1191 | nMinFee = MAX_MONEY; |
| 1192 | return nMinFee; |
| 1193 | } |
| 1194 | |
| 1195 | // Exponentially limit the rate of nSize flow to nLimit. nLimit unit is thousands-per-minute. |
| 1196 | bool RateLimitExceeded(double& dCount, int64_t& nLastTime, int64_t nLimit, unsigned int nSize) |
no test coverage detected