BSHA3  0.17.99
P2P Blockchain, based on Bitcoin
script.h
Go to the documentation of this file.
1 // Copyright (c) 2009-2010 Satoshi Nakamoto
2 // Copyright (c) 2009-2018 The Bitcoin Core developers
3 // Distributed under the MIT software license, see the accompanying
4 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
5 
6 #ifndef BITCOIN_SCRIPT_SCRIPT_H
7 #define BITCOIN_SCRIPT_SCRIPT_H
8 
9 #include <crypto/common.h>
10 #include <prevector.h>
11 #include <serialize.h>
12 
13 #include <assert.h>
14 #include <climits>
15 #include <limits>
16 #include <stdexcept>
17 #include <stdint.h>
18 #include <string.h>
19 #include <string>
20 #include <vector>
21 
22 // Maximum number of bytes pushable to the stack
23 static const unsigned int MAX_SCRIPT_ELEMENT_SIZE = 520;
24 
25 // Maximum number of non-push operations per script
26 static const int MAX_OPS_PER_SCRIPT = 201;
27 
28 // Maximum number of public keys per multisig
29 static const int MAX_PUBKEYS_PER_MULTISIG = 20;
30 
31 // Maximum script length in bytes
32 static const int MAX_SCRIPT_SIZE = 10000;
33 
34 // Maximum number of values on script interpreter stack
35 static const int MAX_STACK_SIZE = 1000;
36 
37 // Threshold for nLockTime: below this value it is interpreted as block number,
38 // otherwise as UNIX timestamp.
39 static const unsigned int LOCKTIME_THRESHOLD = 500000000; // Tue Nov 5 00:53:20 1985 UTC
40 
41 template <typename T>
42 std::vector<unsigned char> ToByteVector(const T& in)
43 {
44  return std::vector<unsigned char>(in.begin(), in.end());
45 }
46 
49 {
50  // push value
51  OP_0 = 0x00,
53  OP_PUSHDATA1 = 0x4c,
54  OP_PUSHDATA2 = 0x4d,
55  OP_PUSHDATA4 = 0x4e,
56  OP_1NEGATE = 0x4f,
57  OP_RESERVED = 0x50,
58  OP_1 = 0x51,
60  OP_2 = 0x52,
61  OP_3 = 0x53,
62  OP_4 = 0x54,
63  OP_5 = 0x55,
64  OP_6 = 0x56,
65  OP_7 = 0x57,
66  OP_8 = 0x58,
67  OP_9 = 0x59,
68  OP_10 = 0x5a,
69  OP_11 = 0x5b,
70  OP_12 = 0x5c,
71  OP_13 = 0x5d,
72  OP_14 = 0x5e,
73  OP_15 = 0x5f,
74  OP_16 = 0x60,
75 
76  // control
77  OP_NOP = 0x61,
78  OP_VER = 0x62,
79  OP_IF = 0x63,
80  OP_NOTIF = 0x64,
81  OP_VERIF = 0x65,
82  OP_VERNOTIF = 0x66,
83  OP_ELSE = 0x67,
84  OP_ENDIF = 0x68,
85  OP_VERIFY = 0x69,
86  OP_RETURN = 0x6a,
87 
88  // stack ops
89  OP_TOALTSTACK = 0x6b,
91  OP_2DROP = 0x6d,
92  OP_2DUP = 0x6e,
93  OP_3DUP = 0x6f,
94  OP_2OVER = 0x70,
95  OP_2ROT = 0x71,
96  OP_2SWAP = 0x72,
97  OP_IFDUP = 0x73,
98  OP_DEPTH = 0x74,
99  OP_DROP = 0x75,
100  OP_DUP = 0x76,
101  OP_NIP = 0x77,
102  OP_OVER = 0x78,
103  OP_PICK = 0x79,
104  OP_ROLL = 0x7a,
105  OP_ROT = 0x7b,
106  OP_SWAP = 0x7c,
107  OP_TUCK = 0x7d,
108 
109  // splice ops
110  OP_CAT = 0x7e,
111  OP_SUBSTR = 0x7f,
112  OP_LEFT = 0x80,
113  OP_RIGHT = 0x81,
114  OP_SIZE = 0x82,
115 
116  // bit logic
117  OP_INVERT = 0x83,
118  OP_AND = 0x84,
119  OP_OR = 0x85,
120  OP_XOR = 0x86,
121  OP_EQUAL = 0x87,
123  OP_RESERVED1 = 0x89,
124  OP_RESERVED2 = 0x8a,
125 
126  // numeric
127  OP_1ADD = 0x8b,
128  OP_1SUB = 0x8c,
129  OP_2MUL = 0x8d,
130  OP_2DIV = 0x8e,
131  OP_NEGATE = 0x8f,
132  OP_ABS = 0x90,
133  OP_NOT = 0x91,
134  OP_0NOTEQUAL = 0x92,
135 
136  OP_ADD = 0x93,
137  OP_SUB = 0x94,
138  OP_MUL = 0x95,
139  OP_DIV = 0x96,
140  OP_MOD = 0x97,
141  OP_LSHIFT = 0x98,
142  OP_RSHIFT = 0x99,
143 
144  OP_BOOLAND = 0x9a,
145  OP_BOOLOR = 0x9b,
146  OP_NUMEQUAL = 0x9c,
149  OP_LESSTHAN = 0x9f,
153  OP_MIN = 0xa3,
154  OP_MAX = 0xa4,
155 
156  OP_WITHIN = 0xa5,
157 
158  // crypto
159  OP_RIPEMD160 = 0xa6,
160  OP_SHA3 = 0xa7, // Note: 0xa7 is OP_SHA1 in Bitcoin
161  OP_SHA256 = 0xa8,
162  OP_HASH360 = 0xa9, // Note: 0xa9 is OP_HASH160 in Bitcoin
163  OP_HASH3 = 0xaa, // Note: 0xaa is OP_HASH in Bitcoin
165  OP_CHECKSIG = 0xac,
169 
170  // expansion
171  OP_NOP1 = 0xb0,
176  OP_NOP4 = 0xb3,
177  OP_NOP5 = 0xb4,
178  OP_NOP6 = 0xb5,
179  OP_NOP7 = 0xb6,
180  OP_NOP8 = 0xb7,
181  OP_NOP9 = 0xb8,
182  OP_NOP10 = 0xb9,
183 
185 };
186 
187 // Maximum value that an opcode can be
188 static const unsigned int MAX_OPCODE = OP_NOP10;
189 
190 const char* GetOpName(opcodetype opcode);
191 
192 class scriptnum_error : public std::runtime_error
193 {
194 public:
195  explicit scriptnum_error(const std::string& str) : std::runtime_error(str) {}
196 };
197 
199 {
208 public:
209 
210  explicit CScriptNum(const int64_t& n)
211  {
212  m_value = n;
213  }
214 
215  static const size_t nDefaultMaxNumSize = 4;
216 
217  explicit CScriptNum(const std::vector<unsigned char>& vch, bool fRequireMinimal,
218  const size_t nMaxNumSize = nDefaultMaxNumSize)
219  {
220  if (vch.size() > nMaxNumSize) {
221  throw scriptnum_error("script number overflow");
222  }
223  if (fRequireMinimal && vch.size() > 0) {
224  // Check that the number is encoded with the minimum possible
225  // number of bytes.
226  //
227  // If the most-significant-byte - excluding the sign bit - is zero
228  // then we're not minimal. Note how this test also rejects the
229  // negative-zero encoding, 0x80.
230  if ((vch.back() & 0x7f) == 0) {
231  // One exception: if there's more than one byte and the most
232  // significant bit of the second-most-significant-byte is set
233  // it would conflict with the sign bit. An example of this case
234  // is +-255, which encode to 0xff00 and 0xff80 respectively.
235  // (big-endian).
236  if (vch.size() <= 1 || (vch[vch.size() - 2] & 0x80) == 0) {
237  throw scriptnum_error("non-minimally encoded script number");
238  }
239  }
240  }
241  m_value = set_vch(vch);
242  }
243 
244  inline bool operator==(const int64_t& rhs) const { return m_value == rhs; }
245  inline bool operator!=(const int64_t& rhs) const { return m_value != rhs; }
246  inline bool operator<=(const int64_t& rhs) const { return m_value <= rhs; }
247  inline bool operator< (const int64_t& rhs) const { return m_value < rhs; }
248  inline bool operator>=(const int64_t& rhs) const { return m_value >= rhs; }
249  inline bool operator> (const int64_t& rhs) const { return m_value > rhs; }
250 
251  inline bool operator==(const CScriptNum& rhs) const { return operator==(rhs.m_value); }
252  inline bool operator!=(const CScriptNum& rhs) const { return operator!=(rhs.m_value); }
253  inline bool operator<=(const CScriptNum& rhs) const { return operator<=(rhs.m_value); }
254  inline bool operator< (const CScriptNum& rhs) const { return operator< (rhs.m_value); }
255  inline bool operator>=(const CScriptNum& rhs) const { return operator>=(rhs.m_value); }
256  inline bool operator> (const CScriptNum& rhs) const { return operator> (rhs.m_value); }
257 
258  inline CScriptNum operator+( const int64_t& rhs) const { return CScriptNum(m_value + rhs);}
259  inline CScriptNum operator-( const int64_t& rhs) const { return CScriptNum(m_value - rhs);}
260  inline CScriptNum operator+( const CScriptNum& rhs) const { return operator+(rhs.m_value); }
261  inline CScriptNum operator-( const CScriptNum& rhs) const { return operator-(rhs.m_value); }
262 
263  inline CScriptNum& operator+=( const CScriptNum& rhs) { return operator+=(rhs.m_value); }
264  inline CScriptNum& operator-=( const CScriptNum& rhs) { return operator-=(rhs.m_value); }
265 
266  inline CScriptNum operator&( const int64_t& rhs) const { return CScriptNum(m_value & rhs);}
267  inline CScriptNum operator&( const CScriptNum& rhs) const { return operator&(rhs.m_value); }
268 
269  inline CScriptNum& operator&=( const CScriptNum& rhs) { return operator&=(rhs.m_value); }
270 
271  inline CScriptNum operator-() const
272  {
273  assert(m_value != std::numeric_limits<int64_t>::min());
274  return CScriptNum(-m_value);
275  }
276 
277  inline CScriptNum& operator=( const int64_t& rhs)
278  {
279  m_value = rhs;
280  return *this;
281  }
282 
283  inline CScriptNum& operator+=( const int64_t& rhs)
284  {
285  assert(rhs == 0 || (rhs > 0 && m_value <= std::numeric_limits<int64_t>::max() - rhs) ||
286  (rhs < 0 && m_value >= std::numeric_limits<int64_t>::min() - rhs));
287  m_value += rhs;
288  return *this;
289  }
290 
291  inline CScriptNum& operator-=( const int64_t& rhs)
292  {
293  assert(rhs == 0 || (rhs > 0 && m_value >= std::numeric_limits<int64_t>::min() + rhs) ||
294  (rhs < 0 && m_value <= std::numeric_limits<int64_t>::max() + rhs));
295  m_value -= rhs;
296  return *this;
297  }
298 
299  inline CScriptNum& operator&=( const int64_t& rhs)
300  {
301  m_value &= rhs;
302  return *this;
303  }
304 
305  int getint() const
306  {
307  if (m_value > std::numeric_limits<int>::max())
308  return std::numeric_limits<int>::max();
309  else if (m_value < std::numeric_limits<int>::min())
310  return std::numeric_limits<int>::min();
311  return m_value;
312  }
313 
314  std::vector<unsigned char> getvch() const
315  {
316  return serialize(m_value);
317  }
318 
319  static std::vector<unsigned char> serialize(const int64_t& value)
320  {
321  if(value == 0)
322  return std::vector<unsigned char>();
323 
324  std::vector<unsigned char> result;
325  const bool neg = value < 0;
326  uint64_t absvalue = neg ? -value : value;
327 
328  while(absvalue)
329  {
330  result.push_back(absvalue & 0xff);
331  absvalue >>= 8;
332  }
333 
334 // - If the most significant byte is >= 0x80 and the value is positive, push a
335 // new zero-byte to make the significant byte < 0x80 again.
336 
337 // - If the most significant byte is >= 0x80 and the value is negative, push a
338 // new 0x80 byte that will be popped off when converting to an integral.
339 
340 // - If the most significant byte is < 0x80 and the value is negative, add
341 // 0x80 to it, since it will be subtracted and interpreted as a negative when
342 // converting to an integral.
343 
344  if (result.back() & 0x80)
345  result.push_back(neg ? 0x80 : 0);
346  else if (neg)
347  result.back() |= 0x80;
348 
349  return result;
350  }
351 
352 private:
353  static int64_t set_vch(const std::vector<unsigned char>& vch)
354  {
355  if (vch.empty())
356  return 0;
357 
358  int64_t result = 0;
359  for (size_t i = 0; i != vch.size(); ++i)
360  result |= static_cast<int64_t>(vch[i]) << 8*i;
361 
362  // If the input vector's most significant byte is 0x80, remove it from
363  // the result's msb and return a negative.
364  if (vch.back() & 0x80)
365  return -((int64_t)(result & ~(0x80ULL << (8 * (vch.size() - 1)))));
366 
367  return result;
368  }
369 
370  int64_t m_value;
371 };
372 
380 
381 bool GetScriptOp(CScriptBase::const_iterator& pc, CScriptBase::const_iterator end, opcodetype& opcodeRet, std::vector<unsigned char>* pvchRet);
382 
384 class CScript : public CScriptBase
385 {
386 protected:
387  CScript& push_int64(int64_t n)
388  {
389  if (n == -1 || (n >= 1 && n <= 16))
390  {
391  push_back(n + (OP_1 - 1));
392  }
393  else if (n == 0)
394  {
395  push_back(OP_0);
396  }
397  else
398  {
399  *this << CScriptNum::serialize(n);
400  }
401  return *this;
402  }
403 public:
404  CScript() { }
405  CScript(const_iterator pbegin, const_iterator pend) : CScriptBase(pbegin, pend) { }
406  CScript(std::vector<unsigned char>::const_iterator pbegin, std::vector<unsigned char>::const_iterator pend) : CScriptBase(pbegin, pend) { }
407  CScript(const unsigned char* pbegin, const unsigned char* pend) : CScriptBase(pbegin, pend) { }
408 
410 
411  template <typename Stream, typename Operation>
412  inline void SerializationOp(Stream& s, Operation ser_action) {
413  READWRITEAS(CScriptBase, *this);
414  }
415 
417  {
418  reserve(size() + b.size());
419  insert(end(), b.begin(), b.end());
420  return *this;
421  }
422 
423  friend CScript operator+(const CScript& a, const CScript& b)
424  {
425  CScript ret = a;
426  ret += b;
427  return ret;
428  }
429 
430  CScript(int64_t b) { operator<<(b); }
431 
432  explicit CScript(opcodetype b) { operator<<(b); }
433  explicit CScript(const CScriptNum& b) { operator<<(b); }
434  explicit CScript(const std::vector<unsigned char>& b) { operator<<(b); }
435 
436 
437  CScript& operator<<(int64_t b) { return push_int64(b); }
438 
440  {
441  if (opcode < 0 || opcode > 0xff)
442  throw std::runtime_error("CScript::operator<<(): invalid opcode");
443  insert(end(), (unsigned char)opcode);
444  return *this;
445  }
446 
448  {
449  *this << b.getvch();
450  return *this;
451  }
452 
453  CScript& operator<<(const std::vector<unsigned char>& b)
454  {
455  if (b.size() < OP_PUSHDATA1)
456  {
457  insert(end(), (unsigned char)b.size());
458  }
459  else if (b.size() <= 0xff)
460  {
461  insert(end(), OP_PUSHDATA1);
462  insert(end(), (unsigned char)b.size());
463  }
464  else if (b.size() <= 0xffff)
465  {
466  insert(end(), OP_PUSHDATA2);
467  uint8_t _data[2];
468  WriteLE16(_data, b.size());
469  insert(end(), _data, _data + sizeof(_data));
470  }
471  else
472  {
473  insert(end(), OP_PUSHDATA4);
474  uint8_t _data[4];
475  WriteLE32(_data, b.size());
476  insert(end(), _data, _data + sizeof(_data));
477  }
478  insert(end(), b.begin(), b.end());
479  return *this;
480  }
481 
483  {
484  // I'm not sure if this should push the script or concatenate scripts.
485  // If there's ever a use for pushing a script onto a script, delete this member fn
486  assert(!"Warning: Pushing a CScript onto a CScript with << is probably not intended, use + to concatenate!");
487  return *this;
488  }
489 
490 
491  bool GetOp(const_iterator& pc, opcodetype& opcodeRet, std::vector<unsigned char>& vchRet) const
492  {
493  return GetScriptOp(pc, end(), opcodeRet, &vchRet);
494  }
495 
496  bool GetOp(const_iterator& pc, opcodetype& opcodeRet) const
497  {
498  return GetScriptOp(pc, end(), opcodeRet, nullptr);
499  }
500 
501 
503  static int DecodeOP_N(opcodetype opcode)
504  {
505  if (opcode == OP_0)
506  return 0;
507  assert(opcode >= OP_1 && opcode <= OP_16);
508  return (int)opcode - (int)(OP_1 - 1);
509  }
510  static opcodetype EncodeOP_N(int n)
511  {
512  assert(n >= 0 && n <= 16);
513  if (n == 0)
514  return OP_0;
515  return (opcodetype)(OP_1+n-1);
516  }
517 
525  unsigned int GetSigOpCount(bool fAccurate) const;
526 
531  unsigned int GetSigOpCount(const CScript& scriptSig) const;
532 
533  bool IsPayToScriptHash() const;
534  bool IsPayToWitnessScriptHash() const;
535  bool IsWitnessProgram(int& version, std::vector<unsigned char>& program) const;
536 
538  bool IsPushOnly(const_iterator pc) const;
539  bool IsPushOnly() const;
540 
542  bool HasValidOps() const;
543 
549  bool IsUnspendable() const
550  {
551  return (size() > 0 && *begin() == OP_RETURN) || (size() > MAX_SCRIPT_SIZE);
552  }
553 
554  void clear()
555  {
556  // The default prevector::clear() does not release memory
558  shrink_to_fit();
559  }
560 };
561 
563 {
564  // Note that this encodes the data elements being pushed, rather than
565  // encoding them as a CScript that pushes them.
566  std::vector<std::vector<unsigned char> > stack;
567 
568  // Some compilers complain without a default constructor
570 
571  bool IsNull() const { return stack.empty(); }
572 
573  void SetNull() { stack.clear(); stack.shrink_to_fit(); }
574 
575  std::string ToString() const;
576 };
577 
579 {
580 public:
582  virtual void KeepScript() {}
584  virtual ~CReserveScript() {}
585 };
586 
587 #endif // BITCOIN_SCRIPT_SCRIPT_H
Definition: script.h:133
Definition: script.h:62
Definition: script.h:118
unsigned int GetSigOpCount(bool fAccurate) const
Pre-version-0.6, Bitcoin always counted CHECKMULTISIGs as 20 sigops.
Definition: script.cpp:149
static int64_t set_vch(const std::vector< unsigned char > &vch)
Definition: script.h:353
ADD_SERIALIZE_METHODS
Definition: script.h:409
Definition: script.h:101
static int DecodeOP_N(opcodetype opcode)
Encode/decode small integers:
Definition: script.h:503
int getint() const
Definition: script.h:305
Definition: script.h:154
void shrink_to_fit()
Definition: prevector.h:350
Definition: script.h:93
iterator insert(iterator pos, const T &value)
Definition: prevector.h:358
void clear()
Definition: prevector.h:354
bool GetOp(const_iterator &pc, opcodetype &opcodeRet, std::vector< unsigned char > &vchRet) const
Definition: script.h:491
bool operator<(const int64_t &rhs) const
Definition: script.h:247
virtual ~CReserveScript()
Definition: script.h:584
CScriptNum(const int64_t &n)
Numeric opcodes (OP_1ADD, etc) are restricted to operating on 4-byte integers.
Definition: script.h:210
bool IsPayToScriptHash() const
Definition: script.cpp:197
Definition: script.h:79
Definition: script.h:72
Definition: script.h:68
Definition: script.h:95
CScriptNum & operator-=(const int64_t &rhs)
Definition: script.h:291
UniValue ret(UniValue::VARR)
Definition: rpcwallet.cpp:1140
Definition: script.h:132
Definition: script.h:60
Definition: script.h:139
Definition: script.h:66
CScriptNum operator &(const int64_t &rhs) const
Definition: script.h:266
Definition: script.h:61
bool IsPushOnly() const
Definition: script.cpp:249
CScript & push_int64(int64_t n)
Definition: script.h:387
std::vector< std::vector< unsigned char > > stack
Definition: script.h:566
bool HasValidOps() const
Check if the script contains valid OP_CODES.
Definition: script.cpp:266
bool IsWitnessProgram(int &version, std::vector< unsigned char > &program) const
Definition: script.cpp:216
bool IsNull() const
Definition: script.h:571
Definition: script.h:153
friend CScript operator+(const CScript &a, const CScript &b)
Definition: script.h:423
bool operator<=(const int64_t &rhs) const
Definition: script.h:246
#define READWRITEAS(type, obj)
Definition: serialize.h:174
CScriptNum & operator=(const int64_t &rhs)
Definition: script.h:277
CScript(const std::vector< unsigned char > &b)
Definition: script.h:434
Definition: script.h:74
static std::vector< unsigned char > serialize(const int64_t &value)
Definition: script.h:319
Definition: script.h:70
const char * GetOpName(opcodetype opcode)
Definition: script.cpp:11
CScript(opcodetype b)
Definition: script.h:432
Definition: script.h:119
CScriptNum & operator+=(const CScriptNum &rhs)
Definition: script.h:263
bool IsUnspendable() const
Returns whether the script is guaranteed to fail at execution, regardless of the initial stack...
Definition: script.h:549
CScript & operator<<(const CScriptNum &b)
Definition: script.h:447
Definition: script.h:63
iterator end()
Definition: prevector.h:303
CScript & operator<<(opcodetype opcode)
Definition: script.h:439
CScript reserveScript
Definition: script.h:581
Definition: script.h:140
void push_back(const T &value)
Definition: prevector.h:423
opcodetype
Script opcodes.
Definition: script.h:48
CScript(const CScriptNum &b)
Definition: script.h:433
bool operator==(const CScriptNum &rhs) const
Definition: script.h:251
CScript & operator<<(const CScript &b)
Definition: script.h:482
Definition: script.h:110
CScriptNum operator+(const int64_t &rhs) const
Definition: script.h:258
static const size_t nDefaultMaxNumSize
Definition: script.h:215
bool operator!=(const int64_t &rhs) const
Definition: script.h:245
CScriptNum operator-() const
Definition: script.h:271
prevector< 28, unsigned char > CScriptBase
We use a prevector for the script to reduce the considerable memory overhead of vectors in cases wher...
Definition: script.h:379
CScript(int64_t b)
Definition: script.h:430
bool operator>=(const CScriptNum &rhs) const
Definition: script.h:255
CScriptNum operator+(const CScriptNum &rhs) const
Definition: script.h:260
Definition: script.h:65
CScript(const unsigned char *pbegin, const unsigned char *pend)
Definition: script.h:407
Definition: script.h:58
Definition: script.h:77
CScriptWitness()
Definition: script.h:569
std::vector< unsigned char > getvch() const
Definition: script.h:314
int64_t m_value
Definition: script.h:370
scriptnum_error(const std::string &str)
Definition: script.h:195
CScriptNum(const std::vector< unsigned char > &vch, bool fRequireMinimal, const size_t nMaxNumSize=nDefaultMaxNumSize)
Definition: script.h:217
auto end
Definition: rpcwallet.cpp:1068
CScript()
Definition: script.h:404
Definition: script.h:137
bool operator>(const int64_t &rhs) const
Definition: script.h:249
Definition: script.h:105
void SetNull()
Definition: script.h:573
CScriptNum & operator &=(const CScriptNum &rhs)
Definition: script.h:269
Definition: script.h:138
Definition: script.h:83
Implements a drop-in replacement for std::vector<T> which stores up to N elements directly (without h...
Definition: prevector.h:39
bool GetScriptOp(CScriptBase::const_iterator &pc, CScriptBase::const_iterator end, opcodetype &opcodeRet, std::vector< unsigned char > *pvchRet)
Definition: script.cpp:279
void reserve(size_type new_capacity)
Definition: prevector.h:344
CScriptNum & operator-=(const CScriptNum &rhs)
Definition: script.h:264
Definition: script.h:67
CScriptNum operator-(const CScriptNum &rhs) const
Definition: script.h:261
Definition: script.h:99
Definition: script.h:92
CScriptNum operator-(const int64_t &rhs) const
Definition: script.h:259
CScript(const_iterator pbegin, const_iterator pend)
Definition: script.h:405
static opcodetype EncodeOP_N(int n)
Definition: script.h:510
Serialized script, used inside transaction inputs and outputs.
Definition: script.h:384
CScript & operator+=(const CScript &b)
Definition: script.h:416
bool GetOp(const_iterator &pc, opcodetype &opcodeRet) const
Definition: script.h:496
Definition: script.h:64
CScript & operator<<(int64_t b)
Definition: script.h:437
virtual void KeepScript()
Definition: script.h:582
iterator begin()
Definition: prevector.h:301
CScriptNum & operator+=(const int64_t &rhs)
Definition: script.h:283
size_type size() const
Definition: prevector.h:293
Definition: script.h:71
Definition: script.h:120
Definition: script.h:69
void SerializationOp(Stream &s, Operation ser_action)
Definition: script.h:412
Definition: script.h:78
Definition: script.h:59
Definition: script.h:51
void clear()
Definition: script.h:554
std::string ToString() const
Definition: script.cpp:254
CScript(std::vector< unsigned char >::const_iterator pbegin, std::vector< unsigned char >::const_iterator pend)
Definition: script.h:406
CReserveScript()
Definition: script.h:583
Definition: script.h:136
bool operator==(const int64_t &rhs) const
Definition: script.h:244
bool operator>=(const int64_t &rhs) const
Definition: script.h:248
Definition: script.h:73
bool IsPayToWitnessScriptHash() const
Definition: script.cpp:206
Definition: script.h:100
bool operator!=(const CScriptNum &rhs) const
Definition: script.h:252
std::vector< unsigned char > ToByteVector(const T &in)
Definition: script.h:42
bool operator<=(const CScriptNum &rhs) const
Definition: script.h:253