Skip to content

Commit 757b7f4

Browse files
authored
Update script.h
1 parent bd2fed3 commit 757b7f4

File tree

1 file changed

+19
-7
lines changed

1 file changed

+19
-7
lines changed

src/script.h

+19-7
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323

2424
typedef std::vector<unsigned char> valtype;
2525

26-
class CCoins;
2726
class CTransaction;
2827

2928
static const unsigned int MAX_SCRIPT_ELEMENT_SIZE = 520; // bytes
@@ -42,8 +41,7 @@ enum
4241
enum
4342
{
4443
SCRIPT_VERIFY_NONE = 0,
45-
SCRIPT_VERIFY_P2SH = (1U << 0),
46-
SCRIPT_VERIFY_NOCACHE = (1U << 1), // do not store results in signature cache (but do query it)
44+
SCRIPT_VERIFY_NOCACHE = (1U << 0), // do not store results in signature cache (but do query it)
4745
SCRIPT_VERIFY_NULLDUMMY = (1U << 1), // verify dummy stack item consumed by CHECKMULTISIG is of zero-length
4846
};
4947

@@ -462,20 +460,34 @@ class CScriptNum
462460
class CScript : public std::vector<unsigned char>
463461
{
464462
protected:
465-
CScript& push_int64(int64_t n)
463+
CScript& push_int64(int64 n)
466464
{
467465
if (n == -1 || (n >= 1 && n <= 16))
468466
{
469467
push_back(n + (OP_1 - 1));
470468
}
471-
else if (n == 0)
469+
else
472470
{
473-
push_back(OP_0);
471+
CBigNum bn(n);
472+
*this << bn.getvch();
473+
}
474+
return *this;
475+
}
476+
477+
CScript& push_uint64(uint64 n)
478+
{
479+
if (n >= 1 && n <= 16)
480+
{
481+
push_back(n + (OP_1 - 1));
474482
}
475483
else
476484
{
477-
*this << CScriptNum::serialize(n);
485+
CBigNum bn(n);
486+
*this << bn.getvch();
478487
}
488+
return *this;
489+
}
490+
479491
public:
480492
CScript() { }
481493
CScript(const CScript& b) : std::vector<unsigned char>(b.begin(), b.end()) { }

0 commit comments

Comments
 (0)