@@ -571,7 +571,8 @@ komodod_LDADD += \
|
||||
$(LIBBITCOIN_CRYPTO) \
|
||||
$(LIBVERUS_CRYPTO) \
|
||||
$(LIBVERUS_PORTABLE_CRYPTO) \
|
||||
$(LIBZCASH_LIBS)
|
||||
$(LIBZCASH_LIBS) \
|
||||
cclib.so
|
||||
|
||||
if ENABLE_PROTON
|
||||
komodod_LDADD += $(LIBBITCOIN_PROTON) $(PROTON_LIBS)
|
||||
|
||||
@@ -54,7 +54,7 @@ one other technical note is that komodod has the insight-explorer extensions bui
|
||||
extern int32_t KOMODO_CONNECTING,KOMODO_CCACTIVATE,KOMODO_DEALERNODE;
|
||||
extern uint32_t ASSETCHAINS_CC;
|
||||
extern char ASSETCHAINS_SYMBOL[];
|
||||
extern std::string CCerror;
|
||||
extern std::string CCerror,ASSETCHAINS_CCLIB;
|
||||
extern uint8_t ASSETCHAINS_CCDISABLES[256];
|
||||
|
||||
#define CC_MAXVINS 1024
|
||||
|
||||
48
src/cc/cclib.cpp
Normal file
48
src/cc/cclib.cpp
Normal file
@@ -0,0 +1,48 @@
|
||||
/******************************************************************************
|
||||
* 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 "cc/eval.h"
|
||||
#include "cc/utils.h"
|
||||
#include "cc/CCinclude.h"
|
||||
#include "main.h"
|
||||
#include "chain.h"
|
||||
#include "core_io.h"
|
||||
#include "crosschain.h"
|
||||
|
||||
#define MYCCLIBNAME ((char *)"stub")
|
||||
|
||||
char *CClib_name() { return(MYCCLIBNAME); }
|
||||
|
||||
bool CClib_Dispatch(const CC *cond,Eval *eval,std::vector<uint8_t> paramsNull,const CTransaction &txTo,unsigned int nIn)
|
||||
{
|
||||
uint8_t evalcode;
|
||||
if ( ASSETCHAINS_CCLIB != MYCCLIBNAME )
|
||||
{
|
||||
fprintf(stderr,"-ac_cclib=%s vs myname %s\n",ASSETCHAINS_CCLIB.c_str(),MYCCLIBNAME);
|
||||
return eval->Invalid("-ac_cclib name mismatches myname");
|
||||
}
|
||||
evalcode = cond->code[0];
|
||||
if ( evalcode >= EVAL_FIRSTUSER && evalcode <= EVAL_LASTUSER )
|
||||
{
|
||||
return(true);
|
||||
}
|
||||
return eval->Invalid("cclib CC must have evalcode between 16 and 127");
|
||||
}
|
||||
@@ -27,6 +27,8 @@
|
||||
#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);
|
||||
char *CClib_name();
|
||||
|
||||
Eval* EVAL_TEST = 0;
|
||||
struct CCcontract_info CCinfos[0x100];
|
||||
@@ -70,13 +72,19 @@ 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 )
|
||||
{
|
||||
if ( ASSETCHAINS_CCLIB.size() > 0 && ASSETCHAINS_CCLIB == CClib_name() )
|
||||
return CClib_Dispatch(cond,this,vparams,txTo,nIn);
|
||||
else return Invalid("mismatched -ac_cclib vs CClib_name");
|
||||
}
|
||||
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:
|
||||
|
||||
@@ -59,6 +59,10 @@
|
||||
EVAL(EVAL_TOKENS, 0xf2)
|
||||
|
||||
|
||||
// evalcodes 0x10 to 0x7f are reserved for cclib dynamic CC
|
||||
#define EVAL_FIRSTUSER 0x10
|
||||
#define EVAL_LASTUSER 0x7f
|
||||
|
||||
typedef uint8_t EvalCode;
|
||||
|
||||
|
||||
|
||||
1
src/cc/makecclib
Executable file
1
src/cc/makecclib
Executable file
@@ -0,0 +1 @@
|
||||
gcc -std=c++11 -I../univalue/include -I../cryptoconditions/include -I../cryptoconditions/src -I../cryptoconditions/src/asn -I.. -I. -fPIC -shared -c -o ../cclib.so cclib.cpp
|
||||
@@ -48,7 +48,7 @@ unsigned int WITNESS_CACHE_SIZE = _COINBASE_MATURITY+10;
|
||||
|
||||
int32_t KOMODO_MININGTHREADS = -1,IS_KOMODO_NOTARY,USE_EXTERNAL_PUBKEY,KOMODO_CHOSEN_ONE,ASSETCHAINS_SEED,KOMODO_ON_DEMAND,KOMODO_EXTERNAL_NOTARIES,KOMODO_PASSPORT_INITDONE,KOMODO_PAX,KOMODO_EXCHANGEWALLET,KOMODO_REWIND,KOMODO_CONNECTING = -1,KOMODO_DEALERNODE,KOMODO_EXTRASATOSHI,ASSETCHAINS_FOUNDERS;
|
||||
int32_t KOMODO_INSYNC,KOMODO_LASTMINED,prevKOMODO_LASTMINED,KOMODO_CCACTIVATE,JUMBLR_PAUSE = 1;
|
||||
std::string NOTARY_PUBKEY,ASSETCHAINS_NOTARIES,ASSETCHAINS_OVERRIDE_PUBKEY,DONATION_PUBKEY,ASSETCHAINS_SCRIPTPUB,ASSETCHAINS_SELFIMPORT;
|
||||
std::string NOTARY_PUBKEY,ASSETCHAINS_NOTARIES,ASSETCHAINS_OVERRIDE_PUBKEY,DONATION_PUBKEY,ASSETCHAINS_SCRIPTPUB,ASSETCHAINS_SELFIMPORT,ASSETCHAINS_CCLIB;
|
||||
uint8_t NOTARY_PUBKEY33[33],ASSETCHAINS_OVERRIDE_PUBKEY33[33],ASSETCHAINS_OVERRIDE_PUBKEYHASH[20],ASSETCHAINS_PUBLIC,ASSETCHAINS_PRIVATE,ASSETCHAINS_TXPOW,ASSETCHAINS_MARMARA;
|
||||
bool VERUS_MINTBLOCKS;
|
||||
|
||||
|
||||
@@ -1782,6 +1782,7 @@ void komodo_args(char *argv0)
|
||||
ASSETCHAINS_MARMARA = GetArg("-ac_marmara",0);
|
||||
if ( ASSETCHAINS_CC != 0 )
|
||||
{
|
||||
ASSETCHAINS_CCLIB = GetArg("-ac_cclib","");
|
||||
Split(GetArg("-ac_ccenable",""), ccenables, 0);
|
||||
for (i=nonz=0; i<0x100; i++)
|
||||
{
|
||||
@@ -1890,7 +1891,7 @@ void komodo_args(char *argv0)
|
||||
fprintf(stderr,"-ac_script and -ac_marmara are mutually exclusive\n");
|
||||
exit(0);
|
||||
}
|
||||
if ( ASSETCHAINS_ENDSUBSIDY[0] != 0 || ASSETCHAINS_REWARD[0] != 0 || ASSETCHAINS_HALVING[0] != 0 || ASSETCHAINS_DECAY[0] != 0 || ASSETCHAINS_COMMISSION != 0 || ASSETCHAINS_PUBLIC != 0 || ASSETCHAINS_PRIVATE != 0 || ASSETCHAINS_TXPOW != 0 || ASSETCHAINS_FOUNDERS != 0 || ASSETCHAINS_SCRIPTPUB.size() > 1 || ASSETCHAINS_SELFIMPORT.size() > 0 || ASSETCHAINS_OVERRIDE_PUBKEY33[0] != 0 || ASSETCHAINS_TIMELOCKGTE != _ASSETCHAINS_TIMELOCKOFF|| ASSETCHAINS_ALGO != ASSETCHAINS_EQUIHASH || ASSETCHAINS_LWMAPOS != 0 || ASSETCHAINS_LASTERA > 0 || ASSETCHAINS_BEAMPORT != 0 || ASSETCHAINS_CODAPORT != 0 || ASSETCHAINS_MARMARA != 0 || nonz > 0 )
|
||||
if ( ASSETCHAINS_ENDSUBSIDY[0] != 0 || ASSETCHAINS_REWARD[0] != 0 || ASSETCHAINS_HALVING[0] != 0 || ASSETCHAINS_DECAY[0] != 0 || ASSETCHAINS_COMMISSION != 0 || ASSETCHAINS_PUBLIC != 0 || ASSETCHAINS_PRIVATE != 0 || ASSETCHAINS_TXPOW != 0 || ASSETCHAINS_FOUNDERS != 0 || ASSETCHAINS_SCRIPTPUB.size() > 1 || ASSETCHAINS_SELFIMPORT.size() > 0 || ASSETCHAINS_OVERRIDE_PUBKEY33[0] != 0 || ASSETCHAINS_TIMELOCKGTE != _ASSETCHAINS_TIMELOCKOFF|| ASSETCHAINS_ALGO != ASSETCHAINS_EQUIHASH || ASSETCHAINS_LWMAPOS != 0 || ASSETCHAINS_LASTERA > 0 || ASSETCHAINS_BEAMPORT != 0 || ASSETCHAINS_CODAPORT != 0 || ASSETCHAINS_MARMARA != 0 || nonz > 0 || ASSETCHAINS_CCLIB.size() > 0 )
|
||||
{
|
||||
fprintf(stderr,"perc %.4f%% ac_pub=[%02x%02x%02x...] acsize.%d\n",dstr(ASSETCHAINS_COMMISSION)*100,ASSETCHAINS_OVERRIDE_PUBKEY33[0],ASSETCHAINS_OVERRIDE_PUBKEY33[1],ASSETCHAINS_OVERRIDE_PUBKEY33[2],(int32_t)ASSETCHAINS_SCRIPTPUB.size());
|
||||
extraptr = extrabuf;
|
||||
@@ -1971,8 +1972,17 @@ void komodo_args(char *argv0)
|
||||
memcpy(&extraptr[extralen],disablebits,sizeof(disablebits));
|
||||
extralen += sizeof(disablebits);
|
||||
}
|
||||
if ( ASSETCHAINS_CCLIB.size() > 1 )
|
||||
{
|
||||
for (i=0; i<ASSETCHAINS_CCLIB.size(); i++)
|
||||
{
|
||||
extraptr[extralen++] = ASSETCHAINS_CCLIB[i];
|
||||
fprintf(stderr,"%c",ASSETCHAINS_CCLIB[i]);
|
||||
}
|
||||
fprintf(stderr," <- CCLIB name\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
addn = GetArg("-seednode","");
|
||||
if ( strlen(addn.c_str()) > 0 )
|
||||
ASSETCHAINS_SEED = 1;
|
||||
|
||||
Reference in New Issue
Block a user