mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-17 13:07:54 +02:00
Add CScript::PushWithdraw function
This commit is contained in:
parent
8c121ccd5c
commit
3e5d2fe86a
2 changed files with 17 additions and 0 deletions
|
|
@ -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:
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue