Remove CScriptCheck::nHashType (was always 0)
This commit is contained in:
parent
358562b651
commit
ce3649fb61
3 changed files with 7 additions and 9 deletions
|
@ -1367,7 +1367,7 @@ void UpdateCoins(const CTransaction& tx, CValidationState &state, CCoinsViewCach
|
||||||
|
|
||||||
bool CScriptCheck::operator()() const {
|
bool CScriptCheck::operator()() const {
|
||||||
const CScript &scriptSig = ptxTo->vin[nIn].scriptSig;
|
const CScript &scriptSig = ptxTo->vin[nIn].scriptSig;
|
||||||
if (!VerifyScript(scriptSig, scriptPubKey, *ptxTo, nIn, nFlags, nHashType))
|
if (!VerifyScript(scriptSig, scriptPubKey, *ptxTo, nIn, nFlags, 0))
|
||||||
return error("CScriptCheck() : %s VerifySignature failed", ptxTo->GetHash().ToString());
|
return error("CScriptCheck() : %s VerifySignature failed", ptxTo->GetHash().ToString());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -1440,7 +1440,7 @@ bool CheckInputs(const CTransaction& tx, CValidationState &state, const CCoinsVi
|
||||||
assert(coins);
|
assert(coins);
|
||||||
|
|
||||||
// Verify signature
|
// Verify signature
|
||||||
CScriptCheck check(*coins, tx, i, flags, 0);
|
CScriptCheck check(*coins, tx, i, flags);
|
||||||
if (pvChecks) {
|
if (pvChecks) {
|
||||||
pvChecks->push_back(CScriptCheck());
|
pvChecks->push_back(CScriptCheck());
|
||||||
check.swap(pvChecks->back());
|
check.swap(pvChecks->back());
|
||||||
|
@ -1453,7 +1453,7 @@ bool CheckInputs(const CTransaction& tx, CValidationState &state, const CCoinsVi
|
||||||
// avoid splitting the network between upgraded and
|
// avoid splitting the network between upgraded and
|
||||||
// non-upgraded nodes.
|
// non-upgraded nodes.
|
||||||
CScriptCheck check(*coins, tx, i,
|
CScriptCheck check(*coins, tx, i,
|
||||||
flags & ~STANDARD_NOT_MANDATORY_VERIFY_FLAGS, 0);
|
flags & ~STANDARD_NOT_MANDATORY_VERIFY_FLAGS);
|
||||||
if (check())
|
if (check())
|
||||||
return state.Invalid(false, REJECT_NONSTANDARD, "non-mandatory-script-verify-flag");
|
return state.Invalid(false, REJECT_NONSTANDARD, "non-mandatory-script-verify-flag");
|
||||||
}
|
}
|
||||||
|
|
|
@ -340,13 +340,12 @@ private:
|
||||||
const CTransaction *ptxTo;
|
const CTransaction *ptxTo;
|
||||||
unsigned int nIn;
|
unsigned int nIn;
|
||||||
unsigned int nFlags;
|
unsigned int nFlags;
|
||||||
int nHashType;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CScriptCheck(): ptxTo(0), nIn(0), nFlags(0), nHashType(0) {}
|
CScriptCheck(): ptxTo(0), nIn(0), nFlags(0) {}
|
||||||
CScriptCheck(const CCoins& txFromIn, const CTransaction& txToIn, unsigned int nInIn, unsigned int nFlagsIn, int nHashTypeIn) :
|
CScriptCheck(const CCoins& txFromIn, const CTransaction& txToIn, unsigned int nInIn, unsigned int nFlagsIn) :
|
||||||
scriptPubKey(txFromIn.vout[txToIn.vin[nInIn].prevout.n].scriptPubKey),
|
scriptPubKey(txFromIn.vout[txToIn.vin[nInIn].prevout.n].scriptPubKey),
|
||||||
ptxTo(&txToIn), nIn(nInIn), nFlags(nFlagsIn), nHashType(nHashTypeIn) { }
|
ptxTo(&txToIn), nIn(nInIn), nFlags(nFlagsIn) { }
|
||||||
|
|
||||||
bool operator()() const;
|
bool operator()() const;
|
||||||
|
|
||||||
|
@ -355,7 +354,6 @@ public:
|
||||||
std::swap(ptxTo, check.ptxTo);
|
std::swap(ptxTo, check.ptxTo);
|
||||||
std::swap(nIn, check.nIn);
|
std::swap(nIn, check.nIn);
|
||||||
std::swap(nFlags, check.nFlags);
|
std::swap(nFlags, check.nFlags);
|
||||||
std::swap(nHashType, check.nHashType);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -113,7 +113,7 @@ BOOST_AUTO_TEST_CASE(sign)
|
||||||
{
|
{
|
||||||
CScript sigSave = txTo[i].vin[0].scriptSig;
|
CScript sigSave = txTo[i].vin[0].scriptSig;
|
||||||
txTo[i].vin[0].scriptSig = txTo[j].vin[0].scriptSig;
|
txTo[i].vin[0].scriptSig = txTo[j].vin[0].scriptSig;
|
||||||
bool sigOK = CScriptCheck(CCoins(txFrom, 0), txTo[i], 0, SCRIPT_VERIFY_P2SH | SCRIPT_VERIFY_STRICTENC, 0)();
|
bool sigOK = CScriptCheck(CCoins(txFrom, 0), txTo[i], 0, SCRIPT_VERIFY_P2SH | SCRIPT_VERIFY_STRICTENC)();
|
||||||
if (i == j)
|
if (i == j)
|
||||||
BOOST_CHECK_MESSAGE(sigOK, strprintf("VerifySignature %d %d", i, j));
|
BOOST_CHECK_MESSAGE(sigOK, strprintf("VerifySignature %d %d", i, j));
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in a new issue