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