Skip to content

Commit 71acfb3

Browse files
committed
Add IsPayToWitnessPubkeyHash convenience function
1 parent 1241343 commit 71acfb3

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

src/script/script.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,13 @@ bool CScript::IsPayToPubkeyHash() const
244244
(*this)[23] == OP_EQUALVERIFY &&
245245
(*this)[24] == OP_CHECKSIG);
246246
}
247+
bool CScript::IsPayToWitnessPubkeyHash() const
248+
{
249+
return (this->size() == 22 &&
250+
(*this)[0] == 0x00 &&
251+
(*this)[1] == 0x14);
252+
}
253+
247254
// END ELEMENTS
248255
//
249256

src/script/script.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -538,6 +538,7 @@ class CScript : public CScriptBase
538538
unsigned int GetSigOpCount(const CScript& scriptSig) const;
539539

540540
bool IsPayToPubkeyHash() const;
541+
bool IsPayToWitnessPubkeyHash() const;
541542
bool IsPayToScriptHash() const;
542543
bool IsPayToWitnessScriptHash() const;
543544
bool IsWitnessProgram(int& version, std::vector<unsigned char>& program) const;

0 commit comments

Comments
 (0)