MCPcopy Create free account
hub / github.com/bitcoinxt/bitcoinxt / GetMinRelayFee

Function GetMinRelayFee

src/main.cpp:1166–1193  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1164}
1165
1166CAmount 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.
1196bool RateLimitExceeded(double& dCount, int64_t& nLastTime, int64_t nLimit, unsigned int nSize)

Callers 1

AcceptToMemoryPoolFunction · 0.85

Calls 4

MoneyRangeFunction · 0.85
ApplyDeltasMethod · 0.80
GetHashMethod · 0.45
GetFeeMethod · 0.45

Tested by

no test coverage detected