Syntax
This commit is contained in:
@@ -49,7 +49,7 @@ UniValue custom_func0(uint64_t txfee,struct CCcontract_info *cp,cJSON *params)
|
|||||||
|
|
||||||
UniValue custom_func1(uint64_t txfee,struct CCcontract_info *cp,cJSON *params)
|
UniValue custom_func1(uint64_t txfee,struct CCcontract_info *cp,cJSON *params)
|
||||||
{
|
{
|
||||||
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), komodo_nextheight());
|
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), komodo_nextheight()); std::string rawtx;
|
||||||
UniValue result(UniValue::VOBJ); CPubKey mypk; int64_t amount = COIN; int32_t broadcastflag=0;
|
UniValue result(UniValue::VOBJ); CPubKey mypk; int64_t amount = COIN; int32_t broadcastflag=0;
|
||||||
if ( txfee == 0 )
|
if ( txfee == 0 )
|
||||||
txfee = CUSTOM_TXFEE;
|
txfee = CUSTOM_TXFEE;
|
||||||
@@ -71,7 +71,7 @@ bool custom_validate(struct CCcontract_info *cp,int32_t height,Eval *eval,const
|
|||||||
return eval->Invalid("invalid number of vouts");
|
return eval->Invalid("invalid number of vouts");
|
||||||
else if ( custom_opretdecode(pk,tx.vout[1].scriptPubKey) != '1' ) // verify has opreturn
|
else if ( custom_opretdecode(pk,tx.vout[1].scriptPubKey) != '1' ) // verify has opreturn
|
||||||
return eval->Invalid("invalid opreturn");
|
return eval->Invalid("invalid opreturn");
|
||||||
GetCCaddress(cp,expectedaddress,pk)
|
GetCCaddress(cp,expectedaddress,pk);
|
||||||
if ( IsCClibvout(cp,tx,0,expectedaddress) == COIN ) // make sure amount and destination matches
|
if ( IsCClibvout(cp,tx,0,expectedaddress) == COIN ) // make sure amount and destination matches
|
||||||
return(true);
|
return(true);
|
||||||
else return eval->Invalid("invalid vout0 amount");
|
else return eval->Invalid("invalid vout0 amount");
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
3. write the actual custom_func0, custom_func1 and custom_validate in customcc.cpp
|
3. write the actual custom_func0, custom_func1 and custom_validate in customcc.cpp
|
||||||
|
|
||||||
4. build cclib.cpp with -DBUILD_CUSTOMCC and put the libcc.so in ~/komodo/src and rebuild komodod
|
4. ./makecustom, which builds cclib.cpp with -DBUILD_CUSTOMCC and puts the libcc.so in ~/komodo/src and rebuilds komodod
|
||||||
|
|
||||||
5. launch your chain with -ac_cclib=customcc -ac_cc=2
|
5. launch your chain with -ac_cclib=customcc -ac_cc=2
|
||||||
|
|
||||||
@@ -16,6 +16,7 @@
|
|||||||
std::string MYCCLIBNAME = (char *)"customcc";
|
std::string MYCCLIBNAME = (char *)"customcc";
|
||||||
|
|
||||||
#define EVAL_CUSTOM (EVAL_FAUCET2+1)
|
#define EVAL_CUSTOM (EVAL_FAUCET2+1)
|
||||||
|
#define CUSTOM_TXFEE 10000
|
||||||
|
|
||||||
#define MYCCNAME "custom"
|
#define MYCCNAME "custom"
|
||||||
|
|
||||||
@@ -28,7 +29,7 @@ UniValue custom_func0(uint64_t txfee,struct CCcontract_info *cp,cJSON *params);
|
|||||||
UniValue custom_func1(uint64_t txfee,struct CCcontract_info *cp,cJSON *params);
|
UniValue custom_func1(uint64_t txfee,struct CCcontract_info *cp,cJSON *params);
|
||||||
|
|
||||||
#define CUSTOM_DISPATCH \
|
#define CUSTOM_DISPATCH \
|
||||||
if ( cp->evalcode == EVAL_SUDOKU ) \
|
if ( cp->evalcode == EVAL_CUSTOM ) \
|
||||||
{ \
|
{ \
|
||||||
if ( strcmp(method,"func0") == 0 ) \
|
if ( strcmp(method,"func0") == 0 ) \
|
||||||
return(custom_func0(txfee,cp,params)); \
|
return(custom_func0(txfee,cp,params)); \
|
||||||
|
|||||||
Reference in New Issue
Block a user