diff --git a/src/assetchains b/src/assetchains index f220139cf49..6063ad379cc 100755 --- a/src/assetchains +++ b/src/assetchains @@ -35,7 +35,8 @@ komodo_asset JUMBLR 999999 komodo_asset BET 999999 komodo_asset CRYPTO 999999 komodo_asset HODL 9999999 -komodo_asset SHARK 1401 +#komodo_asset SHARK 1401 +komodo_asset MSHARK 1400000 komodo_asset BOTS 999999 komodo_asset MGW 999999 #komodo_asset MVP 1000000 @@ -45,6 +46,9 @@ komodo_asset KV 1000000 komodo_asset CEAL 366666666 komodo_asset MESH 1000007 komodo_asset MNZ 257142858 +komodo_asset AXO 200000000 +komodo_asset ETOMIC 100000000 +komodo_asset BTCH 20998641 komodo_asset USD komodo_asset EUR diff --git a/src/assetchains.old b/src/assetchains.old index e7584afcd6e..9e14165fecd 100755 --- a/src/assetchains.old +++ b/src/assetchains.old @@ -12,7 +12,8 @@ echo $pubkey ./komodod -pubkey=$pubkey -ac_name=BET -ac_supply=999999 -addnode=78.47.196.146 $1 & ./komodod -pubkey=$pubkey -ac_name=CRYPTO -ac_supply=999999 -addnode=78.47.196.146 $1 & ./komodod -pubkey=$pubkey -ac_name=HODL -ac_supply=9999999 -addnode=78.47.196.146 $1 & -./komodod -pubkey=$pubkey -ac_name=SHARK -ac_supply=1401 -addnode=78.47.196.146 $1 & +#./komodod -pubkey=$pubkey -ac_name=SHARK -ac_supply=1401 -addnode=78.47.196.146 $1 & +./komodod -pubkey=$pubkey -ac_name=MSHARK -ac_supply=1400000 -addnode=78.47.196.146 $1 & ./komodod -pubkey=$pubkey -ac_name=BOTS -ac_supply=999999 -addnode=78.47.196.146 $1 & ./komodod -pubkey=$pubkey -ac_name=MGW -ac_supply=999999 -addnode=78.47.196.146 $1 & #./komodod -pubkey=$pubkey -ac_name=MVP -ac_supply=1000000 -addnode=78.47.196.146 $1 & @@ -22,6 +23,10 @@ echo $pubkey ./komodod -pubkey=$pubkey -ac_name=CEAL -ac_supply=366666666 -addnode=78.47.196.146 $1 & ./komodod -pubkey=$pubkey -ac_name=MESH -ac_supply=1000007 -addnode=78.47.196.146 $1 & ./komodod -pubkey=$pubkey -ac_name=MNZ -ac_supply=257142858 -addnode=51.15.138.138 $1 & +./komodod -pubkey=$pubkey -ac_name=AXO -ac_supply=200000000 -addnode=78.47.196.146 & +./komodod -pubkey=$pubkey -ac_name=ETOMIC -ac_supply=100000000 -addnode=78.47.196.146 & +./komodod -pubkey=$pubkey -ac_name=BTCH -ac_supply=20998641 -addnode=78.47.196.146 & + sleep $delay ./komodod -pubkey=$pubkey -ac_name=USD -addnode=78.47.196.146 $1 & diff --git a/src/bitcoind.cpp b/src/bitcoind.cpp index 050305117df..bf4934da488 100644 --- a/src/bitcoind.cpp +++ b/src/bitcoind.cpp @@ -42,7 +42,8 @@ */ static bool fDaemon; -extern char ASSETCHAINS_SYMBOL[16]; +#define KOMODO_ASSETCHAIN_MAXLEN 65 +extern char ASSETCHAINS_SYMBOL[KOMODO_ASSETCHAIN_MAXLEN]; void komodo_passport_iteration(); void WaitForShutdown(boost::thread_group* threadGroup) diff --git a/src/chain.cpp b/src/chain.cpp index 5b8ce076c47..9cd13d997d2 100644 --- a/src/chain.cpp +++ b/src/chain.cpp @@ -51,6 +51,8 @@ CBlockLocator CChain::GetLocator(const CBlockIndex *pindex) const { } const CBlockIndex *CChain::FindFork(const CBlockIndex *pindex) const { + if ( pindex == 0 ) + return(0); if (pindex->nHeight > Height()) pindex = pindex->GetAncestor(Height()); while (pindex && !Contains(pindex)) diff --git a/src/chainparams.cpp b/src/chainparams.cpp index 17b5dab6e08..13409c8c45a 100644 --- a/src/chainparams.cpp +++ b/src/chainparams.cpp @@ -30,7 +30,9 @@ using namespace std; * + Contains no strange transactions */ void *chainparams_commandline(void *ptr); -extern char ASSETCHAINS_SYMBOL[16]; +#include "komodo_defs.h" + +extern char ASSETCHAINS_SYMBOL[KOMODO_ASSETCHAIN_MAXLEN]; extern uint16_t ASSETCHAINS_PORT; extern uint32_t ASSETCHAIN_INIT; extern uint32_t ASSETCHAINS_MAGIC; diff --git a/src/coins.cpp b/src/coins.cpp index 27cac5a6f23..37d96901077 100644 --- a/src/coins.cpp +++ b/src/coins.cpp @@ -8,6 +8,7 @@ #include "random.h" #include "version.h" #include "policy/fees.h" +#include "komodo_defs.h" #include @@ -387,7 +388,7 @@ const CScript &CCoinsViewCache::GetSpendFor(const CTxIn& input) const //uint64_t komodo_interest(int32_t txheight,uint64_t nValue,uint32_t nLockTime,uint32_t tiptime); uint64_t komodo_accrued_interest(int32_t *txheightp,uint32_t *locktimep,uint256 hash,int32_t n,int32_t checkheight,uint64_t checkvalue); -extern char ASSETCHAINS_SYMBOL[16]; +extern char ASSETCHAINS_SYMBOL[KOMODO_ASSETCHAIN_MAXLEN]; CAmount CCoinsViewCache::GetValueIn(int32_t nHeight,int64_t *interestp,const CTransaction& tx,uint32_t tiptime) const { diff --git a/src/dpowassets b/src/dpowassets index 5e0facea072..b047eeae2b8 100755 --- a/src/dpowassets +++ b/src/dpowassets @@ -14,6 +14,7 @@ curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dp curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"CRYPTO\",\"pubkey\":\"$pubkey\"}" curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"HODL\",\"pubkey\":\"$pubkey\"}" curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"SHARK\",\"pubkey\":\"$pubkey\"}" +curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"MSHARK\",\"pubkey\":\"$pubkey\"}" curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"BOTS\",\"pubkey\":\"$pubkey\"}" curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"MGW\",\"pubkey\":\"$pubkey\"}" #curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"MVP\",\"pubkey\":\"$pubkey\"}" @@ -24,6 +25,9 @@ curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dp curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"MESH\",\"pubkey\":\"$pubkey\"}" curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"MNZ\",\"pubkey\":\"$pubkey\"}" curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"CHIPS\",\"pubkey\":\"$pubkey\"}" +curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"AXO\",\"pubkey\":\"$pubkey\"}" +curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"ETOMIC\",\"pubkey\":\"$pubkey\"}" +curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"BTCH\",\"pubkey\":\"$pubkey\"}" #curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"USD\",\"pubkey\":\"$pubkey\"}" diff --git a/src/fiat-cli b/src/fiat-cli index e83a7f757c7..0d9dc87afb6 100755 --- a/src/fiat-cli +++ b/src/fiat-cli @@ -1,37 +1,37 @@ #!/bin/bash #set -x -echo aud; fiat/aud $1 $2 $3 $4 -echo bgn; fiat/bgn $1 $2 $3 $4 -echo cad; fiat/cad $1 $2 $3 $4 -echo chf; fiat/chf $1 $2 $3 $4 -echo cny; fiat/cny $1 $2 $3 $4 -echo czk; fiat/czk $1 $2 $3 $4 -echo dkk; fiat/dkk $1 $2 $3 $4 -echo eur; fiat/eur $1 $2 $3 $4 -echo gbp; fiat/gbp $1 $2 $3 $4 -echo hkd; fiat/hkd $1 $2 $3 $4 -echo hrk; fiat/hrk $1 $2 $3 $4 -echo huf; fiat/huf $1 $2 $3 $4 -echo idr; fiat/idr $1 $2 $3 $4 -echo ils; fiat/ils $1 $2 $3 $4 -echo inr; fiat/inr $1 $2 $3 $4 -echo jpy; fiat/jpy $1 $2 $3 $4 -echo krw; fiat/krw $1 $2 $3 $4 -echo mxn; fiat/mxn $1 $2 $3 $4 -echo myr; fiat/myr $1 $2 $3 $4 -echo nok; fiat/nok $1 $2 $3 $4 -echo nzd; fiat/nzd $1 $2 $3 $4 -echo php; fiat/php $1 $2 $3 $4 -echo pln; fiat/pln $1 $2 $3 $4 -echo brl; fiat/brl $1 $2 $3 $4 -echo ron; fiat/ron $1 $2 $3 $4 -echo rub; fiat/rub $1 $2 $3 $4 -echo sek; fiat/sek $1 $2 $3 $4 -echo sgd; fiat/sgd $1 $2 $3 $4 -echo thb; fiat/thb $1 $2 $3 $4 -echo try; fiat/try $1 $2 $3 $4 -echo usd; fiat/usd $1 $2 $3 $4 -echo zar; fiat/zar $1 $2 $3 $4 +#echo aud; fiat/aud $1 $2 $3 $4 +#echo bgn; fiat/bgn $1 $2 $3 $4 +#echo cad; fiat/cad $1 $2 $3 $4 +#echo chf; fiat/chf $1 $2 $3 $4 +#echo cny; fiat/cny $1 $2 $3 $4 +#echo czk; fiat/czk $1 $2 $3 $4 +#echo dkk; fiat/dkk $1 $2 $3 $4 +#echo eur; fiat/eur $1 $2 $3 $4 +#echo gbp; fiat/gbp $1 $2 $3 $4 +#echo hkd; fiat/hkd $1 $2 $3 $4 +#echo hrk; fiat/hrk $1 $2 $3 $4 +#echo huf; fiat/huf $1 $2 $3 $4 +#echo idr; fiat/idr $1 $2 $3 $4 +#echo ils; fiat/ils $1 $2 $3 $4 +#echo inr; fiat/inr $1 $2 $3 $4 +#echo jpy; fiat/jpy $1 $2 $3 $4 +#echo krw; fiat/krw $1 $2 $3 $4 +#echo mxn; fiat/mxn $1 $2 $3 $4 +#echo myr; fiat/myr $1 $2 $3 $4 +#echo nok; fiat/nok $1 $2 $3 $4 +#echo nzd; fiat/nzd $1 $2 $3 $4 +#echo php; fiat/php $1 $2 $3 $4 +#echo pln; fiat/pln $1 $2 $3 $4 +#echo brl; fiat/brl $1 $2 $3 $4 +#echo ron; fiat/ron $1 $2 $3 $4 +#echo rub; fiat/rub $1 $2 $3 $4 +#echo sek; fiat/sek $1 $2 $3 $4 +#echo sgd; fiat/sgd $1 $2 $3 $4 +#echo thb; fiat/thb $1 $2 $3 $4 +#echo try; fiat/try $1 $2 $3 $4 +#echo usd; fiat/usd $1 $2 $3 $4 +#echo zar; fiat/zar $1 $2 $3 $4 echo revs; fiat/revs $1 $2 $3 $4 echo supernet; fiat/supernet $1 $2 $3 $4 echo dex; fiat/dex $1 $2 $3 $4 @@ -40,7 +40,8 @@ echo jumblr; fiat/jumblr $1 $2 $3 $4 echo bet; fiat/bet $1 $2 $3 $4 echo crypto; fiat/crypto $1 $2 $3 $4 echo hodl; fiat/hodl $1 $2 $3 $4 -echo shark; fiat/shark $1 $2 $3 $4 +#echo shark; fiat/shark $1 $2 $3 $4 +echo mshark; fiat/mshark $1 $2 $3 $4 echo bots; fiat/bots $1 $2 $3 $4 echo mgw; fiat/mgw $1 $2 $3 $4 #echo mvp; fiat/mvp $1 $2 $3 $4 @@ -50,3 +51,6 @@ echo kv; fiat/kv $1 $2 $3 $4 echo ceal; fiat/ceal $1 $2 $3 $4 echo mesh; fiat/mesh $1 $2 $3 $4 echo mnz; fiat/mnz $1 $2 $3 $4 +echo axo; fiat/axo $1 $2 $3 $4 +echo etomic; fiat/etomic $1 $2 $3 $4 +echo btch; fiat/btch $1 $2 $3 $4 diff --git a/src/fiat/axo b/src/fiat/axo new file mode 100755 index 00000000000..18d38cac070 --- /dev/null +++ b/src/fiat/axo @@ -0,0 +1,2 @@ +#!/bin/bash +./komodo-cli -ac_name=AXO $1 $2 $3 $4 $5 $6 diff --git a/src/fiat/btch b/src/fiat/btch new file mode 100755 index 00000000000..6a57ea8d1f7 --- /dev/null +++ b/src/fiat/btch @@ -0,0 +1,2 @@ +#!/bin/bash +./komodo-cli -ac_name=BTCH $1 $2 $3 $4 $5 $6 diff --git a/src/fiat/etomic b/src/fiat/etomic new file mode 100755 index 00000000000..76eb0191c90 --- /dev/null +++ b/src/fiat/etomic @@ -0,0 +1,2 @@ +#!/bin/bash +./komodo-cli -ac_name=ETOMIC $1 $2 $3 $4 $5 $6 diff --git a/src/fiat/mshark b/src/fiat/mshark new file mode 100755 index 00000000000..1f0c950c668 --- /dev/null +++ b/src/fiat/mshark @@ -0,0 +1,2 @@ +#!/bin/bash +./komodo-cli -ac_name=MSHARK $1 $2 $3 $4 $5 $6 diff --git a/src/komodo-tx.cpp b/src/komodo-tx.cpp index 19d0440ddf2..645bc30a24e 100644 --- a/src/komodo-tx.cpp +++ b/src/komodo-tx.cpp @@ -27,6 +27,7 @@ using namespace std; #include "arith_uint256.h" #include "komodo_structs.h" #include "komodo_globals.h" +#include "komodo_defs.h" #include "komodo_interest.h" diff --git a/src/komodo.h b/src/komodo.h index 02253950ef9..c6467d9577a 100644 --- a/src/komodo.h +++ b/src/komodo.h @@ -15,6 +15,7 @@ #ifndef H_KOMODO_H #define H_KOMODO_H +#include "komodo_defs.h" #ifdef _WIN32 #define printf(...) @@ -56,14 +57,14 @@ int32_t komodo_parsestatefile(struct komodo_state *sp,FILE *fp,char *symbol,char void komodo_currentheight_set(int32_t height) { - char symbol[16],dest[16]; struct komodo_state *sp; + char symbol[KOMODO_ASSETCHAIN_MAXLEN],dest[KOMODO_ASSETCHAIN_MAXLEN]; struct komodo_state *sp; if ( (sp= komodo_stateptr(symbol,dest)) != 0 ) sp->CURRENT_HEIGHT = height; } int32_t komodo_currentheight() { - char symbol[16],dest[16]; struct komodo_state *sp; + char symbol[KOMODO_ASSETCHAIN_MAXLEN],dest[KOMODO_ASSETCHAIN_MAXLEN]; struct komodo_state *sp; if ( (sp= komodo_stateptr(symbol,dest)) != 0 ) return(sp->CURRENT_HEIGHT); else return(0); @@ -328,7 +329,7 @@ int32_t komodo_parsestatefiledata(struct komodo_state *sp,uint8_t *filedata,long void komodo_stateupdate(int32_t height,uint8_t notarypubs[][33],uint8_t numnotaries,uint8_t notaryid,uint256 txhash,uint64_t voutmask,uint8_t numvouts,uint32_t *pvals,uint8_t numpvals,int32_t KMDheight,uint32_t KMDtimestamp,uint64_t opretvalue,uint8_t *opretbuf,uint16_t opretlen,uint16_t vout) { static FILE *fp; static int32_t errs,didinit; - struct komodo_state *sp; char fname[512],symbol[16],dest[16]; int32_t retval,ht,func; uint8_t num,pubkeys[64][33]; + struct komodo_state *sp; char fname[512],symbol[KOMODO_ASSETCHAIN_MAXLEN],dest[KOMODO_ASSETCHAIN_MAXLEN]; int32_t retval,ht,func; uint8_t num,pubkeys[64][33]; if ( didinit == 0 ) { portable_mutex_init(&KOMODO_KV_mutex); @@ -475,7 +476,7 @@ void komodo_stateupdate(int32_t height,uint8_t notarypubs[][33],uint8_t numnotar int32_t komodo_voutupdate(int32_t *isratificationp,int32_t notaryid,uint8_t *scriptbuf,int32_t scriptlen,int32_t height,uint256 txhash,int32_t i,int32_t j,uint64_t *voutmaskp,int32_t *specialtxp,int32_t *notarizedheightp,uint64_t value,int32_t notarized,uint64_t signedmask) { static uint256 zero; static FILE *signedfp; - int32_t opretlen,nid,k,len = 0; uint256 kmdtxid,desttxid; uint8_t crypto777[33]; struct komodo_state *sp; char symbol[16],dest[16]; + int32_t opretlen,nid,k,len = 0; uint256 kmdtxid,desttxid; uint8_t crypto777[33]; struct komodo_state *sp; char symbol[KOMODO_ASSETCHAIN_MAXLEN],dest[KOMODO_ASSETCHAIN_MAXLEN]; if ( (sp= komodo_stateptr(symbol,dest)) == 0 ) return(-1); if ( scriptlen == 35 && scriptbuf[0] == 33 && scriptbuf[34] == 0xac ) @@ -550,7 +551,7 @@ int32_t komodo_voutupdate(int32_t *isratificationp,int32_t notaryid,uint8_t *scr if ( signedfp == 0 ) { char fname[512]; - komodo_statefname(fname,(char *)"",(char *)"signedmasks"); + komodo_statefname(fname,ASSETCHAINS_SYMBOL,(char *)"signedmasks"); if ( (signedfp= fopen(fname,"rb+")) == 0 ) signedfp = fopen(fname,"wb"); else fseek(signedfp,0,SEEK_END); @@ -633,7 +634,7 @@ int32_t komodo_notarycmp(uint8_t *scriptPubKey,int32_t scriptlen,uint8_t pubkeys void komodo_connectblock(CBlockIndex *pindex,CBlock& block) { static int32_t hwmheight; - uint64_t signedmask,voutmask; char symbol[16],dest[16]; struct komodo_state *sp; + uint64_t signedmask,voutmask; char symbol[KOMODO_ASSETCHAIN_MAXLEN],dest[KOMODO_ASSETCHAIN_MAXLEN]; struct komodo_state *sp; uint8_t scriptbuf[4096],pubkeys[64][33],rmd160[20],scriptPubKey[35]; uint256 kmdtxid,zero,btctxid,txhash; int32_t i,j,k,numnotaries,notarized,scriptlen,isratification,nid,numvalid,specialtx,notarizedheight,notaryid,len,numvouts,numvins,height,txn_count; memset(&zero,0,sizeof(zero)); @@ -691,8 +692,25 @@ void komodo_connectblock(CBlockIndex *pindex,CBlock& block) (numvalid >= KOMODO_MINRATIFY && ASSETCHAINS_SYMBOL[0] != 0) || numvalid > (numnotaries/5)) ) { - if ( height > 500000 || ASSETCHAINS_SYMBOL[0] != 0 ) - printf("[%s] ht.%d txi.%d signedmask.%llx numvins.%d numvouts.%d <<<<<<<<<<< notarized\n",ASSETCHAINS_SYMBOL,height,i,(long long)signedmask,numvins,numvouts); + if ( ASSETCHAINS_SYMBOL[0] != 0 ) + { + static FILE *signedfp; + if ( signedfp == 0 ) + { + char fname[512]; + komodo_statefname(fname,ASSETCHAINS_SYMBOL,(char *)"signedmasks"); + if ( (signedfp= fopen(fname,"rb+")) == 0 ) + signedfp = fopen(fname,"wb"); + else fseek(signedfp,0,SEEK_END); + } + if ( signedfp != 0 ) + { + fwrite(&height,1,sizeof(height),signedfp); + fwrite(&signedmask,1,sizeof(signedmask),signedfp); + fflush(signedfp); + } + printf("[%s] ht.%d txi.%d signedmask.%llx numvins.%d numvouts.%d <<<<<<<<<<< notarized\n",ASSETCHAINS_SYMBOL,height,i,(long long)signedmask,numvins,numvouts); + } notarized = 1; } if ( NOTARY_PUBKEY33[0] != 0 && ASSETCHAINS_SYMBOL[0] == 0 ) diff --git a/src/komodo_bitcoind.h b/src/komodo_bitcoind.h index e4d216741bf..29849f29504 100644 --- a/src/komodo_bitcoind.h +++ b/src/komodo_bitcoind.h @@ -23,6 +23,8 @@ #include #endif +#include "komodo_defs.h" + //#define issue_curl(cmdstr) bitcoind_RPC(0,(char *)"curl",(char *)"http://127.0.0.1:7776",0,0,(char *)(cmdstr)) struct MemoryStruct { char *memory; size_t size; }; @@ -559,7 +561,7 @@ uint32_t komodo_txtime(uint256 hash) void komodo_disconnect(CBlockIndex *pindex,CBlock& block) { - char symbol[16],dest[16]; struct komodo_state *sp; + char symbol[KOMODO_ASSETCHAIN_MAXLEN],dest[KOMODO_ASSETCHAIN_MAXLEN]; struct komodo_state *sp; //fprintf(stderr,"disconnect ht.%d\n",pindex->nHeight); komodo_init(pindex->nHeight); if ( (sp= komodo_stateptr(symbol,dest)) != 0 ) diff --git a/src/komodo_defs.h b/src/komodo_defs.h new file mode 100644 index 00000000000..db792c44e7c --- /dev/null +++ b/src/komodo_defs.h @@ -0,0 +1,9 @@ +#ifndef KOMODO_DEFS_H +#define KOMODO_DEFS_H + +#define ASSETCHAINS_MINHEIGHT 128 +#define KOMODO_ELECTION_GAP 2000 +#define ROUNDROBIN_DELAY 61 +#define KOMODO_ASSETCHAIN_MAXLEN 65 + +#endif diff --git a/src/komodo_events.h b/src/komodo_events.h index 753413e9f83..ff054c3bb8b 100644 --- a/src/komodo_events.h +++ b/src/komodo_events.h @@ -15,6 +15,7 @@ #ifndef H_KOMODOEVENTS_H #define H_KOMODOEVENTS_H +#include "komodo_defs.h" struct komodo_event *komodo_eventadd(struct komodo_state *sp,int32_t height,char *symbol,uint8_t type,uint8_t *data,uint16_t datalen) { diff --git a/src/komodo_gateway.h b/src/komodo_gateway.h index d4d72781d04..d655f2aa52c 100644 --- a/src/komodo_gateway.h +++ b/src/komodo_gateway.h @@ -14,6 +14,7 @@ ******************************************************************************/ // paxdeposit equivalent in reverse makes opreturn and KMD does the same in reverse +#include "komodo_defs.h" int32_t pax_fiatstatus(uint64_t *available,uint64_t *deposited,uint64_t *issued,uint64_t *withdrawn,uint64_t *approved,uint64_t *redeemed,char *base) { @@ -105,7 +106,7 @@ void komodo_paxdelete(struct pax_transaction *pax) void komodo_gateway_deposit(char *coinaddr,uint64_t value,char *symbol,uint64_t fiatoshis,uint8_t *rmd160,uint256 txid,uint16_t vout,uint8_t type,int32_t height,int32_t otherheight,char *source,int32_t approved) // assetchain context { - struct pax_transaction *pax; uint8_t buf[35]; int32_t addflag = 0; struct komodo_state *sp; char str[16],dest[16],*s; + struct pax_transaction *pax; uint8_t buf[35]; int32_t addflag = 0; struct komodo_state *sp; char str[KOMODO_ASSETCHAIN_MAXLEN],dest[KOMODO_ASSETCHAIN_MAXLEN],*s; //if ( KOMODO_PAX == 0 ) // return; //if ( strcmp(symbol,ASSETCHAINS_SYMBOL) != 0 ) @@ -197,7 +198,7 @@ int32_t komodo_rwapproval(int32_t rwflag,uint8_t *opretbuf,struct pax_transactio int32_t komodo_issued_opreturn(char *base,uint256 *txids,uint16_t *vouts,int64_t *values,int64_t *srcvalues,int32_t *kmdheights,int32_t *otherheights,int8_t *baseids,uint8_t *rmd160s,uint8_t *opretbuf,int32_t opretlen,int32_t iskomodo) { - struct pax_transaction p,*pax; int32_t i,n=0,j,len=0,incr,height,otherheight; uint8_t type,rmd160[20]; uint64_t fiatoshis; char symbol[16]; + struct pax_transaction p,*pax; int32_t i,n=0,j,len=0,incr,height,otherheight; uint8_t type,rmd160[20]; uint64_t fiatoshis; char symbol[KOMODO_ASSETCHAIN_MAXLEN]; //if ( KOMODO_PAX == 0 ) // return(0); incr = 34 + (iskomodo * (2*sizeof(fiatoshis) + 2*sizeof(height) + 20 + 4)); @@ -290,7 +291,7 @@ int32_t komodo_paxcmp(char *symbol,int32_t kmdheight,uint64_t value,uint64_t che uint64_t komodo_paxtotal() { - struct pax_transaction *pax,*pax2,*tmp,*tmp2; char symbol[16],dest[16],*str; int32_t i,ht; int64_t checktoshis; uint64_t seed,total = 0; struct komodo_state *basesp; + struct pax_transaction *pax,*pax2,*tmp,*tmp2; char symbol[KOMODO_ASSETCHAIN_MAXLEN],dest[KOMODO_ASSETCHAIN_MAXLEN],*str; int32_t i,ht; int64_t checktoshis; uint64_t seed,total = 0; struct komodo_state *basesp; if ( KOMODO_PASSPORT_INITDONE == 0 ) //KOMODO_PAX == 0 || return(0); if ( komodo_isrealtime(&ht) == 0 ) @@ -464,7 +465,7 @@ int32_t komodo_pending_withdraws(char *opretstr) // todo: enforce deterministic int32_t komodo_gateway_deposits(CMutableTransaction *txNew,char *base,int32_t tokomodo) { - struct pax_transaction *pax,*tmp; char symbol[16],dest[16]; uint8_t *script,opcode,opret[16384],data[16384]; int32_t i,baseid,ht,len=0,opretlen=0,numvouts=1; struct komodo_state *sp; uint64_t available,deposited,issued,withdrawn,approved,redeemed,mask,sum = 0; + struct pax_transaction *pax,*tmp; char symbol[KOMODO_ASSETCHAIN_MAXLEN],dest[KOMODO_ASSETCHAIN_MAXLEN]; uint8_t *script,opcode,opret[16384],data[16384]; int32_t i,baseid,ht,len=0,opretlen=0,numvouts=1; struct komodo_state *sp; uint64_t available,deposited,issued,withdrawn,approved,redeemed,mask,sum = 0; if ( KOMODO_PASSPORT_INITDONE == 0 )//KOMODO_PAX == 0 || return(0); struct komodo_state *kmdsp = komodo_stateptrget((char *)"KMD"); @@ -652,7 +653,7 @@ void komodo_passport_iteration(); int32_t komodo_check_deposit(int32_t height,const CBlock& block) // verify above block is valid pax pricing { static uint256 array[64]; static int32_t numbanned,indallvouts; - int32_t i,j,k,n,ht,baseid,txn_count,activation,num,opretlen,offset=1,errs=0,matched=0,kmdheights[256],otherheights[256]; uint256 hash,txids[256]; char symbol[16],base[16]; uint16_t vouts[256]; int8_t baseids[256]; uint8_t *script,opcode,rmd160s[256*20]; uint64_t total,available,deposited,issued,withdrawn,approved,redeemed,checktoshis,seed; int64_t values[256],srcvalues[256]; struct pax_transaction *pax; struct komodo_state *sp; + int32_t i,j,k,n,ht,baseid,txn_count,activation,num,opretlen,offset=1,errs=0,matched=0,kmdheights[256],otherheights[256]; uint256 hash,txids[256]; char symbol[KOMODO_ASSETCHAIN_MAXLEN],base[KOMODO_ASSETCHAIN_MAXLEN]; uint16_t vouts[256]; int8_t baseids[256]; uint8_t *script,opcode,rmd160s[256*20]; uint64_t total,available,deposited,issued,withdrawn,approved,redeemed,checktoshis,seed; int64_t values[256],srcvalues[256]; struct pax_transaction *pax; struct komodo_state *sp; activation = 235300; if ( *(int32_t *)&array[0] == 0 ) numbanned = komodo_bannedset(&indallvouts,array,(int32_t)(sizeof(array)/sizeof(*array))); @@ -1422,7 +1423,7 @@ void komodo_stateind_set(struct komodo_state *sp,uint32_t *inds,int32_t n,uint8_ } else if ( func == 'V' ) { - if ( KOMODO_PAX != 0 || numv > numV-1440 ) + if ( KOMODO_PAX != 0 && numv > numV-1440 ) doissue = 1; numv++; } @@ -1626,7 +1627,7 @@ void komodo_passport_iteration() { static long lastpos[34]; static char userpass[33][1024]; static uint32_t lasttime,callcounter; int32_t maxseconds = 10; - FILE *fp; uint8_t *filedata; long fpos,datalen,lastfpos; int32_t baseid,limit,n,ht,isrealtime,expired,refid,blocks,longest; struct komodo_state *sp,*refsp; char *retstr,fname[512],*base,symbol[16],dest[16]; uint32_t buf[3],starttime; cJSON *infoobj,*result; uint64_t RTmask = 0; + FILE *fp; uint8_t *filedata; long fpos,datalen,lastfpos; int32_t baseid,limit,n,ht,isrealtime,expired,refid,blocks,longest; struct komodo_state *sp,*refsp; char *retstr,fname[512],*base,symbol[KOMODO_ASSETCHAIN_MAXLEN],dest[KOMODO_ASSETCHAIN_MAXLEN]; uint32_t buf[3],starttime; cJSON *infoobj,*result; uint64_t RTmask = 0; expired = 0; while ( KOMODO_INITDONE == 0 ) { diff --git a/src/komodo_globals.h b/src/komodo_globals.h index 2976deb8ec3..144064d7ac1 100644 --- a/src/komodo_globals.h +++ b/src/komodo_globals.h @@ -13,6 +13,8 @@ * * ******************************************************************************/ +#include "komodo_defs.h" + void komodo_stateupdate(int32_t height,uint8_t notarypubs[][33],uint8_t numnotaries,uint8_t notaryid,uint256 txhash,uint64_t voutmask,uint8_t numvouts,uint32_t *pvals,uint8_t numpvals,int32_t kheight,uint32_t ktime,uint64_t opretvalue,uint8_t *opretbuf,uint16_t opretlen,uint16_t vout); void komodo_init(int32_t height); int32_t komodo_notarizeddata(int32_t nHeight,uint256 *notarized_hashp,uint256 *notarized_desttxidp); @@ -30,6 +32,7 @@ pthread_mutex_t komodo_mutex; #define KOMODO_ELECTION_GAP 2000 //((ASSETCHAINS_SYMBOL[0] == 0) ? 2000 : 100) #define IGUANA_MAXSCRIPTSIZE 10001 +#define KOMODO_ASSETCHAIN_MAXLEN 65 struct pax_transaction *PAX; int32_t NUM_PRICES; uint32_t *PVALS; @@ -41,11 +44,11 @@ struct komodo_state KOMODO_STATES[34]; int COINBASE_MATURITY = _COINBASE_MATURITY;//100; int32_t 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; -int32_t KOMODO_LASTMINED,prevKOMODO_LASTMINED; +int32_t KOMODO_LASTMINED,prevKOMODO_LASTMINED,JUMBLR_PAUSE; std::string NOTARY_PUBKEY,ASSETCHAINS_NOTARIES; uint8_t NOTARY_PUBKEY33[33]; -char ASSETCHAINS_SYMBOL[16]; +char ASSETCHAINS_SYMBOL[KOMODO_ASSETCHAIN_MAXLEN]; uint16_t ASSETCHAINS_PORT; uint32_t ASSETCHAIN_INIT; uint32_t ASSETCHAINS_MAGIC = 2387029918; diff --git a/src/komodo_interest.h b/src/komodo_interest.h index 798eda48e3b..63d0152ca40 100644 --- a/src/komodo_interest.h +++ b/src/komodo_interest.h @@ -13,6 +13,8 @@ * * ******************************************************************************/ +#include "komodo_defs.h" + #define SATOSHIDEN ((uint64_t)100000000L) #define dstr(x) ((double)(x) / SATOSHIDEN) @@ -80,7 +82,7 @@ uint64_t komodo_moneysupply(int32_t height) uint64_t _komodo_interestnew(uint64_t nValue,uint32_t nLockTime,uint32_t tiptime) { int32_t minutes; uint64_t interest = 0; - if ( (minutes= (tiptime - nLockTime) / 60) >= 60 ) + if ( tiptime > nLockTime && (minutes= (tiptime - nLockTime) / 60) >= 60 ) { if ( minutes > 365 * 24 * 60 ) minutes = 365 * 24 * 60; diff --git a/src/komodo_jumblr.h b/src/komodo_jumblr.h index baafc6dbe71..951ed9de0d4 100755 --- a/src/komodo_jumblr.h +++ b/src/komodo_jumblr.h @@ -27,6 +27,7 @@ #ifdef _WIN32 #include #endif +#include "komodo_defs.h" #define JUMBLR_ADDR "RGhxXpXSSBTBm9EvNsXnTQczthMCxHX91t" #define JUMBLR_BTCADDR "18RmTJe9qMech8siuhYfMtHo8RtcN1obC6" @@ -629,6 +630,8 @@ void jumblr_iteration() { static int32_t lastheight; static uint32_t lasttime; char *zaddr,*addr,*retstr,secretaddr[64]; cJSON *array; int32_t i,iter,height,counter,chosen_one,n; uint64_t smallest,medium,biggest,amount=0,total=0; double fee; struct jumblr_item *ptr,*tmp; uint16_t r,s; + if ( JUMBLR_PAUSE != 0 ) + return; if ( lasttime == 0 ) { if ( (retstr= jumblr_zlistaddresses()) != 0 ) diff --git a/src/komodo_kv.h b/src/komodo_kv.h index 6d080069aae..0d86fadd02a 100644 --- a/src/komodo_kv.h +++ b/src/komodo_kv.h @@ -16,6 +16,8 @@ #ifndef H_KOMODOKV_H #define H_KOMODOKV_H +#include "komodo_defs.h" + int32_t komodo_kvcmp(uint8_t *refvalue,uint16_t refvaluesize,uint8_t *value,uint16_t valuesize) { if ( refvalue == 0 && value == 0 ) diff --git a/src/komodo_notary.h b/src/komodo_notary.h index 5e6b1707fea..a306f848faf 100644 --- a/src/komodo_notary.h +++ b/src/komodo_notary.h @@ -13,6 +13,8 @@ * * ******************************************************************************/ +#include "komodo_defs.h" + #include "komodo_cJSON.h" #define KOMODO_MAINNET_START 178999 @@ -307,7 +309,7 @@ void komodo_notarized_update(struct komodo_state *sp,int32_t nHeight,int32_t not //struct komodo_state *komodo_stateptr(char *symbol,char *dest); int32_t komodo_notarized_height(uint256 *hashp,uint256 *txidp) { - char symbol[16],dest[16]; struct komodo_state *sp; + char symbol[KOMODO_ASSETCHAIN_MAXLEN],dest[KOMODO_ASSETCHAIN_MAXLEN]; struct komodo_state *sp; if ( (sp= komodo_stateptr(symbol,dest)) != 0 ) { *hashp = sp->NOTARIZED_HASH; @@ -324,7 +326,7 @@ int32_t komodo_notarized_height(uint256 *hashp,uint256 *txidp) int32_t komodo_notarizeddata(int32_t nHeight,uint256 *notarized_hashp,uint256 *notarized_desttxidp) { - struct notarized_checkpoint *np = 0; int32_t i=0,flag = 0; char symbol[16],dest[16]; struct komodo_state *sp; + struct notarized_checkpoint *np = 0; int32_t i=0,flag = 0; char symbol[KOMODO_ASSETCHAIN_MAXLEN],dest[KOMODO_ASSETCHAIN_MAXLEN]; struct komodo_state *sp; if ( (sp= komodo_stateptr(symbol,dest)) != 0 ) { if ( sp->NUM_NPOINTS > 0 ) diff --git a/src/komodo_pax.h b/src/komodo_pax.h index d1713e23479..bcf6fa5d7e2 100644 --- a/src/komodo_pax.h +++ b/src/komodo_pax.h @@ -13,6 +13,8 @@ * * ******************************************************************************/ +#include "komodo_defs.h" + #define USD 0 #define EUR 1 #define JPY 2 diff --git a/src/komodo_structs.h b/src/komodo_structs.h index 8db0a6f43e8..40212c3e3d6 100644 --- a/src/komodo_structs.h +++ b/src/komodo_structs.h @@ -13,6 +13,8 @@ * * ******************************************************************************/ +#include "komodo_defs.h" + #include "uthash.h" #include "utlist.h" @@ -40,6 +42,7 @@ #define KOMODO_KVPROTECTED 1 #define KOMODO_KVBINARY 2 #define KOMODO_KVDURATION 1440 +#define KOMODO_ASSETCHAIN_MAXLEN 65 union _bits256 { uint8_t bytes[32]; uint16_t ushorts[16]; uint32_t uints[8]; uint64_t ulongs[4]; uint64_t txid; }; typedef union _bits256 bits256; @@ -60,7 +63,7 @@ struct komodo_event uint16_t len; int32_t height; uint8_t type,reorged; - char symbol[16]; + char symbol[KOMODO_ASSETCHAIN_MAXLEN]; uint8_t space[]; }; @@ -71,7 +74,7 @@ struct pax_transaction uint64_t komodoshis,fiatoshis,validated; int32_t marked,height,otherheight,approved,didstats,ready; uint16_t vout; - char symbol[16],source[16],coinaddr[64]; uint8_t rmd160[20],type,buf[35]; + char symbol[KOMODO_ASSETCHAIN_MAXLEN],source[KOMODO_ASSETCHAIN_MAXLEN],coinaddr[64]; uint8_t rmd160[20],type,buf[35]; }; struct knotary_entry { UT_hash_handle hh; uint8_t pubkey[33],notaryid; }; diff --git a/src/komodo_utils.h b/src/komodo_utils.h index 92577dae047..ef64ad75c1c 100644 --- a/src/komodo_utils.h +++ b/src/komodo_utils.h @@ -12,6 +12,8 @@ * Removal or modification of this copyright notice is prohibited. * * * ******************************************************************************/ +#include "komodo_defs.h" + #ifdef _WIN32 #include #include @@ -1402,7 +1404,7 @@ void komodo_configfile(char *symbol,uint16_t port) uint16_t komodo_userpass(char *userpass,char *symbol) { - FILE *fp; uint16_t port = 0; char fname[512],username[512],password[512],confname[16]; + FILE *fp; uint16_t port = 0; char fname[512],username[512],password[512],confname[KOMODO_ASSETCHAIN_MAXLEN]; userpass[0] = 0; if ( strcmp("KMD",symbol) == 0 ) { diff --git a/src/main.cpp b/src/main.cpp index e86a665ec2b..e067490729a 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1491,7 +1491,7 @@ bool ReadBlockFromDisk(CBlock& block, const CBlockIndex* pindex) } //uint64_t komodo_moneysupply(int32_t height); -extern char ASSETCHAINS_SYMBOL[16]; +extern char ASSETCHAINS_SYMBOL[KOMODO_ASSETCHAIN_MAXLEN]; extern uint32_t ASSETCHAINS_MAGIC; extern uint64_t ASSETCHAINS_SUPPLY; diff --git a/src/miner.cpp b/src/miner.cpp index 721b19cef5a..5c12d0af6fe 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -106,11 +106,10 @@ void UpdateTime(CBlockHeader* pblock, const Consensus::Params& consensusParams, pblock->nBits = GetNextWorkRequired(pindexPrev, pblock, consensusParams); } -#define ASSETCHAINS_MINHEIGHT 128 -#define KOMODO_ELECTION_GAP 2000 -#define ROUNDROBIN_DELAY 61 +#include "komodo_defs.h" + extern int32_t ASSETCHAINS_SEED,IS_KOMODO_NOTARY,USE_EXTERNAL_PUBKEY,KOMODO_CHOSEN_ONE,ASSETCHAIN_INIT,KOMODO_INITDONE,KOMODO_ON_DEMAND,KOMODO_INITDONE,KOMODO_PASSPORT_INITDONE; -extern char ASSETCHAINS_SYMBOL[16]; +extern char ASSETCHAINS_SYMBOL[KOMODO_ASSETCHAIN_MAXLEN]; extern std::string NOTARY_PUBKEY; extern uint8_t NOTARY_PUBKEY33[33]; uint32_t Mining_start,Mining_height; diff --git a/src/rpcblockchain.cpp b/src/rpcblockchain.cpp index 8088da58fa2..10f61776579 100644 --- a/src/rpcblockchain.cpp +++ b/src/rpcblockchain.cpp @@ -512,10 +512,12 @@ UniValue gettxoutsetinfo(const UniValue& params, bool fHelp) return ret; } +#include "komodo_defs.h" + #define IGUANA_MAXSCRIPTSIZE 10001 #define KOMODO_KVDURATION 1440 #define KOMODO_KVBINARY 2 -extern char ASSETCHAINS_SYMBOL[16]; +extern char ASSETCHAINS_SYMBOL[KOMODO_ASSETCHAIN_MAXLEN]; uint64_t komodo_interest(int32_t txheight,uint64_t nValue,uint32_t nLockTime,uint32_t tiptime); uint32_t komodo_txtime(uint256 hash); uint64_t komodo_paxprice(uint64_t *seedp,int32_t height,char *base,char *rel,uint64_t basevolume); diff --git a/src/rpcmisc.cpp b/src/rpcmisc.cpp index 42307470f46..6008e341dbe 100644 --- a/src/rpcmisc.cpp +++ b/src/rpcmisc.cpp @@ -47,7 +47,7 @@ uint64_t komodo_interestsum(); int32_t komodo_longestchain(); int32_t komodo_notarized_height(uint256 *hashp,uint256 *txidp); int32_t komodo_whoami(char *pubkeystr,int32_t height); -extern int32_t KOMODO_LASTMINED; +extern int32_t KOMODO_LASTMINED,JUMBLR_PAUSE; extern char ASSETCHAINS_SYMBOL[]; int32_t notarizedtxid_height(char *dest,char *txidstr,int32_t *kmdnotarized_heightp); #define KOMODO_VERSION "0.1.1" @@ -224,6 +224,26 @@ UniValue jumblr_secret(const UniValue& params, bool fHelp) return(result); } +UniValue jumblr_pause(const UniValue& params, bool fHelp) +{ + int32_t retval; UniValue result(UniValue::VOBJ); + if (fHelp ) + throw runtime_error("jumblr_pause\n"); + JUMBLR_PAUSE = 1; + result.push_back(Pair("result", "paused")); + return(result); +} + +UniValue jumblr_resume(const UniValue& params, bool fHelp) +{ + int32_t retval; UniValue result(UniValue::VOBJ); + if (fHelp ) + throw runtime_error("jumblr_resume\n"); + JUMBLR_PAUSE = 0; + result.push_back(Pair("result", "resumed")); + return(result); +} + UniValue validateaddress(const UniValue& params, bool fHelp) { if (fHelp || params.size() != 1) diff --git a/src/rpcrawtransaction.cpp b/src/rpcrawtransaction.cpp index 54f49798c59..dac9d49e84d 100644 --- a/src/rpcrawtransaction.cpp +++ b/src/rpcrawtransaction.cpp @@ -22,6 +22,8 @@ #include "wallet/wallet.h" #endif +#include "komodo_defs.h" + #include #include @@ -144,7 +146,7 @@ void TxToJSON(const CTransaction& tx, const uint256 hashBlock, UniValue& entry) out.push_back(Pair("value", ValueFromAmount(txout.nValue))); if ( pindex != 0 && tx.nLockTime != 0 && (tipindex= chainActive.Tip()) != 0 ) { - extern char ASSETCHAINS_SYMBOL[16]; + extern char ASSETCHAINS_SYMBOL[KOMODO_ASSETCHAIN_MAXLEN]; interest = komodo_interest(pindex->nHeight,txout.nValue,tx.nLockTime,tipindex->nTime); if ( 0 && strcmp("REVS",ASSETCHAINS_SYMBOL) == 0 ) fprintf(stderr,"TxtoJSON interest %llu %.8f (%d %llu %u %u)\n",(long long)interest,(double)interest/COIN,(int32_t)pindex->nHeight,(long long)txout.nValue,(uint32_t)tx.nLockTime,(int32_t)tipindex->nTime); diff --git a/src/rpcserver.cpp b/src/rpcserver.cpp index 518ba4693da..94521004de4 100644 --- a/src/rpcserver.cpp +++ b/src/rpcserver.cpp @@ -338,6 +338,8 @@ static const CRPCCommand vRPCCommands[] = { "util", "z_validateaddress", &z_validateaddress, true }, /* uses wallet if enabled */ { "util", "jumblr_deposit", &jumblr_deposit, true }, { "util", "jumblr_secret", &jumblr_secret, true }, + { "util", "jumblr_pause", &jumblr_pause, true }, + { "util", "jumblr_resume", &jumblr_resume, true }, /* Not shown in help */ { "hidden", "invalidateblock", &invalidateblock, true }, diff --git a/src/rpcserver.h b/src/rpcserver.h index ecf7b0573fd..f5997247244 100644 --- a/src/rpcserver.h +++ b/src/rpcserver.h @@ -248,6 +248,8 @@ extern UniValue zc_sample_joinsplit(const UniValue& params, bool fHelp); extern UniValue jumblr_deposit(const UniValue& params, bool fHelp); extern UniValue jumblr_secret(const UniValue& params, bool fHelp); +extern UniValue jumblr_pause(const UniValue& params, bool fHelp); +extern UniValue jumblr_resume(const UniValue& params, bool fHelp); extern UniValue getrawtransaction(const UniValue& params, bool fHelp); // in rcprawtransaction.cpp extern UniValue listunspent(const UniValue& params, bool fHelp); diff --git a/src/util.cpp b/src/util.cpp index ec83e17ce8e..be75175733f 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -15,6 +15,7 @@ #include "sync.h" #include "utilstrencodings.h" #include "utiltime.h" +#include "komodo_defs.h" #include @@ -441,13 +442,13 @@ void PrintExceptionContinue(const std::exception* pex, const char* pszThread) strMiscWarning = message; } -extern char ASSETCHAINS_SYMBOL[16]; +extern char ASSETCHAINS_SYMBOL[KOMODO_ASSETCHAIN_MAXLEN]; //int64_t MAX_MONEY = 200000000 * 100000000LL; boost::filesystem::path GetDefaultDataDir() { namespace fs = boost::filesystem; - char symbol[16]; + char symbol[KOMODO_ASSETCHAIN_MAXLEN]; if ( ASSETCHAINS_SYMBOL[0] != 0 ) strcpy(symbol,ASSETCHAINS_SYMBOL); else symbol[0] = 0; diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index ee9fb71bb84..dbc3aab848d 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -471,6 +471,7 @@ UniValue sendtoaddress(const UniValue& params, bool fHelp) return wtx.GetHash().GetHex(); } +#include "komodo_defs.h" #define KOMODO_KVPROTECTED 1 #define KOMODO_KVBINARY 2 @@ -479,7 +480,7 @@ UniValue sendtoaddress(const UniValue& params, bool fHelp) uint64_t PAX_fiatdest(uint64_t *seedp,int32_t tokomodo,char *destaddr,uint8_t pubkey37[37],char *coinaddr,int32_t height,char *base,int64_t fiatoshis); int32_t komodo_opreturnscript(uint8_t *script,uint8_t type,uint8_t *opret,int32_t opretlen); #define CRYPTO777_KMDADDR "RXL3YXG2ceaB6C5hfJcN4fvmLH2C34knhA" -extern char ASSETCHAINS_SYMBOL[16]; +extern char ASSETCHAINS_SYMBOL[KOMODO_ASSETCHAIN_MAXLEN]; extern int32_t KOMODO_PAX; int32_t komodo_is_issuer(); int32_t iguana_rwnum(int32_t rwflag,uint8_t *serialized,int32_t len,void *endianedp); @@ -614,7 +615,9 @@ UniValue paxdeposit(const UniValue& params, bool fHelp) uint64_t available,deposited,issued,withdrawn,approved,redeemed,seed,komodoshis = 0; int32_t height; char destaddr[64]; uint8_t i,pubkey37[33]; bool fSubtractFeeFromAmount = false; if ( KOMODO_PAX == 0 ) - throw JSONRPCError(RPC_TYPE_ERROR, "paxdeposit disabled, since pax not enabled with komodod -pax"); + { + throw runtime_error("paxdeposit dispabled without -pax"); + } if ( komodo_is_issuer() != 0 ) throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "paxdeposit only from KMD"); if (!EnsureWalletIsAvailable(fHelp)) diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index a2aa336615f..341b2bf5a56 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -37,8 +37,10 @@ unsigned int nTxConfirmTarget = DEFAULT_TX_CONFIRM_TARGET; bool bSpendZeroConfChange = true; bool fSendFreeTransactions = false; bool fPayAtLeastCustomFee = true; +#include "komodo_defs.h" + extern int32_t KOMODO_EXCHANGEWALLET; -extern char ASSETCHAINS_SYMBOL[16]; +extern char ASSETCHAINS_SYMBOL[KOMODO_ASSETCHAIN_MAXLEN]; /** * Fees smaller than this (in satoshi) are considered zero fee (for transaction creation) @@ -2747,7 +2749,7 @@ bool CWallet::CreateTransaction(const vector& vecSend, CWalletTx& wt //interest = 0; // interest2 also //} CAmount nChange = (nValueIn - nValue + interest2); -fprintf(stderr,"wallet change %.8f (%.8f - %.8f) interest2 %.8f total %.8f\n",(double)nChange/COIN,(double)nValueIn/COIN,(double)nValue/COIN,(double)interest2/COIN,(double)nTotalValue/COIN); +//fprintf(stderr,"wallet change %.8f (%.8f - %.8f) interest2 %.8f total %.8f\n",(double)nChange/COIN,(double)nValueIn/COIN,(double)nValue/COIN,(double)interest2/COIN,(double)nTotalValue/COIN); if (nSubtractFeeFromAmount == 0) nChange -= nFeeRet; diff --git a/src/zcash/CreateJoinSplit.cpp b/src/zcash/CreateJoinSplit.cpp index f29b2ec8239..9c7760e4f57 100644 --- a/src/zcash/CreateJoinSplit.cpp +++ b/src/zcash/CreateJoinSplit.cpp @@ -6,7 +6,8 @@ #include "primitives/transaction.h" #include "zcash/JoinSplit.hpp" #include "libsnark/common/profiling.hpp" -char ASSETCHAINS_SYMBOL[16]; +#include "komodo_defs.h" +char ASSETCHAINS_SYMBOL[KOMODO_ASSETCHAIN_MAXLEN]; int64_t MAX_MONEY = 200000000 * 100000000LL; uint16_t BITCOIND_PORT = 7771;