Add CScript::IsWithdrawLock() (which is standard)

This commit is contained in:
Matt Corallo 2016-01-18 20:35:04 -08:00 committed by Gregory Sanders
parent 6be3888987
commit cf5d16755d
4 changed files with 169 additions and 13 deletions

View file

@ -29,6 +29,8 @@ static const int MAX_PUBKEYS_PER_MULTISIG = 20;
// Maximum script length in bytes
static const int MAX_SCRIPT_SIZE = 10000;
class uint256;
class COutPoint;
// Threshold for nLockTime: below this value it is interpreted as block number,
// otherwise as UNIX timestamp.
@ -170,6 +172,7 @@ enum opcodetype
OP_CHECKSEQUENCEVERIFY = 0xb2,
OP_NOP3 = OP_CHECKSEQUENCEVERIFY,
OP_NOP4 = 0xb3,
OP_WITHDRAWPROOFVERIFY = OP_NOP4,
OP_NOP5 = 0xb4,
OP_NOP6 = 0xb5,
OP_NOP7 = 0xb6,
@ -623,6 +626,21 @@ public:
bool IsPayToScriptHash() const;
bool IsPayToWitnessScriptHash() const;
bool IsWitnessProgram(int& version, std::vector<unsigned char>& program) const;
/**
* Returns true if this is a withdraw-lock scriptPubKey.
* Note that a withdraw-lock could be a plan [re-]lock output *or* a
* x-chain transfer lock.
*/
bool IsWithdrawLock() const;
/** Returns true if this is a proof-of-withdraw, spending an IsWithdrawLock */
bool IsWithdrawProof() const;
/** Get the withdraw output spent, asserting IsWithdrawProof first */
COutPoint GetWithdrawSpent() const;
/** Get the genesis hash locked to, asserting IsWithdrawLock first */
uint256 GetWithdrawLockGenesisHash() const;
/** Called by IsStandardTx and P2SH/BIP62 VerifyScript (which makes it consensus-critical). */
bool IsPushOnly(const_iterator pc) const;