Changeset View
Changeset View
Standalone View
Standalone View
src/txmempool.cpp
Show First 20 Lines • Show All 976 Lines • ▼ Show 20 Lines | bool CTxMemPool::WriteFeeEstimates(CAutoFile &fileout) const { | ||||
try { | try { | ||||
LOCK(cs); | LOCK(cs); | ||||
// version required to read: 0.13.99 or later | // version required to read: 0.13.99 or later | ||||
fileout << 139900; | fileout << 139900; | ||||
// version that wrote the file | // version that wrote the file | ||||
fileout << CLIENT_VERSION; | fileout << CLIENT_VERSION; | ||||
minerPolicyEstimator->Write(fileout); | minerPolicyEstimator->Write(fileout); | ||||
} catch (const std::exception &) { | } catch (const std::exception &) { | ||||
LogPrintf("CTxMemPool::WriteFeeEstimates(): unable to write policy " | LogPrint(BCLog::MEMPOOL, | ||||
"CTxMemPool::WriteFeeEstimates(): unable to write policy " | |||||
"estimator data (non-fatal)\n"); | "estimator data (non-fatal)\n"); | ||||
return false; | return false; | ||||
} | } | ||||
return true; | return true; | ||||
} | } | ||||
bool CTxMemPool::ReadFeeEstimates(CAutoFile &filein) { | bool CTxMemPool::ReadFeeEstimates(CAutoFile &filein) { | ||||
try { | try { | ||||
int nVersionRequired, nVersionThatWrote; | int nVersionRequired, nVersionThatWrote; | ||||
filein >> nVersionRequired >> nVersionThatWrote; | filein >> nVersionRequired >> nVersionThatWrote; | ||||
if (nVersionRequired > CLIENT_VERSION) { | if (nVersionRequired > CLIENT_VERSION) { | ||||
return error("CTxMemPool::ReadFeeEstimates(): up-version (%d) fee " | return error("CTxMemPool::ReadFeeEstimates(): up-version (%d) fee " | ||||
"estimate file", | "estimate file", | ||||
nVersionRequired); | nVersionRequired); | ||||
} | } | ||||
LOCK(cs); | LOCK(cs); | ||||
minerPolicyEstimator->Read(filein, nVersionThatWrote); | minerPolicyEstimator->Read(filein, nVersionThatWrote); | ||||
} catch (const std::exception &) { | } catch (const std::exception &) { | ||||
LogPrintf("CTxMemPool::ReadFeeEstimates(): unable to read policy " | LogPrint(BCLog::MEMPOOL, | ||||
"CTxMemPool::ReadFeeEstimates(): unable to read policy " | |||||
"estimator data (non-fatal)\n"); | "estimator data (non-fatal)\n"); | ||||
return false; | return false; | ||||
} | } | ||||
return true; | return true; | ||||
} | } | ||||
void CTxMemPool::PrioritiseTransaction(const uint256 hash, | void CTxMemPool::PrioritiseTransaction(const uint256 hash, | ||||
const std::string strHash, | const std::string strHash, | ||||
double dPriorityDelta, | double dPriorityDelta, | ||||
Show All 22 Lines | void CTxMemPool::PrioritiseTransaction(const uint256 hash, | ||||
CalculateDescendants(it, setDescendants); | CalculateDescendants(it, setDescendants); | ||||
setDescendants.erase(it); | setDescendants.erase(it); | ||||
for (txiter descendantIt : setDescendants) { | for (txiter descendantIt : setDescendants) { | ||||
mapTx.modify(descendantIt, | mapTx.modify(descendantIt, | ||||
update_ancestor_state(0, 0, nFeeDelta, 0, 0)); | update_ancestor_state(0, 0, nFeeDelta, 0, 0)); | ||||
} | } | ||||
} | } | ||||
} | } | ||||
LogPrintf("PrioritiseTransaction: %s priority += %f, fee += %d\n", strHash, | LogPrint(BCLog::MEMPOOL, | ||||
"PrioritiseTransaction: %s priority += %f, fee += %d\n", strHash, | |||||
dPriorityDelta, FormatMoney(nFeeDelta)); | dPriorityDelta, FormatMoney(nFeeDelta)); | ||||
} | } | ||||
void CTxMemPool::ApplyDeltas(const uint256 hash, double &dPriorityDelta, | void CTxMemPool::ApplyDeltas(const uint256 hash, double &dPriorityDelta, | ||||
Amount &nFeeDelta) const { | Amount &nFeeDelta) const { | ||||
LOCK(cs); | LOCK(cs); | ||||
std::map<uint256, TXModifier>::const_iterator pos = mapDeltas.find(hash); | std::map<uint256, TXModifier>::const_iterator pos = mapDeltas.find(hash); | ||||
if (pos == mapDeltas.end()) { | if (pos == mapDeltas.end()) { | ||||
return; | return; | ||||
▲ Show 20 Lines • Show All 350 Lines • Show Last 20 Lines |