Browse Source

CClib_Dispatch

pull/4/head
jl777 5 years ago
parent
commit
c310c7fa47
  1. 38
      src/cc/cclib.cpp
  2. 7
      src/cc/eval.cpp

38
src/cc/cclib.cpp

@ -1,2 +1,40 @@
/******************************************************************************
* Copyright © 2014-2019 The SuperNET Developers. *
* *
* See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at *
* the top-level directory of this distribution for the individual copyright *
* holder information and the developer policies on copyright and licensing. *
* *
* Unless otherwise agreed in a custom licensing agreement, no part of the *
* SuperNET software, including this file may be copied, modified, propagated *
* or distributed except according to the terms contained in the LICENSE file *
* *
* Removal or modification of this copyright notice is prohibited. *
* *
******************************************************************************/
#include <assert.h>
#include <cryptoconditions.h>
#include "../primitives/block.h"
#include "../primitives/transaction.h"
#include "../script/cc.h"
#include "eval.h"
#include "utils.h"
#include "CCinclude.h"
#include "../main.h"
#include "../chain.h"
#include "../core_io.h"
#include "../crosschain.h"
char *CClib_name() { return((char *)"stub"); }
bool CClib_Dispatch(const CC *cond,Eval *eval,std::vector<uint8_t> paramsNull,const CTransaction &txTo,unsigned int nIn)
{
uint8_t evalcode = cond->code[0];
if ( evalcode >= EVAL_FIRSTUSER && evalcode <= EVAL_LASTUSER )
{
}
return eval->Invalid("cclib CC must have evalcode between 16 and 127");
}

7
src/cc/eval.cpp

@ -27,6 +27,7 @@
#include "core_io.h"
#include "crosschain.h"
bool CClib_Dispatch(const CC *cond,Eval *eval,std::vector<uint8_t> paramsNull,const CTransaction &txTo,unsigned int nIn);
Eval* EVAL_TEST = 0;
struct CCcontract_info CCinfos[0x100];
@ -70,13 +71,17 @@ bool Eval::Dispatch(const CC *cond, const CTransaction &txTo, unsigned int nIn)
fprintf(stderr,"%s evalcode.%d %02x\n",txTo.GetHash().GetHex().c_str(),ecode,ecode);
return Invalid("disabled-code, -ac_ccenables didnt include this ecode");
}
std::vector<uint8_t> vparams(cond->code+1, cond->code+cond->codeLength);
if ( ecode >= EVAL_FIRSTUSER && ecode <= EVAL_LASTUSER )
{
return CClib_Dispatch(cond,this,vparams,txTo,nIn);
}
cp = &CCinfos[(int32_t)ecode];
if ( cp->didinit == 0 )
{
CCinit(cp,ecode);
cp->didinit = 1;
}
std::vector<uint8_t> vparams(cond->code+1, cond->code+cond->codeLength);
switch ( ecode )
{
case EVAL_IMPORTPAYOUT:

Loading…
Cancel
Save