IsPegsImport() is always false
Since this function always returns false and is used in many "hot" code paths, removing it from the code should give us a performance boost.
This commit is contained in:
@@ -563,11 +563,6 @@ CAmount CCoinsViewCache::GetValueIn(int32_t nHeight,int64_t *interestp,const CTr
|
||||
return 0;
|
||||
for (unsigned int i = 0; i < tx.vin.size(); i++)
|
||||
{
|
||||
//if (tx.IsPegsImport() && i==0)
|
||||
//{
|
||||
// nResult = GetCoinImportValue(tx);
|
||||
// continue;
|
||||
//}
|
||||
value = GetOutputFor(tx.vin[i]).nValue;
|
||||
nResult += value;
|
||||
}
|
||||
@@ -599,7 +594,7 @@ bool CCoinsViewCache::HaveInputs(const CTransaction& tx) const
|
||||
{
|
||||
if (!tx.IsMint()) {
|
||||
for (unsigned int i = 0; i < tx.vin.size(); i++) {
|
||||
if (tx.IsPegsImport() && i==0) continue;
|
||||
//if (tx.IsPegsImport() && i==0) continue;
|
||||
const COutPoint &prevout = tx.vin[i].prevout;
|
||||
const CCoins* coins = AccessCoins(prevout.hash);
|
||||
if (!coins || !coins->IsAvailable(prevout.n)) {
|
||||
@@ -621,7 +616,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 || tx.IsCoinImport() ) { // || tx.IsPegsImport()) {
|
||||
return MAX_PRIORITY;
|
||||
}
|
||||
|
||||
|
||||
34
src/main.cpp
34
src/main.cpp
@@ -816,7 +816,7 @@ bool hush_dailysnapshot(int32_t height)
|
||||
for (unsigned int j = tx.vin.size(); j-- > 0;)
|
||||
{
|
||||
uint256 blockhash; CTransaction txin;
|
||||
if (tx.IsPegsImport() && j==0) continue;
|
||||
//if (tx.IsPegsImport() && j==0) continue;
|
||||
if ( !tx.IsCoinImport() && !tx.IsCoinBase() && myGetTransaction(tx.vin[j].prevout.hash,txin,blockhash) )
|
||||
{
|
||||
int vout = tx.vin[j].prevout.n;
|
||||
@@ -1108,7 +1108,7 @@ bool AreInputsStandard(const CTransaction& tx, const CCoinsViewCache& mapInputs,
|
||||
|
||||
for (unsigned int i = 0; i < tx.vin.size(); i++)
|
||||
{
|
||||
if (tx.IsPegsImport() && i==0) continue;
|
||||
//if (tx.IsPegsImport() && i==0) continue;
|
||||
const CTxOut& prev = mapInputs.GetOutputFor(tx.vin[i]);
|
||||
|
||||
vector<vector<unsigned char> > vSolutions;
|
||||
@@ -1186,7 +1186,7 @@ unsigned int GetP2SHSigOpCount(const CTransaction& tx, const CCoinsViewCache& in
|
||||
unsigned int nSigOps = 0;
|
||||
for (unsigned int i = 0; i < tx.vin.size(); i++)
|
||||
{
|
||||
if (tx.IsPegsImport() && i==0) continue;
|
||||
//if (tx.IsPegsImport() && i==0) continue;
|
||||
const CTxOut &prevout = inputs.GetOutputFor(tx.vin[i]);
|
||||
if (prevout.scriptPubKey.IsPayToScriptHash())
|
||||
nSigOps += prevout.scriptPubKey.GetSigOpCount(tx.vin[i].scriptSig);
|
||||
@@ -1899,7 +1899,7 @@ 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()) {
|
||||
if (!tx.IsCoinImport()) { // && !tx.IsPegsImport()) {
|
||||
BOOST_FOREACH(const CTxIn &txin, tx.vin) {
|
||||
const CCoins *coins = view.AccessCoins(txin.prevout.hash);
|
||||
if (coins->IsCoinBase()) {
|
||||
@@ -2559,7 +2559,7 @@ void UpdateCoins(const CTransaction& tx, CCoinsViewCache& inputs, CTxUndo &txund
|
||||
{
|
||||
txundo.vprevout.reserve(tx.vin.size());
|
||||
BOOST_FOREACH(const CTxIn &txin, tx.vin) {
|
||||
if (tx.IsPegsImport() && txin.prevout.n==10e8) continue;
|
||||
//if (tx.IsPegsImport() && txin.prevout.n==10e8) continue;
|
||||
CCoinsModifier coins = inputs.ModifyCoins(txin.prevout.hash);
|
||||
unsigned nPos = txin.prevout.n;
|
||||
|
||||
@@ -2621,13 +2621,6 @@ namespace Consensus {
|
||||
CAmount nFees = 0;
|
||||
for (unsigned int i = 0; i < tx.vin.size(); i++)
|
||||
{
|
||||
/*
|
||||
if (tx.IsPegsImport() && i==0)
|
||||
{
|
||||
nValueIn=GetCoinImportValue(tx);
|
||||
continue;
|
||||
}
|
||||
*/
|
||||
const COutPoint &prevout = tx.vin[i].prevout;
|
||||
const CCoins *coins = inputs.AccessCoins(prevout.hash);
|
||||
assert(coins);
|
||||
@@ -2715,7 +2708,7 @@ bool ContextualCheckInputs(
|
||||
// still computed and checked, and any change will be caught at the next checkpoint.
|
||||
if (fScriptChecks) {
|
||||
for (unsigned int i = 0; i < tx.vin.size(); i++) {
|
||||
if (tx.IsPegsImport() && i==0) continue;
|
||||
//if (tx.IsPegsImport() && i==0) continue;
|
||||
const COutPoint &prevout = tx.vin[i].prevout;
|
||||
const CCoins* coins = inputs.AccessCoins(prevout.hash);
|
||||
assert(coins);
|
||||
@@ -2751,15 +2744,6 @@ bool ContextualCheckInputs(
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
if (tx.IsCoinImport() || tx.IsPegsImport())
|
||||
{
|
||||
LOCK(cs_main);
|
||||
ServerTransactionSignatureChecker checker(&tx, 0, 0, false, txdata);
|
||||
return VerifyCoinImport(tx.vin[0].scriptSig, checker, state);
|
||||
}
|
||||
*/
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -2995,11 +2979,11 @@ bool DisconnectBlock(CBlock& block, CValidationState& state, CBlockIndex* pindex
|
||||
// restore inputs
|
||||
if (!tx.IsMint()) {
|
||||
CTxUndo &txundo = blockUndo.vtxundo[i-1];
|
||||
if (tx.IsPegsImport()) txundo.vprevout.insert(txundo.vprevout.begin(),CTxInUndo());
|
||||
//if (tx.IsPegsImport()) txundo.vprevout.insert(txundo.vprevout.begin(),CTxInUndo());
|
||||
if (txundo.vprevout.size() != tx.vin.size())
|
||||
return error("DisconnectBlock(): transaction and undo data inconsistent");
|
||||
for (unsigned int j = tx.vin.size(); j-- > 0;) {
|
||||
if (tx.IsPegsImport() && j==0) continue;
|
||||
//if (tx.IsPegsImport() && j==0) continue;
|
||||
const COutPoint &out = tx.vin[j].prevout;
|
||||
const CTxInUndo &undo = txundo.vprevout[j];
|
||||
if (!ApplyTxInUndo(undo, view, out))
|
||||
@@ -3340,7 +3324,7 @@ bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pin
|
||||
{
|
||||
for (size_t j = 0; j < tx.vin.size(); j++)
|
||||
{
|
||||
if (tx.IsPegsImport() && j==0) continue;
|
||||
//if (tx.IsPegsImport() && j==0) continue;
|
||||
const CTxIn input = tx.vin[j];
|
||||
const CTxOut &prevout = view.GetOutputFor(tx.vin[j]);
|
||||
|
||||
|
||||
@@ -123,7 +123,7 @@ bool CTxMemPool::addUnchecked(const uint256& hash, const CTxMemPoolEntry &entry,
|
||||
if (!tx.IsCoinImport()) {
|
||||
for (unsigned int i = 0; i < tx.vin.size(); i++)
|
||||
{
|
||||
if (tx.IsPegsImport() && i==0) continue;
|
||||
//if (tx.IsPegsImport() && i==0) continue;
|
||||
mapNextTx[tx.vin[i].prevout] = CInPoint(&tx, i);
|
||||
}
|
||||
}
|
||||
@@ -146,7 +146,7 @@ void CTxMemPool::addAddressIndex(const CTxMemPoolEntry &entry, const CCoinsViewC
|
||||
|
||||
uint256 txhash = tx.GetHash();
|
||||
for (unsigned int j = 0; j < tx.vin.size(); j++) {
|
||||
if (tx.IsPegsImport() && j==0) continue;
|
||||
//if (tx.IsPegsImport() && j==0) continue;
|
||||
const CTxIn input = tx.vin[j];
|
||||
const CTxOut &prevout = view.GetOutputFor(input);
|
||||
|
||||
@@ -252,7 +252,7 @@ void CTxMemPool::addSpentIndex(const CTxMemPoolEntry &entry, const CCoinsViewCac
|
||||
|
||||
uint256 txhash = tx.GetHash();
|
||||
for (unsigned int j = 0; j < tx.vin.size(); j++) {
|
||||
if (tx.IsPegsImport() && j==0) continue;
|
||||
//if (tx.IsPegsImport() && j==0) continue;
|
||||
const CTxIn input = tx.vin[j];
|
||||
const CTxOut &prevout = view.GetOutputFor(input);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user