Prevector type
This commit is contained in:
committed by
Jack Grigg
parent
690d38f0f8
commit
29a8ade782
@@ -999,7 +999,7 @@ public:
|
||||
assert(nInput != NOT_AN_INPUT);
|
||||
if (nInput != nIn)
|
||||
// Blank out other inputs' signatures
|
||||
::Serialize(s, CScript(), nType, nVersion);
|
||||
::Serialize(s, CScriptBase(), nType, nVersion);
|
||||
else
|
||||
SerializeScriptCode(s, nType, nVersion);
|
||||
// Serialize the nSequence
|
||||
|
||||
@@ -205,9 +205,9 @@ bool CScript::IsPayToScriptHash() const
|
||||
{
|
||||
// Extra-fast test for pay-to-script-hash CScripts:
|
||||
return (this->size() == 23 &&
|
||||
this->at(0) == OP_HASH160 &&
|
||||
this->at(1) == 0x14 &&
|
||||
this->at(22) == OP_EQUAL);
|
||||
(*this)[0] == OP_HASH160 &&
|
||||
(*this)[1] == 0x14 &&
|
||||
(*this)[22] == OP_EQUAL);
|
||||
}
|
||||
|
||||
bool CScript::IsPushOnly() const
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#define BITCOIN_SCRIPT_SCRIPT_H
|
||||
|
||||
#include "crypto/common.h"
|
||||
#include "prevector.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <climits>
|
||||
@@ -351,8 +352,10 @@ private:
|
||||
int64_t m_value;
|
||||
};
|
||||
|
||||
typedef prevector<28, unsigned char> CScriptBase;
|
||||
|
||||
/** Serialized script, used inside transaction inputs and outputs */
|
||||
class CScript : public std::vector<unsigned char>
|
||||
class CScript : public CScriptBase
|
||||
{
|
||||
protected:
|
||||
CScript& push_int64(int64_t n)
|
||||
@@ -373,9 +376,10 @@ protected:
|
||||
}
|
||||
public:
|
||||
CScript() { }
|
||||
CScript(const CScript& b) : std::vector<unsigned char>(b.begin(), b.end()) { }
|
||||
CScript(const_iterator pbegin, const_iterator pend) : std::vector<unsigned char>(pbegin, pend) { }
|
||||
CScript(const unsigned char* pbegin, const unsigned char* pend) : std::vector<unsigned char>(pbegin, pend) { }
|
||||
CScript(const CScript& b) : CScriptBase(b.begin(), b.end()) { }
|
||||
CScript(const_iterator pbegin, const_iterator pend) : CScriptBase(pbegin, pend) { }
|
||||
CScript(std::vector<unsigned char>::const_iterator pbegin, std::vector<unsigned char>::const_iterator pend) : CScriptBase(pbegin, pend) { }
|
||||
CScript(const unsigned char* pbegin, const unsigned char* pend) : CScriptBase(pbegin, pend) { }
|
||||
|
||||
CScript& operator+=(const CScript& b)
|
||||
{
|
||||
@@ -579,7 +583,7 @@ public:
|
||||
void clear()
|
||||
{
|
||||
// The default std::vector::clear() does not release memory.
|
||||
std::vector<unsigned char>().swap(*this);
|
||||
CScriptBase().swap(*this);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
|
||||
using namespace std;
|
||||
|
||||
typedef vector<unsigned char> valtype;
|
||||
typedef std::vector<unsigned char> valtype;
|
||||
|
||||
TransactionSignatureCreator::TransactionSignatureCreator(const CKeyStore* keystoreIn, const CTransaction* txToIn, unsigned int nInIn, const CAmount& amountIn, int nHashTypeIn) : BaseSignatureCreator(keystoreIn), txTo(txToIn), nIn(nInIn), nHashType(nHashTypeIn), amount(amountIn), checker(txTo, nIn, amountIn) {}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user