Skip to content

Commit bd2fed3

Browse files
authored
Update script.h
1 parent a76470f commit bd2fed3

File tree

1 file changed

+12
-19
lines changed

1 file changed

+12
-19
lines changed

src/script.h

+12-19
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
// Copyright (c) 2009-2022 Satoshi Nakamoto
2-
// Copyright (c) 2009-2022 The Bitcoin developers
1+
// Copyright (c) 2009-2024 Satoshi Nakamoto
2+
// Copyright (c) 2009-2024 The Bitcoin developers
3+
// Copyright (c) 2009-2024 The Litedoge developers
34
// Distributed under the MIT/X11 software license, see the accompanying
45
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
56

@@ -22,6 +23,7 @@
2223

2324
typedef std::vector<unsigned char> valtype;
2425

26+
class CCoins;
2527
class CTransaction;
2628

2729
static const unsigned int MAX_SCRIPT_ELEMENT_SIZE = 520; // bytes
@@ -40,8 +42,10 @@ enum
4042
enum
4143
{
4244
SCRIPT_VERIFY_NONE = 0,
43-
SCRIPT_VERIFY_NOCACHE = (1U << 0), // do not store results in signature cache (but do query it)
45+
SCRIPT_VERIFY_P2SH = (1U << 0),
46+
SCRIPT_VERIFY_NOCACHE = (1U << 1), // do not store results in signature cache (but do query it)
4447
SCRIPT_VERIFY_NULLDUMMY = (1U << 1), // verify dummy stack item consumed by CHECKMULTISIG is of zero-length
48+
};
4549

4650
// Discourage use of NOPs reserved for upgrades (NOP1-10)
4751
//
@@ -458,32 +462,20 @@ class CScriptNum
458462
class CScript : public std::vector<unsigned char>
459463
{
460464
protected:
461-
CScript& push_int64(int64_t n)
465+
CScript& push_int64(int64_t n)
462466
{
463467
if (n == -1 || (n >= 1 && n <= 16))
464468
{
465469
push_back(n + (OP_1 - 1));
466470
}
467-
else
468-
{
469-
*this << CScriptNum::serialize(n);
470-
}
471-
return *this;
472-
}
473-
474-
CScript& push_uint64(uint64_t n)
475-
{
476-
if (n >= 1 && n <= 16)
471+
else if (n == 0)
477472
{
478-
push_back(n + (OP_1 - 1));
473+
push_back(OP_0);
479474
}
480475
else
481476
{
482-
*this << CScriptNum::serialize(n);
477+
*this << CScriptNum::serialize(n);
483478
}
484-
return *this;
485-
}
486-
487479
public:
488480
CScript() { }
489481
CScript(const CScript& b) : std::vector<unsigned char>(b.begin(), b.end()) { }
@@ -535,6 +527,7 @@ class CScript : public std::vector<unsigned char>
535527
CScript& operator<<(unsigned short b) { return push_uint64(b); }
536528
CScript& operator<<(unsigned long b) { return push_uint64(b); }
537529
CScript& operator<<(unsigned long long b) { return push_uint64(b); }
530+
CScript& operator<<(uint64 b) { return push_uint64(b); }
538531

539532
CScript& operator<<(opcodetype opcode)
540533
{

0 commit comments

Comments
 (0)