Skip to content

Commit

Permalink
Add IsPushOnly(const_iterator pc)
Browse files Browse the repository at this point in the history
Allows IsPushOnly() to be applied to just part of the script for
OP_RETURN outputs.
  • Loading branch information
petertodd authored and jtimon committed Oct 1, 2015
1 parent 6a07eb6 commit 5d8709c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/script/script.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -210,9 +210,8 @@ bool CScript::IsPayToScriptHash() const
this->at(22) == OP_EQUAL);
}

bool CScript::IsPushOnly() const
bool CScript::IsPushOnly(const_iterator pc) const
{
const_iterator pc = begin();
while (pc < end())
{
opcodetype opcode;
Expand All @@ -227,3 +226,8 @@ bool CScript::IsPushOnly() const
}
return true;
}

bool CScript::IsPushOnly() const
{
return this->IsPushOnly(begin());
}
1 change: 1 addition & 0 deletions src/script/script.h
Original file line number Diff line number Diff line change
Expand Up @@ -589,6 +589,7 @@ class CScript : public std::vector<unsigned char>
bool IsPayToScriptHash() const;

/** Called by IsStandardTx and P2SH/BIP62 VerifyScript (which makes it consensus-critical). */
bool IsPushOnly(const_iterator pc) const;
bool IsPushOnly() const;

/**
Expand Down

0 comments on commit 5d8709c

Please sign in to comment.