From 6cd0105666fa2f5fd5a46986cb72b452a330700c Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 15 Dec 2016 10:28:07 +0200 Subject: [PATCH 01/12] dpowassets and -pax option --- src/assetchains | 46 --------------------------------------- src/dpowassets | 52 ++++++++++++++++++++++++++++++++++++++++++++ src/komodo_gateway.h | 19 ++++++++++++++++ src/komodo_globals.h | 2 +- src/komodo_utils.h | 3 +++ src/miner.cpp | 2 +- 6 files changed, 76 insertions(+), 48 deletions(-) create mode 100755 src/dpowassets diff --git a/src/assetchains b/src/assetchains index adb4b59d1..10129742e 100755 --- a/src/assetchains +++ b/src/assetchains @@ -48,49 +48,3 @@ echo $pubkey ./komodod -pubkey=$pubkey -ac_name=IDR -addnode=78.47.196.146 $1 & ./komodod -pubkey=$pubkey -ac_name=HRK -addnode=78.47.196.146 $1 & -curl --url "http://127.0.0.1:7776" --data "{\"timeout\":60000,\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"REVS\",\"pubkey\":\"$pubkey\"}" - -curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"SUPERNET\",\"pubkey\":\"$pubkey\"}" -curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"DEX\",\"pubkey\":\"$pubkey\"}" -curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"PANGEA\",\"pubkey\":\"$pubkey\"}" -curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"JUMBLR\",\"pubkey\":\"$pubkey\"}" -curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"BET\",\"pubkey\":\"$pubkey\"}" -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\":\"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\":\"USD\",\"pubkey\":\"$pubkey\"}" -curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"EUR\",\"pubkey\":\"$pubkey\"}" - -curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"JPY\",\"pubkey\":\"$pubkey\"}" -curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"GBP\",\"pubkey\":\"$pubkey\"}" -curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"AUD\",\"pubkey\":\"$pubkey\"}" -curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"CAD\",\"pubkey\":\"$pubkey\"}" -curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"CHF\",\"pubkey\":\"$pubkey\"}" -curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"NZD\",\"pubkey\":\"$pubkey\"}" -curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"CNY\",\"pubkey\":\"$pubkey\"}" -curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"RUB\",\"pubkey\":\"$pubkey\"}" -curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"MXN\",\"pubkey\":\"$pubkey\"}" -curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"BRL\",\"pubkey\":\"$pubkey\"}" -curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"INR\",\"pubkey\":\"$pubkey\"}" -curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"HKD\",\"pubkey\":\"$pubkey\"}" -curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"TRY\",\"pubkey\":\"$pubkey\"}" -curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"ZAR\",\"pubkey\":\"$pubkey\"}" -curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"PLN\",\"pubkey\":\"$pubkey\"}" -curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"NOK\",\"pubkey\":\"$pubkey\"}" -curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"SEK\",\"pubkey\":\"$pubkey\"}" -curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"DKK\",\"pubkey\":\"$pubkey\"}" -curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"CZK\",\"pubkey\":\"$pubkey\"}" -curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"HUF\",\"pubkey\":\"$pubkey\"}" -curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"ILS\",\"pubkey\":\"$pubkey\"}" -curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"KRW\",\"pubkey\":\"$pubkey\"}" -curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"MYR\",\"pubkey\":\"$pubkey\"}" -curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"PHP\",\"pubkey\":\"$pubkey\"}" -curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"RON\",\"pubkey\":\"$pubkey\"}" -curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"SGD\",\"pubkey\":\"$pubkey\"}" -curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"THB\",\"pubkey\":\"$pubkey\"}" -curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"BGN\",\"pubkey\":\"$pubkey\"}" -curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"IDR\",\"pubkey\":\"$pubkey\"}" -curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"HRK\",\"pubkey\":\"$pubkey\"}" - diff --git a/src/dpowassets b/src/dpowassets new file mode 100755 index 000000000..e0690e019 --- /dev/null +++ b/src/dpowassets @@ -0,0 +1,52 @@ +#!/bin/bash +set -x +source pubkey.txt +echo $pubkey + + +curl --url "http://127.0.0.1:7776" --data "{\"timeout\":60000,\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"REVS\",\"pubkey\":\"$pubkey\"}" + +curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"SUPERNET\",\"pubkey\":\"$pubkey\"}" +curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"DEX\",\"pubkey\":\"$pubkey\"}" +curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"PANGEA\",\"pubkey\":\"$pubkey\"}" +curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"JUMBLR\",\"pubkey\":\"$pubkey\"}" +curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"BET\",\"pubkey\":\"$pubkey\"}" +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\":\"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\":\"USD\",\"pubkey\":\"$pubkey\"}" +curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"EUR\",\"pubkey\":\"$pubkey\"}" + +curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"JPY\",\"pubkey\":\"$pubkey\"}" +curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"GBP\",\"pubkey\":\"$pubkey\"}" +curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"AUD\",\"pubkey\":\"$pubkey\"}" +curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"CAD\",\"pubkey\":\"$pubkey\"}" +curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"CHF\",\"pubkey\":\"$pubkey\"}" +curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"NZD\",\"pubkey\":\"$pubkey\"}" +curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"CNY\",\"pubkey\":\"$pubkey\"}" +curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"RUB\",\"pubkey\":\"$pubkey\"}" +curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"MXN\",\"pubkey\":\"$pubkey\"}" +curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"BRL\",\"pubkey\":\"$pubkey\"}" +curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"INR\",\"pubkey\":\"$pubkey\"}" +curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"HKD\",\"pubkey\":\"$pubkey\"}" +curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"TRY\",\"pubkey\":\"$pubkey\"}" +curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"ZAR\",\"pubkey\":\"$pubkey\"}" +curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"PLN\",\"pubkey\":\"$pubkey\"}" +curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"NOK\",\"pubkey\":\"$pubkey\"}" +curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"SEK\",\"pubkey\":\"$pubkey\"}" +curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"DKK\",\"pubkey\":\"$pubkey\"}" +curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"CZK\",\"pubkey\":\"$pubkey\"}" +curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"HUF\",\"pubkey\":\"$pubkey\"}" +curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"ILS\",\"pubkey\":\"$pubkey\"}" +curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"KRW\",\"pubkey\":\"$pubkey\"}" +curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"MYR\",\"pubkey\":\"$pubkey\"}" +curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"PHP\",\"pubkey\":\"$pubkey\"}" +curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"RON\",\"pubkey\":\"$pubkey\"}" +curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"SGD\",\"pubkey\":\"$pubkey\"}" +curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"THB\",\"pubkey\":\"$pubkey\"}" +curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"BGN\",\"pubkey\":\"$pubkey\"}" +curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"IDR\",\"pubkey\":\"$pubkey\"}" +curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"HRK\",\"pubkey\":\"$pubkey\"}" + diff --git a/src/komodo_gateway.h b/src/komodo_gateway.h index dd7f59d86..e2cc32350 100644 --- a/src/komodo_gateway.h +++ b/src/komodo_gateway.h @@ -90,6 +90,8 @@ struct pax_transaction *komodo_paxmark(int32_t height,uint256 txid,uint16_t vout 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; + if ( KOMODO_PAX == 0 ) + return; sp = komodo_stateptr(str,dest); pthread_mutex_lock(&komodo_mutex); pax_keyset(buf,txid,vout,type); @@ -178,6 +180,8 @@ 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]; + if ( KOMODO_PAX == 0 ) + return(0); incr = 34 + (iskomodo * (2*sizeof(fiatoshis) + 2*sizeof(height) + 20 + 4)); for (i=0; i<4; i++) base[i] = opretbuf[opretlen-4+i]; @@ -265,6 +269,8 @@ 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; + if ( KOMODO_PAX == 0 ) + return(0); if ( komodo_isrealtime(&ht) == 0 ) return(0); else @@ -383,6 +389,8 @@ static int _paxorder(const void *a,const void *b) int32_t komodo_pending_withdraws(char *opretstr) // todo: enforce deterministic order { struct pax_transaction *pax,*tmp,*paxes[64]; uint8_t opretbuf[16384]; int32_t i,n,ht,len=0; uint64_t total = 0; + if ( KOMODO_PAX == 0 ) + return(0); if ( komodo_isrealtime(&ht) == 0 || ASSETCHAINS_SYMBOL[0] != 0 ) return(0); n = 0; @@ -419,6 +427,8 @@ 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; + if ( KOMODO_PAX == 0 ) + return(0); sp = komodo_stateptr(symbol,dest); strcpy(symbol,base); if ( ASSETCHAINS_SYMBOL[0] != 0 && komodo_baseid(ASSETCHAINS_SYMBOL) < 0 ) @@ -506,6 +516,8 @@ int32_t komodo_gateway_deposits(CMutableTransaction *txNew,char *base,int32_t to int32_t komodo_check_deposit(int32_t height,const CBlock& block) // verify above block is valid pax pricing { int32_t i,j,n,num,opretlen,offset=1,errs=0,matched=0,kmdheights[64],otherheights[64]; uint256 hash,txids[64]; char symbol[16],base[16]; uint16_t vouts[64]; int8_t baseids[64]; uint8_t *script,opcode,rmd160s[64*20]; uint64_t available,deposited,issued,withdrawn,approved,redeemed; int64_t values[64],srcvalues[64]; struct pax_transaction *pax; + if ( KOMODO_PAX == 0 ) + return(0); memset(baseids,0xff,sizeof(baseids)); memset(values,0,sizeof(values)); memset(srcvalues,0,sizeof(srcvalues)); @@ -597,6 +609,8 @@ const char *komodo_opreturn(int32_t height,uint64_t value,uint8_t *opretbuf,int3 { uint8_t rmd160[20],rmd160s[64*20],addrtype,shortflag,pubkey33[33]; int32_t didstats,i,j,n,len,tokomodo,kmdheight,otherheights[64],kmdheights[64]; int8_t baseids[64]; char base[4],coinaddr[64],destaddr[64]; uint256 txids[64]; uint16_t vouts[64]; uint64_t convtoshis,seed; int64_t fiatoshis,komodoshis,checktoshis,values[64],srcvalues[64]; struct pax_transaction *pax,*pax2; struct komodo_state *basesp; double diff; const char *typestr = "unknown"; + if ( KOMODO_PAX == 0 ) + return("nopax"); if ( ASSETCHAINS_SYMBOL[0] != 0 && komodo_baseid(ASSETCHAINS_SYMBOL) < 0 ) { //printf("komodo_opreturn skip %s\n",ASSETCHAINS_SYMBOL); @@ -886,6 +900,11 @@ void komodo_passport_iteration() return; } } + if ( KOMODO_PAX == 0 ) + { + KOMODO_PASSPORT_INITDONE = 1; + return; + } //printf("PASSPORT %s refid.%d\n",ASSETCHAINS_SYMBOL,refid); for (baseid=32; baseid>=0; baseid--) { diff --git a/src/komodo_globals.h b/src/komodo_globals.h index 7c8b7126d..88e24cddc 100644 --- a/src/komodo_globals.h +++ b/src/komodo_globals.h @@ -36,7 +36,7 @@ struct komodo_state KOMODO_STATES[34]; int COINBASE_MATURITY = 100; -int32_t IS_KOMODO_NOTARY,KOMODO_REWIND,USE_EXTERNAL_PUBKEY,KOMODO_CHOSEN_ONE,ASSETCHAINS_SEED,KOMODO_ON_DEMAND,KOMODO_EXTERNAL_NOTARIES,KOMODO_PASSPORT_INITDONE; +int32_t IS_KOMODO_NOTARY,KOMODO_REWIND,USE_EXTERNAL_PUBKEY,KOMODO_CHOSEN_ONE,ASSETCHAINS_SEED,KOMODO_ON_DEMAND,KOMODO_EXTERNAL_NOTARIES,KOMODO_PASSPORT_INITDONE,KOMODO_PAX; std::string NOTARY_PUBKEY,ASSETCHAINS_NOTARIES; uint8_t NOTARY_PUBKEY33[33]; diff --git a/src/komodo_utils.h b/src/komodo_utils.h index 15562669d..cab3983fd 100644 --- a/src/komodo_utils.h +++ b/src/komodo_utils.h @@ -1448,7 +1448,10 @@ void komodo_args() IS_KOMODO_NOTARY = GetBoolArg("-notary", false); NOTARY_PUBKEY = GetArg("-pubkey", ""); if ( strlen(NOTARY_PUBKEY.c_str()) == 66 ) + { USE_EXTERNAL_PUBKEY = 1; + KOMODO_PAX = 1; + } else KOMODO_PAX = GetArg("-pax",0); name = GetArg("-ac_name",""); if ( (KOMODO_REWIND= GetArg("-rewind",0)) != 0 ) ; diff --git a/src/miner.cpp b/src/miner.cpp index a5a150c20..8b861c520 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -100,7 +100,7 @@ void UpdateTime(CBlockHeader* pblock, const Consensus::Params& consensusParams, #define ASSETCHAINS_MINHEIGHT 100 #define KOMODO_ELECTION_GAP 2000 -#define ROUNDROBIN_DELAY 57 +#define ROUNDROBIN_DELAY 56 extern int32_t ASSETCHAINS_SEED,IS_KOMODO_NOTARY,USE_EXTERNAL_PUBKEY,KOMODO_CHOSEN_ONE,ASSETCHAIN_INIT,KOMODO_INITDONE,KOMODO_ON_DEMAND,KOMODO_INITDONE; extern char ASSETCHAINS_SYMBOL[16]; extern std::string NOTARY_PUBKEY; From 05654b62c4da4aa9c4e1359d1640b1c0cb1bbf64 Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 15 Dec 2016 10:45:10 +0200 Subject: [PATCH 02/12] test --- src/komodo.h | 2 -- src/main.cpp | 1 - 2 files changed, 3 deletions(-) diff --git a/src/komodo.h b/src/komodo.h index b6aaa4c2d..8e84a6e02 100644 --- a/src/komodo.h +++ b/src/komodo.h @@ -284,7 +284,6 @@ void komodo_stateupdate(int32_t height,uint8_t notarypubs[][33],uint8_t numnotar errs++; //komodo_eventadd_utxo(sp,symbol,height,notaryid,txhash,voutmask,numvouts); } -//#ifdef KOMODO_PAX else if ( pvals != 0 && numpvals > 0 ) { int32_t i,nonz = 0; @@ -304,7 +303,6 @@ void komodo_stateupdate(int32_t height,uint8_t notarypubs[][33],uint8_t numnotar } //printf("save pvals height.%d numpvals.%d\n",height,numpvals); } -//#endif else if ( height != 0 ) { //printf("ht.%d func N ht.%d errs.%d\n",height,NOTARIZED_HEIGHT,errs); diff --git a/src/main.cpp b/src/main.cpp index 338bed053..f24cfedbd 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -551,7 +551,6 @@ CBlockTreeDB *pblocktree = NULL; // Komodo globals -#define KOMODO_PAX #define KOMODO_ZCASH #include "komodo.h" From ca3df017f001ff048670e4de888a9ae01ba3ded0 Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 15 Dec 2016 12:27:05 +0200 Subject: [PATCH 03/12] test --- src/komodo_gateway.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/komodo_gateway.h b/src/komodo_gateway.h index e2cc32350..745d16a0a 100644 --- a/src/komodo_gateway.h +++ b/src/komodo_gateway.h @@ -311,7 +311,7 @@ uint64_t komodo_paxtotal() } else if ( pax->validated == 0 ) { - pax->validated = pax->komodoshis; + pax->validated = pax->checktoshis; if ( strcmp(str,ASSETCHAINS_SYMBOL) == 0 ) printf("got WITHDRAW.%s kmd.%d ht.%d %.8f -> %.8f/%.8f\n",pax->source,pax->height,pax->otherheight,dstr(pax->fiatoshis),dstr(pax->komodoshis),dstr(checktoshis)); } From 9767b7c496247d37ac981a27ee7ab3670dc52ac2 Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 15 Dec 2016 12:29:52 +0200 Subject: [PATCH 04/12] test --- src/komodo_gateway.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/komodo_gateway.h b/src/komodo_gateway.h index 745d16a0a..febf0f0bf 100644 --- a/src/komodo_gateway.h +++ b/src/komodo_gateway.h @@ -311,7 +311,7 @@ uint64_t komodo_paxtotal() } else if ( pax->validated == 0 ) { - pax->validated = pax->checktoshis; + pax->validated = checktoshis; if ( strcmp(str,ASSETCHAINS_SYMBOL) == 0 ) printf("got WITHDRAW.%s kmd.%d ht.%d %.8f -> %.8f/%.8f\n",pax->source,pax->height,pax->otherheight,dstr(pax->fiatoshis),dstr(pax->komodoshis),dstr(checktoshis)); } From db7becdc1ce4780804fd6bd97168fb63ae31694b Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 15 Dec 2016 12:55:24 +0200 Subject: [PATCH 05/12] test --- src/komodo_gateway.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/komodo_gateway.h b/src/komodo_gateway.h index febf0f0bf..db1b388f2 100644 --- a/src/komodo_gateway.h +++ b/src/komodo_gateway.h @@ -304,7 +304,7 @@ uint64_t komodo_paxtotal() //bitcoin_address(coinaddr,addrtype,rmd160,20); if ( (checktoshis= komodo_paxprice(&seed,pax->height,pax->source,(char *)"KMD",(uint64_t)pax->fiatoshis)) != 0 ) { - if ( komodo_paxcmp(pax->source,pax->height,pax->komodoshis,checktoshis,seed) == 0 ) + if ( komodo_paxcmp(pax->source,pax->height,pax->komodoshis,checktoshis,seed) != 0 ) { pax->marked = pax->height; //printf("WITHDRAW.%s mark <- %d %.8f != %.8f\n",pax->source,pax->height,dstr(checktoshis),dstr(pax->komodoshis)); From d400310583792afed7d57082f368b8ccaf05fb30 Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 15 Dec 2016 13:01:38 +0200 Subject: [PATCH 06/12] test --- src/komodo_gateway.h | 4 ++-- src/komodo_pax.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/komodo_gateway.h b/src/komodo_gateway.h index db1b388f2..9d54f8bb8 100644 --- a/src/komodo_gateway.h +++ b/src/komodo_gateway.h @@ -311,7 +311,7 @@ uint64_t komodo_paxtotal() } else if ( pax->validated == 0 ) { - pax->validated = checktoshis; + pax->validated = pax->komodoshis = checktoshis; if ( strcmp(str,ASSETCHAINS_SYMBOL) == 0 ) printf("got WITHDRAW.%s kmd.%d ht.%d %.8f -> %.8f/%.8f\n",pax->source,pax->height,pax->otherheight,dstr(pax->fiatoshis),dstr(pax->komodoshis),dstr(checktoshis)); } @@ -637,7 +637,7 @@ const char *komodo_opreturn(int32_t height,uint64_t value,uint8_t *opretbuf,int3 if ( kmdheight <= height ) { didstats = 0; - if ( strcmp(base,ASSETCHAINS_SYMBOL) == 0 ) + if ( 0 && strcmp(base,ASSETCHAINS_SYMBOL) == 0 ) { printf("(%s) (%s) kmdheight.%d vs height.%d check %.8f vs %.8f tokomodo.%d %d seed.%llx\n",ASSETCHAINS_SYMBOL,base,kmdheight,height,dstr(checktoshis),dstr(value),komodo_is_issuer(),strncmp(ASSETCHAINS_SYMBOL,base,strlen(base)) == 0,(long long)seed); for (i=0; i<32; i++) diff --git a/src/komodo_pax.h b/src/komodo_pax.h index dbeab48cf..69f31ae20 100644 --- a/src/komodo_pax.h +++ b/src/komodo_pax.h @@ -530,7 +530,7 @@ uint64_t PAX_fiatdest(uint64_t *seedp,int32_t tokomodo,char *destaddr,uint8_t pu if ( fiatoshis < 0 ) shortflag = 1, fiatoshis = -fiatoshis; komodoshis = komodo_paxprice(seedp,height,base,(char *)"KMD",(uint64_t)fiatoshis); - if ( strcmp(base,"RUB") == 0 ) + if ( 0 && strcmp(base,"RUB") == 0 ) printf("PAX_fiatdest ht.%d price %s %.8f -> KMD %.8f seed.%llx\n",height,base,(double)fiatoshis/COIN,(double)komodoshis/COIN,(long long)*seedp); if ( bitcoin_addr2rmd160(&addrtype,rmd160,coinaddr) == 20 ) { From bb40eb8b043a1e63c3dc3b1c2e4d0f6e67e771d4 Mon Sep 17 00:00:00 2001 From: Mihail Fedorov Date: Fri, 16 Dec 2016 02:01:50 +0300 Subject: [PATCH 07/12] Docker stuff again --- Dockerfile | 17 +++-------------- zcutil/docker-entrypoint.sh | 9 ++------- zcutil/docker-komodo-cli.sh | 9 ++------- 3 files changed, 7 insertions(+), 28 deletions(-) diff --git a/Dockerfile b/Dockerfile index 37efb1c0e..71136b3af 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,15 +1,5 @@ -FROM ubuntu:16.04 -MAINTAINER Mihail Fedorov - -# All the stuff -# And clean out packages, keep space minimal -RUN apt-get -y update && \ - apt-get -y upgrade && \ - apt-get -y install build-essential pkg-config libc6-dev m4 g++-multilib autoconf libtool ncurses-dev \ - unzip python zlib1g-dev wget bsdmainutils automake libboost-all-dev libssl-dev libprotobuf-dev \ - protobuf-compiler libqt4-dev libqrencode-dev libdb++-dev software-properties-common libcurl4-openssl-dev && \ - apt-get clean && \ - rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* +FROM kolobus/ubuntu:komodo +MAINTAINER Mihail Fedorov ADD ./ /komodo ENV HOME /komodo @@ -19,7 +9,7 @@ WORKDIR /komodo RUN cd /komodo && \ ./autogen.sh && \ ./configure --with-incompatible-bdb --with-gui || true && \ - ./zcutil/build.sh -j4 + ./zcutil/build.sh -j$(nproc) # Unknown stuff goes here @@ -28,4 +18,3 @@ RUN ln -sf /komodo/src/komodod /usr/bin/komodod && \ ln -sf /komodo/zcutil/docker-komodo-cli.sh /usr/bin/komodo-cli CMD ["entrypoint"] - diff --git a/zcutil/docker-entrypoint.sh b/zcutil/docker-entrypoint.sh index c7df89d70..aae6fc7e4 100755 --- a/zcutil/docker-entrypoint.sh +++ b/zcutil/docker-entrypoint.sh @@ -14,12 +14,6 @@ rpcpassword=${rpcpassword:-`dd if=/dev/urandom bs=33 count=1 2>/dev/null | base6 txindex=1 bind=${listenip:-127.0.0.1} rpcbind=${listenip:-127.0.0.1} -addnode=5.9.102.210 -addnode=78.47.196.146 -addnode=178.63.69.164 -addnode=88.198.65.74 -addnode=5.9.122.241 -addnode=144.76.94.38 EOF cat $HOME/.komodo/komodo.conf @@ -27,9 +21,10 @@ fi echo "...Checking fetch-params" $HOME/zcutil/fetch-params.sh - echo "Initialization completed successfully" echo + +# ToDo: Needs some rework. I was sick if [ $# -gt 0 ]; then args=("$@") diff --git a/zcutil/docker-komodo-cli.sh b/zcutil/docker-komodo-cli.sh index 3b555725f..121587bdf 100755 --- a/zcutil/docker-komodo-cli.sh +++ b/zcutil/docker-komodo-cli.sh @@ -1,11 +1,6 @@ #!/bin/bash -if [ -z ${assetchain+x} ]; then - /komodo/src/komodo-cli $1 $2 $3 $4 +# ToDo: check for docker arg ac_name -else - - /komodo/src/komodo-cli -ac_name=$assetchain $1 $2 $3 $4 - -fi +/komodo/src/komodo-cli $1 $2 $3 $4 From 7d2c861cbc0cbc589238b3e40234d831cfd4e08a Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 16 Dec 2016 13:21:48 +0200 Subject: [PATCH 08/12] test --- src/miner.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/miner.cpp b/src/miner.cpp index 8b861c520..d0d6c7495 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -132,7 +132,7 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn) deposits = komodo_paxtotal(); if ( KOMODO_INITDONE == 0 || (komodo_baseid(ASSETCHAINS_SYMBOL) >= 0 && (isrealtime= komodo_isrealtime(&kmdheight)) == 0) ) { - //fprintf(stderr,"INITDONE.%d RT.%d deposits %.8f ht.%d\n",KOMODO_INITDONE,isrealtime,(double)deposits/COIN,kmdheight); + fprintf(stderr,"INITDONE.%d RT.%d deposits %.8f ht.%d\n",KOMODO_INITDONE,isrealtime,(double)deposits/COIN,kmdheight); } else if ( deposits != 0 || (int32_t)mempool.GetTotalTxSize() > 0 ) { @@ -478,7 +478,7 @@ CBlockTemplate* CreateNewBlockWithKey(CReserveKey& reservekey) script[34] = OP_CHECKSIG; //scriptPubKey = CScript() << ToByteVector(pubkey) << OP_CHECKSIG; } - if ( 0 && ASSETCHAINS_SYMBOL[0] == 0 ) + if ( ASSETCHAINS_SYMBOL[0] != 0 ) { for (i=0; i<65; i++) fprintf(stderr,"%d ",komodo_minerid(chainActive.Tip()->nHeight-i)); @@ -629,7 +629,7 @@ void static BitcoinMiner(CWallet *pwallet) { if ( ASSETCHAINS_SYMBOL[0] != 0 && pblock->vtx[0].vout.size() == 1 && Mining_height > ASSETCHAINS_MINHEIGHT ) { - //fprintf(stderr,"skip generating %s on-demand block, no tx avail\n",ASSETCHAINS_SYMBOL); + fprintf(stderr,"skip generating %s on-demand block, no tx avail\n",ASSETCHAINS_SYMBOL); sleep(10); break; } From d5dfbb184e37c7cce3bf7713cae43e79c6394182 Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 16 Dec 2016 13:36:57 +0200 Subject: [PATCH 09/12] test --- src/miner.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/miner.cpp b/src/miner.cpp index d0d6c7495..142757f62 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -424,7 +424,7 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn) if ( !TestBlockValidity(state, *pblock, pindexPrev, false, false)) { fprintf(stderr,"testblockvalidity failed\n"); - //throw std::runtime_error("CreateNewBlock(): TestBlockValidity failed"); + throw std::runtime_error("CreateNewBlock(): TestBlockValidity failed"); } } @@ -627,7 +627,7 @@ void static BitcoinMiner(CWallet *pwallet) } else Mining_start = 0; while (true) { - if ( ASSETCHAINS_SYMBOL[0] != 0 && pblock->vtx[0].vout.size() == 1 && Mining_height > ASSETCHAINS_MINHEIGHT ) + if ( 0 && ASSETCHAINS_SYMBOL[0] != 0 && pblock->vtx[0].vout.size() == 1 && Mining_height > ASSETCHAINS_MINHEIGHT ) { fprintf(stderr,"skip generating %s on-demand block, no tx avail\n",ASSETCHAINS_SYMBOL); sleep(10); From bbaa688c6238e361783a236ecbd1d91e6bef2ae7 Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 16 Dec 2016 14:24:16 +0200 Subject: [PATCH 10/12] test --- src/miner.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/miner.cpp b/src/miner.cpp index 142757f62..2f58e7733 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -132,7 +132,7 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn) deposits = komodo_paxtotal(); if ( KOMODO_INITDONE == 0 || (komodo_baseid(ASSETCHAINS_SYMBOL) >= 0 && (isrealtime= komodo_isrealtime(&kmdheight)) == 0) ) { - fprintf(stderr,"INITDONE.%d RT.%d deposits %.8f ht.%d\n",KOMODO_INITDONE,isrealtime,(double)deposits/COIN,kmdheight); + //fprintf(stderr,"INITDONE.%d RT.%d deposits %.8f ht.%d\n",KOMODO_INITDONE,isrealtime,(double)deposits/COIN,kmdheight); } else if ( deposits != 0 || (int32_t)mempool.GetTotalTxSize() > 0 ) { @@ -478,7 +478,7 @@ CBlockTemplate* CreateNewBlockWithKey(CReserveKey& reservekey) script[34] = OP_CHECKSIG; //scriptPubKey = CScript() << ToByteVector(pubkey) << OP_CHECKSIG; } - if ( ASSETCHAINS_SYMBOL[0] != 0 ) + if ( 0 && ASSETCHAINS_SYMBOL[0] != 0 ) { for (i=0; i<65; i++) fprintf(stderr,"%d ",komodo_minerid(chainActive.Tip()->nHeight-i)); From 856fedeabc7c9569b16584f4c9614c3cd911aa06 Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 16 Dec 2016 14:53:28 +0200 Subject: [PATCH 11/12] test --- src/komodo_gateway.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/komodo_gateway.h b/src/komodo_gateway.h index 9d54f8bb8..60025545c 100644 --- a/src/komodo_gateway.h +++ b/src/komodo_gateway.h @@ -586,7 +586,7 @@ int32_t komodo_check_deposit(int32_t height,const CBlock& block) // verify above hash = block.GetHash(); for (j=0; j<32; j++) printf("%02x",((uint8_t *)&hash)[j]); - printf(" ht.%d blockhash X couldnt find vout.[%d]\n",height,i); + printf(" kht.%d ht.%d %.8f %.8f blockhash couldnt find vout.[%d]\n",kmdheights[i-1,otherheights[i-1],dstr(values[i-1]),dstr(srcvalues[i]),i); } } if ( matched != num ) From 7ee875e80ff15da46b61a177735c6a7da297621e Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 16 Dec 2016 14:54:13 +0200 Subject: [PATCH 12/12] test --- src/komodo_gateway.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/komodo_gateway.h b/src/komodo_gateway.h index 60025545c..f3a03b2cb 100644 --- a/src/komodo_gateway.h +++ b/src/komodo_gateway.h @@ -586,7 +586,7 @@ int32_t komodo_check_deposit(int32_t height,const CBlock& block) // verify above hash = block.GetHash(); for (j=0; j<32; j++) printf("%02x",((uint8_t *)&hash)[j]); - printf(" kht.%d ht.%d %.8f %.8f blockhash couldnt find vout.[%d]\n",kmdheights[i-1,otherheights[i-1],dstr(values[i-1]),dstr(srcvalues[i]),i); + printf(" kht.%d ht.%d %.8f %.8f blockhash couldnt find vout.[%d]\n",kmdheights[i-1],otherheights[i-1],dstr(values[i-1]),dstr(srcvalues[i]),i); } } if ( matched != num )