mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-20 13:37:28 +02:00
Make CScriptNum() take nMaxNumSize as an argument
While the existing numeric opcodes are all limited to 4-byte bignum
arguments, new opcodes will need different limits.
Rebased-From: 99088d60d8
This commit is contained in:
parent
1cea6b0dee
commit
689746841a
2 changed files with 5 additions and 4 deletions
|
|
@ -194,7 +194,10 @@ public:
|
|||
m_value = n;
|
||||
}
|
||||
|
||||
explicit CScriptNum(const std::vector<unsigned char>& vch, bool fRequireMinimal)
|
||||
static const size_t nDefaultMaxNumSize = 4;
|
||||
|
||||
explicit CScriptNum(const std::vector<unsigned char>& vch, bool fRequireMinimal,
|
||||
const size_t nMaxNumSize = nDefaultMaxNumSize)
|
||||
{
|
||||
if (vch.size() > nMaxNumSize) {
|
||||
throw scriptnum_error("script number overflow");
|
||||
|
|
@ -317,8 +320,6 @@ public:
|
|||
return result;
|
||||
}
|
||||
|
||||
static const size_t nMaxNumSize = 4;
|
||||
|
||||
private:
|
||||
static int64_t set_vch(const std::vector<unsigned char>& vch)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -142,7 +142,7 @@ static void RunCreate(const int64_t& num)
|
|||
{
|
||||
CheckCreateInt(num);
|
||||
CScriptNum scriptnum(num);
|
||||
if (scriptnum.getvch().size() <= CScriptNum::nMaxNumSize)
|
||||
if (scriptnum.getvch().size() <= CScriptNum::nDefaultMaxNumSize)
|
||||
CheckCreateVch(num);
|
||||
else
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue