#12 - Add zen-tx syntax checks for OP_CHECKBLOCKATHEIGHT
This commit is contained in:
parent
8010f5511e
commit
10436b0f6a
|
@ -205,7 +205,7 @@ bool CheckBlockIndex(int &txBlockIndex, int blockIndex)
|
|||
if (blockDelta > 0)
|
||||
return false;
|
||||
// blockDelta must be greater than 100 but lesser than 262144
|
||||
if ((blockDelta > -101) || (blockDelta < -262144))
|
||||
if ((blockDelta > -101) || (blockDelta < -262144) && (blockDelta != 0))
|
||||
return false;
|
||||
// check if txBlockIndex refers to an actual block
|
||||
if (txBlockIndex > blockIndex)
|
||||
|
@ -417,10 +417,23 @@ bool EvalScript(vector<vector<unsigned char> >& stack, const CScript& script, un
|
|||
break;
|
||||
}
|
||||
|
||||
#ifdef BITCOIN_TX // zen-tx can't process OP_CHECKBLOCKATHEIGHT because it requires an active chain
|
||||
#ifndef BITCOIN_ZCASHCONSENSUS_H // zen-tx can't process OP_CHECKBLOCKATHEIGHT because it requires an active chain
|
||||
case OP_CHECKBLOCKATHEIGHT:
|
||||
{
|
||||
return set_error(serror, SCRIPT_ERR_CHECKBLOCKATHEIGHT_UNVERIFIED);
|
||||
// we need two objects on the stack
|
||||
if (stack.size() < 2)
|
||||
return set_error(serror, SCRIPT_ERR_INVALID_STACK_OPERATION);
|
||||
|
||||
valtype vchBlockHash(stacktop(-2));
|
||||
valtype vchBlockIndex(stacktop(-1));
|
||||
|
||||
if ((vchBlockIndex.size() > sizeof(int)) || (vchBlockHash.size() > 32))
|
||||
return set_error(serror, SCRIPT_ERR_CHECKBLOCKATHEIGHT);
|
||||
|
||||
// since we can't access chain data then we treat OP_CHECKBLOCKATHEIGHT as a NOP
|
||||
popstack(stack);
|
||||
popstack(stack);
|
||||
stack.push_back(vchTrue);
|
||||
}
|
||||
break;
|
||||
#else
|
||||
|
|
|
@ -12,7 +12,9 @@
|
|||
|
||||
#include <boost/foreach.hpp>
|
||||
|
||||
#if defined(BITCOIN_ZCASHCONSENSUS_H)
|
||||
#include "main.h"
|
||||
#endif
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
@ -307,7 +309,7 @@ public:
|
|||
return false;
|
||||
}
|
||||
|
||||
#ifdef BITCOIN_TX // zen-tx does not have access to chain state so no replay protection is possible
|
||||
#ifndef BITCOIN_ZCASHCONSENSUS_H // zen-tx does not have access to chain state so no replay protection is possible
|
||||
bool operator()(const CKeyID &keyID) const {
|
||||
script->clear();
|
||||
*script << OP_DUP << OP_HASH160 << ToByteVector(keyID) << OP_EQUALVERIFY << OP_CHECKSIG;
|
||||
|
|
Loading…
Reference in New Issue