mirror of
				https://git.hush.is/hush/hush3.git
				synced 2025-11-04 00:03:26 -05:00 
			
		
		
		
	Port mempool coredump fix from blackjoker
This commit is contained in:
		
							parent
							
								
									b40a4e9c82
								
							
						
					
					
						commit
						3657b91025
					
				
							
								
								
									
										22
									
								
								src/main.cpp
									
									
									
									
									
								
							
							
						
						
									
										22
									
								
								src/main.cpp
									
									
									
									
									
								
							@ -1922,7 +1922,8 @@ bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransa
 | 
			
		||||
            // Bring the best block into scope
 | 
			
		||||
            view.GetBestBlock();
 | 
			
		||||
 | 
			
		||||
            nValueIn = view.GetValueIn(chainActive.LastTip()->GetHeight(),&interest,tx,chainActive.LastTip()->nTime);
 | 
			
		||||
            if (!fSkipExpiry)
 | 
			
		||||
                nValueIn = view.GetValueIn(chainActive.LastTip()->GetHeight(),&interest,tx,chainActive.LastTip()->nTime);
 | 
			
		||||
            if ( 0 && interest != 0 )
 | 
			
		||||
                fprintf(stderr,"add interest %.8f\n",(double)interest/COIN);
 | 
			
		||||
            // we have all inputs cached now, so switch back to dummy, so we don't need to keep lock on mempool
 | 
			
		||||
@ -1930,7 +1931,7 @@ bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransa
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        // Check for non-standard pay-to-script-hash in inputs
 | 
			
		||||
        if (Params().RequireStandard() && !AreInputsStandard(tx, view, consensusBranchId))
 | 
			
		||||
        if (!fSkipExpiry && Params().RequireStandard() && !AreInputsStandard(tx, view, consensusBranchId))
 | 
			
		||||
            return error("AcceptToMemoryPool: reject nonstandard transaction input");
 | 
			
		||||
 | 
			
		||||
        // Check that the transaction doesn't have an excessive number of
 | 
			
		||||
@ -1939,7 +1940,8 @@ bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransa
 | 
			
		||||
        // MAX_BLOCK_SIGOPS; we still consider this an invalid rather than
 | 
			
		||||
        // merely non-standard transaction.
 | 
			
		||||
        unsigned int nSigOps = GetLegacySigOpCount(tx);
 | 
			
		||||
        nSigOps += GetP2SHSigOpCount(tx, view);
 | 
			
		||||
        if (!fSkipExpiry)
 | 
			
		||||
            nSigOps += GetP2SHSigOpCount(tx, view);
 | 
			
		||||
        if (nSigOps > MAX_STANDARD_TX_SIGOPS)
 | 
			
		||||
        {
 | 
			
		||||
            fprintf(stderr,"accept failure.4\n");
 | 
			
		||||
@ -1948,7 +1950,13 @@ bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransa
 | 
			
		||||
 | 
			
		||||
        CAmount nValueOut = tx.GetValueOut();
 | 
			
		||||
        CAmount nFees = nValueIn-nValueOut;
 | 
			
		||||
        double dPriority = view.GetPriority(tx, chainActive.Height());
 | 
			
		||||
        double dPriority = 0;
 | 
			
		||||
        if (!fSkipExpiry)
 | 
			
		||||
        {
 | 
			
		||||
            dPriority = view.GetPriority(tx, chainActive.Height());
 | 
			
		||||
            nFees = 0;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if ( nValueOut > 777777*COIN && KOMODO_VALUETOOBIG(nValueOut - 777777*COIN) != 0 ) // some room for blockreward and txfees
 | 
			
		||||
            return state.DoS(100, error("AcceptToMemoryPool: GetValueOut too big"),REJECT_INVALID,"tx valueout is too big");
 | 
			
		||||
  
 | 
			
		||||
@ -1996,7 +2004,7 @@ bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransa
 | 
			
		||||
        // Continuously rate-limit free (really, very-low-fee) transactions
 | 
			
		||||
        // This mitigates 'penny-flooding' -- sending thousands of free transactions just to
 | 
			
		||||
        // be annoying or make others' transactions take longer to confirm.
 | 
			
		||||
        if (fLimitFree && nFees < ::minRelayTxFee.GetFee(nSize) && !tx.IsCoinImport() && !tx.IsPegsImport())
 | 
			
		||||
        if ( !fSkipExpiry && fLimitFree && nFees < ::minRelayTxFee.GetFee(nSize) && !tx.IsCoinImport() && !tx.IsPegsImport())
 | 
			
		||||
        {
 | 
			
		||||
            static CCriticalSection csFreeLimiter;
 | 
			
		||||
            static double dFreeCount;
 | 
			
		||||
@ -2019,7 +2027,7 @@ bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransa
 | 
			
		||||
            dFreeCount += nSize;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (!tx.IsCoinImport() && !tx.IsPegsImport() && fRejectAbsurdFee && nFees > ::minRelayTxFee.GetFee(nSize) * 10000 && nFees > nValueOut/19)
 | 
			
		||||
        if (!fSkipExpiry && !tx.IsCoinImport() && !tx.IsPegsImport() && fRejectAbsurdFee && nFees > ::minRelayTxFee.GetFee(nSize) * 10000 && nFees > nValueOut/19)
 | 
			
		||||
        {
 | 
			
		||||
            string errmsg = strprintf("absurdly high fees %s, %d > %d",
 | 
			
		||||
                                      hash.ToString(),
 | 
			
		||||
@ -2066,7 +2074,7 @@ bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransa
 | 
			
		||||
        // Store transaction in memory
 | 
			
		||||
        pool.addUnchecked(hash, entry, !IsInitialBlockDownload());
 | 
			
		||||
 | 
			
		||||
        if (!tx.IsCoinImport())
 | 
			
		||||
        if (!fSkipExpiry && !tx.IsCoinImport())
 | 
			
		||||
        {
 | 
			
		||||
            // Add memory address index
 | 
			
		||||
            if (fAddressIndex) {
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user