mirror of
https://github.com/twisterarmy/twister-core.git
synced 2025-01-25 14:04:27 +00:00
Merge remote branch 'refs/remotes/svn/trunk' into svn
This commit is contained in:
commit
9c17a685bd
46
main.cpp
46
main.cpp
@ -571,10 +571,15 @@ bool CTransaction::AcceptToMemoryPool(CTxDB& txdb, bool fCheckInputs, bool* pfMi
|
|||||||
if ((int64)nLockTime > INT_MAX)
|
if ((int64)nLockTime > INT_MAX)
|
||||||
return error("AcceptToMemoryPool() : not accepting nLockTime beyond 2038 yet");
|
return error("AcceptToMemoryPool() : not accepting nLockTime beyond 2038 yet");
|
||||||
|
|
||||||
// Rather not work on nonstandard transactions
|
// Safety limits
|
||||||
if (!IsStandard() || GetSigOpCount() > 2 || ::GetSerializeSize(*this, SER_NETWORK) < 100)
|
unsigned int nSize = ::GetSerializeSize(*this, SER_NETWORK);
|
||||||
|
if (GetSigOpCount() > 2 || nSize < 100)
|
||||||
return error("AcceptToMemoryPool() : nonstandard transaction");
|
return error("AcceptToMemoryPool() : nonstandard transaction");
|
||||||
|
|
||||||
|
// Rather not work on nonstandard transactions
|
||||||
|
if (!IsStandard())
|
||||||
|
return error("AcceptToMemoryPool() : nonstandard transaction type");
|
||||||
|
|
||||||
// Do we already have it?
|
// Do we already have it?
|
||||||
uint256 hash = GetHash();
|
uint256 hash = GetHash();
|
||||||
CRITICAL_BLOCK(cs_mapTransactions)
|
CRITICAL_BLOCK(cs_mapTransactions)
|
||||||
@ -612,14 +617,36 @@ bool CTransaction::AcceptToMemoryPool(CTxDB& txdb, bool fCheckInputs, bool* pfMi
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check against previous transactions
|
if (fCheckInputs)
|
||||||
map<uint256, CTxIndex> mapUnused;
|
|
||||||
int64 nFees = 0;
|
|
||||||
if (fCheckInputs && !ConnectInputs(txdb, mapUnused, CDiskTxPos(1,1,1), pindexBest, nFees, false, false))
|
|
||||||
{
|
{
|
||||||
if (pfMissingInputs)
|
// Check against previous transactions
|
||||||
*pfMissingInputs = true;
|
map<uint256, CTxIndex> mapUnused;
|
||||||
return error("AcceptToMemoryPool() : ConnectInputs failed %s", hash.ToString().substr(0,10).c_str());
|
int64 nFees = 0;
|
||||||
|
if (!ConnectInputs(txdb, mapUnused, CDiskTxPos(1,1,1), pindexBest, nFees, false, false))
|
||||||
|
{
|
||||||
|
if (pfMissingInputs)
|
||||||
|
*pfMissingInputs = true;
|
||||||
|
return error("AcceptToMemoryPool() : ConnectInputs failed %s", hash.ToString().substr(0,10).c_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
// Don't accept it if it can't get into a block
|
||||||
|
if (nFees < GetMinFee(1000))
|
||||||
|
return error("AcceptToMemoryPool() : not enough fees");
|
||||||
|
|
||||||
|
// Limit free transactions per 10 minutes
|
||||||
|
if (nFees < CENT && GetBoolArg("-limitfreerelay"))
|
||||||
|
{
|
||||||
|
static int64 nNextReset;
|
||||||
|
static int64 nFreeCount;
|
||||||
|
if (GetTime() > nNextReset)
|
||||||
|
{
|
||||||
|
nNextReset = GetTime() + 10 * 60;
|
||||||
|
nFreeCount = 0;
|
||||||
|
}
|
||||||
|
if (nFreeCount > 150000 && !IsFromMe())
|
||||||
|
return error("AcceptToMemoryPool() : free transaction rejected by rate limiter");
|
||||||
|
nFreeCount += nSize;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Store transaction in memory
|
// Store transaction in memory
|
||||||
@ -1926,7 +1953,6 @@ string GetWarnings(string strFor)
|
|||||||
{
|
{
|
||||||
nPriority = alert.nPriority;
|
nPriority = alert.nPriority;
|
||||||
strStatusBar = alert.strStatusBar;
|
strStatusBar = alert.strStatusBar;
|
||||||
strRPC = alert.strRPCError;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
10
main.h
10
main.h
@ -1754,7 +1754,7 @@ public:
|
|||||||
// Actions
|
// Actions
|
||||||
string strComment;
|
string strComment;
|
||||||
string strStatusBar;
|
string strStatusBar;
|
||||||
string strRPCError;
|
string strReserved;
|
||||||
|
|
||||||
IMPLEMENT_SERIALIZE
|
IMPLEMENT_SERIALIZE
|
||||||
(
|
(
|
||||||
@ -1772,7 +1772,7 @@ public:
|
|||||||
|
|
||||||
READWRITE(strComment);
|
READWRITE(strComment);
|
||||||
READWRITE(strStatusBar);
|
READWRITE(strStatusBar);
|
||||||
READWRITE(strRPCError);
|
READWRITE(strReserved);
|
||||||
)
|
)
|
||||||
|
|
||||||
void SetNull()
|
void SetNull()
|
||||||
@ -1790,7 +1790,7 @@ public:
|
|||||||
|
|
||||||
strComment.clear();
|
strComment.clear();
|
||||||
strStatusBar.clear();
|
strStatusBar.clear();
|
||||||
strRPCError.clear();
|
strReserved.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
string ToString() const
|
string ToString() const
|
||||||
@ -1815,7 +1815,6 @@ public:
|
|||||||
" nPriority = %d\n"
|
" nPriority = %d\n"
|
||||||
" strComment = \"%s\"\n"
|
" strComment = \"%s\"\n"
|
||||||
" strStatusBar = \"%s\"\n"
|
" strStatusBar = \"%s\"\n"
|
||||||
" strRPCError = \"%s\"\n"
|
|
||||||
")\n",
|
")\n",
|
||||||
nVersion,
|
nVersion,
|
||||||
nRelayUntil,
|
nRelayUntil,
|
||||||
@ -1828,8 +1827,7 @@ public:
|
|||||||
strSetSubVer.c_str(),
|
strSetSubVer.c_str(),
|
||||||
nPriority,
|
nPriority,
|
||||||
strComment.c_str(),
|
strComment.c_str(),
|
||||||
strStatusBar.c_str(),
|
strStatusBar.c_str());
|
||||||
strRPCError.c_str());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void print() const
|
void print() const
|
||||||
|
@ -25,7 +25,7 @@ class CDataStream;
|
|||||||
class CAutoFile;
|
class CAutoFile;
|
||||||
static const unsigned int MAX_SIZE = 0x02000000;
|
static const unsigned int MAX_SIZE = 0x02000000;
|
||||||
|
|
||||||
static const int VERSION = 31800;
|
static const int VERSION = 31801;
|
||||||
static const char* pszSubVer = "";
|
static const char* pszSubVer = "";
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user