From 01f0c346619cd98fdeb9bc8ab5f1518a7d61aca5 Mon Sep 17 00:00:00 2001 From: Duke Date: Tue, 24 Sep 2024 09:35:20 -0400 Subject: [PATCH] We do not support coin imports --- src/coins.cpp | 4 +--- src/main.cpp | 36 ++++++++++++++++-------------------- src/txmempool.cpp | 11 +++++------ 3 files changed, 22 insertions(+), 29 deletions(-) diff --git a/src/coins.cpp b/src/coins.cpp index 8801b397c..1e5bff4e3 100644 --- a/src/coins.cpp +++ b/src/coins.cpp @@ -557,8 +557,6 @@ CAmount CCoinsViewCache::GetValueIn(int32_t nHeight,int64_t *interestp,const CTr CAmount value,nResult = 0; if ( interestp != 0 ) *interestp = 0; - //if ( tx.IsCoinImport() ) - // return GetCoinImportValue(tx); if ( tx.IsCoinBase() != 0 ) return 0; for (unsigned int i = 0; i < tx.vin.size(); i++) @@ -616,7 +614,7 @@ double CCoinsViewCache::GetPriority(const CTransaction &tx, int nHeight) const // use the maximum priority for all (partially or fully) shielded transactions. // (Note that coinbase transactions cannot contain Sapling shielded Spends or Outputs.) - if (tx.vShieldedSpend.size() > 0 || tx.vShieldedOutput.size() > 0 || tx.IsCoinImport() ) { // || tx.IsPegsImport()) { + if (tx.vShieldedSpend.size() > 0 || tx.vShieldedOutput.size() > 0 ) { return MAX_PRIORITY; } diff --git a/src/main.cpp b/src/main.cpp index 4e7321130..307801fd3 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -817,7 +817,7 @@ bool hush_dailysnapshot(int32_t height) { uint256 blockhash; CTransaction txin; //if (tx.IsPegsImport() && j==0) continue; - if ( !tx.IsCoinImport() && !tx.IsCoinBase() && myGetTransaction(tx.vin[j].prevout.hash,txin,blockhash) ) + if ( !tx.IsCoinBase() && myGetTransaction(tx.vin[j].prevout.hash,txin,blockhash) ) { int vout = tx.vin[j].prevout.n; if ( ExtractDestination(txin.vout[vout].scriptPubKey, vDest) ) @@ -1180,7 +1180,7 @@ unsigned int GetLegacySigOpCount(const CTransaction& tx) unsigned int GetP2SHSigOpCount(const CTransaction& tx, const CCoinsViewCache& inputs) { - if (tx.IsCoinBase() || tx.IsCoinImport()) + if (tx.IsCoinBase()) return 0; unsigned int nSigOps = 0; @@ -1889,13 +1889,11 @@ bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransa // Keep track of transactions that spend a coinbase, which we re-scan // during reorgs to ensure COINBASE_MATURITY is still met. bool fSpendsCoinbase = false; - if (!tx.IsCoinImport()) { // && !tx.IsPegsImport()) { - BOOST_FOREACH(const CTxIn &txin, tx.vin) { - const CCoins *coins = view.AccessCoins(txin.prevout.hash); - if (coins->IsCoinBase()) { - fSpendsCoinbase = true; - break; - } + BOOST_FOREACH(const CTxIn &txin, tx.vin) { + const CCoins *coins = view.AccessCoins(txin.prevout.hash); + if (coins->IsCoinBase()) { + fSpendsCoinbase = true; + break; } } // Grab the branch ID we expect this transaction to commit to. We don't @@ -1927,7 +1925,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() ) + if (fLimitFree && nFees < ::minRelayTxFee.GetFee(nSize) ) { static CCriticalSection csFreeLimiter; static double dFreeCount; @@ -1998,17 +1996,15 @@ bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransa LOCK(pool.cs); // Store transaction in memory pool.addUnchecked(hash, entry, !IsInitialBlockDownload()); - if (!tx.IsCoinImport()) - { - // Add memory address index - if (fAddressIndex) { - pool.addAddressIndex(entry, view); - } - // Add memory spent index - if (fSpentIndex) { - pool.addSpentIndex(entry, view); - } + // Add memory address index + if (fAddressIndex) { + pool.addAddressIndex(entry, view); + } + + // Add memory spent index + if (fSpentIndex) { + pool.addSpentIndex(entry, view); } } } diff --git a/src/txmempool.cpp b/src/txmempool.cpp index da4e0bd59..a6be3752d 100644 --- a/src/txmempool.cpp +++ b/src/txmempool.cpp @@ -120,13 +120,12 @@ bool CTxMemPool::addUnchecked(const uint256& hash, const CTxMemPoolEntry &entry, const CTransaction& tx = mapTx.find(hash)->GetTx(); mapRecentlyAddedTx[tx.GetHash()] = &tx; nRecentlyAddedSequence += 1; - if (!tx.IsCoinImport()) { - for (unsigned int i = 0; i < tx.vin.size(); i++) - { - //if (tx.IsPegsImport() && i==0) continue; - mapNextTx[tx.vin[i].prevout] = CInPoint(&tx, i); - } + + for (unsigned int i = 0; i < tx.vin.size(); i++) + { + mapNextTx[tx.vin[i].prevout] = CInPoint(&tx, i); } + for (const SpendDescription &spendDescription : tx.vShieldedSpend) { mapSaplingNullifiers[spendDescription.nullifier] = &tx; }