diff --git a/src/script/script.cpp b/src/script/script.cpp index 3392615084..6c141e26ad 100644 --- a/src/script/script.cpp +++ b/src/script/script.cpp @@ -336,6 +336,20 @@ COutPoint CScript::GetWithdrawSpent() const } } +void CScript::PushWithdraw(const vector push) { + int64_t pushCount = 0; + for (vector::const_iterator it = push.begin(); it < push.end(); pushCount++) { + if (push.end() - it < 520) { + *this << vector(it, push.end()); + it = push.end(); + } else { + *this << vector(it, it + 520); + it += 520; + } + } + *this << pushCount; +} + bool CScript::IsPayToScriptHash() const { // Extra-fast test for pay-to-script-hash CScripts: diff --git a/src/script/script.h b/src/script/script.h index 087ac4ea4f..1d2046b6d7 100644 --- a/src/script/script.h +++ b/src/script/script.h @@ -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 push); + /** Get the withdraw output spent, asserting IsWithdrawProof first */ COutPoint GetWithdrawSpent() const;