|
|
@ -1005,7 +1005,7 @@ std::string FormatStateMessage(const CValidationState &state) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
bool AcceptToMemoryPoolWorker(CTxMemPool& pool, CValidationState& state, const CTransaction& tx, bool fLimitFree, |
|
|
|
bool AcceptToMemoryPoolWorker(CTxMemPool& pool, CValidationState& state, const CTransaction& tx, bool fLimitFree, |
|
|
|
bool* pfMissingInputs, CFeeRate* txFeeRate, bool fOverrideMempoolLimit, const CAmount& nAbsurdFee, |
|
|
|
bool* pfMissingInputs, bool fOverrideMempoolLimit, const CAmount& nAbsurdFee, |
|
|
|
std::vector<uint256>& vHashTxnToUncache) |
|
|
|
std::vector<uint256>& vHashTxnToUncache) |
|
|
|
{ |
|
|
|
{ |
|
|
|
const uint256 hash = tx.GetHash(); |
|
|
|
const uint256 hash = tx.GetHash(); |
|
|
@ -1170,9 +1170,6 @@ bool AcceptToMemoryPoolWorker(CTxMemPool& pool, CValidationState& state, const C |
|
|
|
|
|
|
|
|
|
|
|
CTxMemPoolEntry entry(tx, nFees, GetTime(), dPriority, chainActive.Height(), pool.HasNoInputsOf(tx), inChainInputValue, fSpendsCoinbase, nSigOps, lp); |
|
|
|
CTxMemPoolEntry entry(tx, nFees, GetTime(), dPriority, chainActive.Height(), pool.HasNoInputsOf(tx), inChainInputValue, fSpendsCoinbase, nSigOps, lp); |
|
|
|
unsigned int nSize = entry.GetTxSize(); |
|
|
|
unsigned int nSize = entry.GetTxSize(); |
|
|
|
if (txFeeRate) { |
|
|
|
|
|
|
|
*txFeeRate = CFeeRate(nFees, nSize); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Check that the transaction doesn't have an excessive number of
|
|
|
|
// Check that the transaction doesn't have an excessive number of
|
|
|
|
// sigops, making it impossible to mine. Since the coinbase transaction
|
|
|
|
// sigops, making it impossible to mine. Since the coinbase transaction
|
|
|
@ -1421,10 +1418,10 @@ bool AcceptToMemoryPoolWorker(CTxMemPool& pool, CValidationState& state, const C |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransaction &tx, bool fLimitFree, |
|
|
|
bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransaction &tx, bool fLimitFree, |
|
|
|
bool* pfMissingInputs, CFeeRate* txFeeRate, bool fOverrideMempoolLimit, const CAmount nAbsurdFee) |
|
|
|
bool* pfMissingInputs, bool fOverrideMempoolLimit, const CAmount nAbsurdFee) |
|
|
|
{ |
|
|
|
{ |
|
|
|
std::vector<uint256> vHashTxToUncache; |
|
|
|
std::vector<uint256> vHashTxToUncache; |
|
|
|
bool res = AcceptToMemoryPoolWorker(pool, state, tx, fLimitFree, pfMissingInputs, txFeeRate, fOverrideMempoolLimit, nAbsurdFee, vHashTxToUncache); |
|
|
|
bool res = AcceptToMemoryPoolWorker(pool, state, tx, fLimitFree, pfMissingInputs, fOverrideMempoolLimit, nAbsurdFee, vHashTxToUncache); |
|
|
|
if (!res) { |
|
|
|
if (!res) { |
|
|
|
BOOST_FOREACH(const uint256& hashTx, vHashTxToUncache) |
|
|
|
BOOST_FOREACH(const uint256& hashTx, vHashTxToUncache) |
|
|
|
pcoinsTip->Uncache(hashTx); |
|
|
|
pcoinsTip->Uncache(hashTx); |
|
|
@ -2651,7 +2648,7 @@ bool static DisconnectTip(CValidationState& state, const CChainParams& chainpara |
|
|
|
// ignore validation errors in resurrected transactions
|
|
|
|
// ignore validation errors in resurrected transactions
|
|
|
|
list<CTransaction> removed; |
|
|
|
list<CTransaction> removed; |
|
|
|
CValidationState stateDummy; |
|
|
|
CValidationState stateDummy; |
|
|
|
if (tx.IsCoinBase() || !AcceptToMemoryPool(mempool, stateDummy, tx, false, NULL, NULL, true)) { |
|
|
|
if (tx.IsCoinBase() || !AcceptToMemoryPool(mempool, stateDummy, tx, false, NULL, true)) { |
|
|
|
mempool.removeRecursive(tx, removed); |
|
|
|
mempool.removeRecursive(tx, removed); |
|
|
|
} else if (mempool.exists(tx.GetHash())) { |
|
|
|
} else if (mempool.exists(tx.GetHash())) { |
|
|
|
vHashUpdate.push_back(tx.GetHash()); |
|
|
|
vHashUpdate.push_back(tx.GetHash()); |
|
|
@ -4956,10 +4953,9 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv, |
|
|
|
pfrom->setAskFor.erase(inv.hash); |
|
|
|
pfrom->setAskFor.erase(inv.hash); |
|
|
|
mapAlreadyAskedFor.erase(inv.hash); |
|
|
|
mapAlreadyAskedFor.erase(inv.hash); |
|
|
|
|
|
|
|
|
|
|
|
CFeeRate txFeeRate = CFeeRate(0); |
|
|
|
if (!AlreadyHave(inv) && AcceptToMemoryPool(mempool, state, tx, true, &fMissingInputs)) { |
|
|
|
if (!AlreadyHave(inv) && AcceptToMemoryPool(mempool, state, tx, true, &fMissingInputs, &txFeeRate)) { |
|
|
|
|
|
|
|
mempool.check(pcoinsTip); |
|
|
|
mempool.check(pcoinsTip); |
|
|
|
RelayTransaction(tx, txFeeRate); |
|
|
|
RelayTransaction(tx); |
|
|
|
vWorkQueue.push_back(inv.hash); |
|
|
|
vWorkQueue.push_back(inv.hash); |
|
|
|
|
|
|
|
|
|
|
|
LogPrint("mempool", "AcceptToMemoryPool: peer=%d: accepted %s (poolsz %u txn, %u kB)\n", |
|
|
|
LogPrint("mempool", "AcceptToMemoryPool: peer=%d: accepted %s (poolsz %u txn, %u kB)\n", |
|
|
@ -4990,10 +4986,9 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv, |
|
|
|
|
|
|
|
|
|
|
|
if (setMisbehaving.count(fromPeer)) |
|
|
|
if (setMisbehaving.count(fromPeer)) |
|
|
|
continue; |
|
|
|
continue; |
|
|
|
CFeeRate orphanFeeRate = CFeeRate(0); |
|
|
|
if (AcceptToMemoryPool(mempool, stateDummy, orphanTx, true, &fMissingInputs2)) { |
|
|
|
if (AcceptToMemoryPool(mempool, stateDummy, orphanTx, true, &fMissingInputs2, &orphanFeeRate)) { |
|
|
|
|
|
|
|
LogPrint("mempool", " accepted orphan tx %s\n", orphanHash.ToString()); |
|
|
|
LogPrint("mempool", " accepted orphan tx %s\n", orphanHash.ToString()); |
|
|
|
RelayTransaction(orphanTx, orphanFeeRate); |
|
|
|
RelayTransaction(orphanTx); |
|
|
|
vWorkQueue.push_back(orphanHash); |
|
|
|
vWorkQueue.push_back(orphanHash); |
|
|
|
vEraseQueue.push_back(orphanHash); |
|
|
|
vEraseQueue.push_back(orphanHash); |
|
|
|
} |
|
|
|
} |
|
|
@ -5046,7 +5041,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv, |
|
|
|
int nDoS = 0; |
|
|
|
int nDoS = 0; |
|
|
|
if (!state.IsInvalid(nDoS) || nDoS == 0) { |
|
|
|
if (!state.IsInvalid(nDoS) || nDoS == 0) { |
|
|
|
LogPrintf("Force relaying tx %s from whitelisted peer=%d\n", tx.GetHash().ToString(), pfrom->id); |
|
|
|
LogPrintf("Force relaying tx %s from whitelisted peer=%d\n", tx.GetHash().ToString(), pfrom->id); |
|
|
|
RelayTransaction(tx, txFeeRate); |
|
|
|
RelayTransaction(tx); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
LogPrintf("Not relaying invalid transaction %s from whitelisted peer=%d (%s)\n", tx.GetHash().ToString(), pfrom->id, FormatStateMessage(state)); |
|
|
|
LogPrintf("Not relaying invalid transaction %s from whitelisted peer=%d (%s)\n", tx.GetHash().ToString(), pfrom->id, FormatStateMessage(state)); |
|
|
|
} |
|
|
|
} |
|
|
|