Drop IsNormalPaymentScript, use IsPayToPublicKeyHash (#1761)

This commit is contained in:
UdjinM6 2017-12-07 04:33:51 +03:00 committed by GitHub
parent 442325b072
commit c5ec2f82a8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 9 additions and 34 deletions

View File

@ -541,7 +541,7 @@ bool CGovernanceObject::IsCollateralValid(std::string& strError, bool& fMissingC
<< ", o.nValue = " << o.nValue
<< ", o.scriptPubKey = " << ScriptToAsmStr( o.scriptPubKey, false )
<< endl; );
if(!o.scriptPubKey.IsNormalPaymentScript() && !o.scriptPubKey.IsUnspendable()){
if(!o.scriptPubKey.IsPayToPublicKeyHash() && !o.scriptPubKey.IsUnspendable()) {
strError = strprintf("Invalid Script %s", txCollateral.ToString());
LogPrintf ("CGovernanceObject::IsCollateralValid -- %s\n", strError);
return false;

View File

@ -946,7 +946,7 @@ bool CTxLockRequest::IsValid() const
BOOST_FOREACH(const CTxOut& txout, vout) {
// InstantSend supports normal scripts and unspendable (i.e. data) scripts.
// TODO: Look into other script types that are normal and can be included
if(!txout.scriptPubKey.IsNormalPaymentScript() && !txout.scriptPubKey.IsUnspendable()) {
if(!txout.scriptPubKey.IsPayToPublicKeyHash() && !txout.scriptPubKey.IsUnspendable()) {
LogPrint("instantsend", "CTxLockRequest::IsValid -- Invalid Script %s", ToString());
return false;
}

View File

@ -182,7 +182,7 @@ void CPrivateSendServer::ProcessMessage(CNode* pfrom, std::string& strCommand, C
PushStatus(pfrom, STATUS_REJECTED, ERR_NON_STANDARD_PUBKEY, connman);
return;
}
if(!txout.scriptPubKey.IsNormalPaymentScript()) {
if(!txout.scriptPubKey.IsPayToPublicKeyHash()) {
LogPrintf("DSVIN -- invalid script! scriptPubKey=%s\n", ScriptToAsmStr(txout.scriptPubKey));
PushStatus(pfrom, STATUS_REJECTED, ERR_INVALID_SCRIPT, connman);
return;

View File

@ -187,7 +187,7 @@ bool CPrivateSend::IsCollateralValid(const CTransaction& txCollateral)
BOOST_FOREACH(const CTxOut txout, txCollateral.vout) {
nValueOut += txout.nValue;
if(!txout.scriptPubKey.IsNormalPaymentScript()) {
if(!txout.scriptPubKey.IsPayToPublicKeyHash()) {
LogPrintf ("CPrivateSend::IsCollateralValid -- Invalid Script, txCollateral=%s", txCollateral.ToString());
return false;
}

View File

@ -200,30 +200,6 @@ unsigned int CScript::GetSigOpCount(const CScript& scriptSig) const
return subscript.GetSigOpCount(true);
}
bool CScript::IsNormalPaymentScript() const
{
if(this->size() != 25) return false;
std::string str;
opcodetype opcode;
const_iterator pc = begin();
int i = 0;
while (pc < end())
{
GetOp(pc, opcode);
if( i == 0 && opcode != OP_DUP) return false;
else if(i == 1 && opcode != OP_HASH160) return false;
else if(i == 3 && opcode != OP_EQUALVERIFY) return false;
else if(i == 4 && opcode != OP_CHECKSIG) return false;
else if(i == 5) return false;
i++;
}
return true;
}
bool CScript::IsPayToPublicKeyHash() const
{
// Extra-fast test for pay-to-pubkey-hash CScripts:

View File

@ -620,7 +620,6 @@ public:
*/
unsigned int GetSigOpCount(const CScript& scriptSig) const;
bool IsNormalPaymentScript() const;
bool IsPayToPublicKeyHash() const;
bool IsPayToScriptHash() const;