Add CScript::PushWithdraw function

This commit is contained in:
Matt Corallo 2016-02-21 17:52:08 +08:00 committed by Gregory Sanders
parent 8c121ccd5c
commit 3e5d2fe86a
2 changed files with 17 additions and 0 deletions

View file

@ -336,6 +336,20 @@ COutPoint CScript::GetWithdrawSpent() const
}
}
void CScript::PushWithdraw(const vector<unsigned char> push) {
int64_t pushCount = 0;
for (vector<unsigned char>::const_iterator it = push.begin(); it < push.end(); pushCount++) {
if (push.end() - it < 520) {
*this << vector<unsigned char>(it, push.end());
it = push.end();
} else {
*this << vector<unsigned char>(it, it + 520);
it += 520;
}
}
*this << pushCount;
}
bool CScript::IsPayToScriptHash() const
{
// Extra-fast test for pay-to-script-hash CScripts:

View file

@ -635,6 +635,9 @@ public:
/** Returns true if this is a proof-of-withdraw, spending an IsWithdrawLock */
bool IsWithdrawProof() const;
//! Push a vector with a length postfix (as used by withdraw proofs)
void PushWithdraw(const std::vector<unsigned char> push);
/** Get the withdraw output spent, asserting IsWithdrawProof first */
COutPoint GetWithdrawSpent() const;