Prevent relaying expired tx
This commit is contained in:
@@ -1887,7 +1887,9 @@ bool CWalletTx::RelayWalletTransaction()
|
||||
assert(pwallet->GetBroadcastTransactions());
|
||||
if (!IsCoinBase())
|
||||
{
|
||||
if (GetDepthInMainChain() == 0) {
|
||||
if (GetDepthInMainChain() == 0)
|
||||
{
|
||||
// if tx is expired, dont relay
|
||||
LogPrintf("Relaying wtx %s\n", GetHash().ToString());
|
||||
RelayTransaction((CTransaction)*this);
|
||||
return true;
|
||||
@@ -2102,12 +2104,21 @@ std::vector<uint256> CWallet::ResendWalletTransactionsBefore(int64_t nTime)
|
||||
LOCK(cs_wallet);
|
||||
// Sort them in chronological order
|
||||
multimap<unsigned int, CWalletTx*> mapSorted;
|
||||
uint32_t now = (uint32_t)time(NULL);
|
||||
BOOST_FOREACH(PAIRTYPE(const uint256, CWalletTx)& item, mapWallet)
|
||||
{
|
||||
CWalletTx& wtx = item.second;
|
||||
// Don't rebroadcast if newer than nTime:
|
||||
if (wtx.nTimeReceived > nTime)
|
||||
continue;
|
||||
if ( ASSETCHAINS_SYMBOL[0] == 0 )
|
||||
{
|
||||
if ( wtx.nLockTime >= LOCKTIME_THRESHOLD && wtx.nLockTime < now-KOMODO_MAXMEMPOOLTIME )
|
||||
{
|
||||
LogPrintf("skip Relaying wtx %s nLockTime %u vs now.%u\n", GetHash().ToString(),(uint32_t)wtx.nLockTime,now);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
mapSorted.insert(make_pair(wtx.nTimeReceived, &wtx));
|
||||
}
|
||||
BOOST_FOREACH(PAIRTYPE(const unsigned int, CWalletTx*)& item, mapSorted)
|
||||
|
||||
Reference in New Issue
Block a user