Add CScript::IsPayToPubkeyHash convienience function

This commit is contained in:
Gregory Sanders 2018-12-17 09:36:05 -05:00
parent 43424cbf71
commit 8c7746c4de
2 changed files with 11 additions and 0 deletions

View file

@ -234,6 +234,16 @@ bool CScript::IsPegoutScript(const uint256& genesis_hash_check) const
return false;
}
bool CScript::IsPayToPubkeyHash() const
{
// Extra-fast test for pay-to-pubkey-hash CScripts:
return (this->size() == 25 &&
(*this)[0] == OP_DUP &&
(*this)[1] == OP_HASH160 &&
(*this)[2] == 0x14 &&
(*this)[23] == OP_EQUALVERIFY &&
(*this)[24] == OP_CHECKSIG);
}
// END ELEMENTS
//