diff --git a/src/assetchains b/src/assetchains index ce6c3aac2..0469fa728 100755 --- a/src/assetchains +++ b/src/assetchains @@ -5,6 +5,7 @@ set -eo pipefail source pubkey.txt overide_args="$@" seed_ip=`getent hosts zero.kolo.supernet.org | awk '{ print $1 }'` +komodo_binary='./komodod' if [ -z "$delay" ]; then delay=20; fi @@ -14,6 +15,6 @@ if [ -z "$delay" ]; then delay=20; fi gen=" -gen -genproclimit=1" fi - ./komodod $gen $args $overide_args -pubkey=$pubkey -addnode=$seed_ip & + $komodo_binary $gen $args $overide_args -pubkey=$pubkey -addnode=$seed_ip & sleep $delay done diff --git a/src/assetchains.json b/src/assetchains.json index e68872d6b..f4488506d 100644 --- a/src/assetchains.json +++ b/src/assetchains.json @@ -233,14 +233,22 @@ "ac_supply": "90000000000", "ac_reward": "100000000", "ac_cc": "3", - "addnode": ["138.201.136.145"] + "ac_staked": "10", + "addnode": [ + "138.201.136.145", + "95.217.44.58" + ] }, { "ac_name": "MORTY", "ac_supply": "90000000000", "ac_reward": "100000000", "ac_cc": "3", - "addnode": ["138.201.136.145"] + "ac_staked": "10", + "addnode": [ + "138.201.136.145", + "95.217.44.58" + ] }, { "ac_name": "KOIN", diff --git a/src/assetchains.old b/src/assetchains.old index 8ee0b7daa..a3233bf27 100755 --- a/src/assetchains.old +++ b/src/assetchains.old @@ -46,8 +46,8 @@ echo $pubkey ./komodod -pubkey=$pubkey -ac_name=KSB -ac_supply=1000000000 -ac_end=1 -ac_public=1 -addnode=37.187.225.231 & ./komodod -pubkey=$pubkey -ac_name=OUR -ac_reward=1478310502 -ac_halving=525600 -ac_cc=42 -ac_supply=100000000 -ac_perc=77700 -ac_staked=93 -ac_pubkey=02652a3f3e00b3a1875a918314f0bac838d6dd189a346fa623f5efe9541ac0b98c -ac_public=1 -addnode=51.255.195.65 -addnode=217.182.129.38 -addnode=37.187.225.231 & ./komodod -pubkey=$pubkey -ac_name=ILN -ac_supply=10000000000 -ac_cc=2 -addressindex=1 -spentindex=1 -addnode=51.75.122.83 & -./komodod -pubkey=$pubkey -ac_name=RICK -ac_supply=90000000000 -ac_reward=100000000 -ac_cc=3 -addnode=138.201.136.145 & -./komodod -pubkey=$pubkey -ac_name=MORTY -ac_supply=90000000000 -ac_reward=100000000 -ac_cc=3 -addnode=138.201.136.145 & +./komodod -pubkey=$pubkey -ac_name=RICK -ac_supply=90000000000 -ac_reward=100000000 -ac_cc=3 -ac_staked=10 -addnode=95.217.44.58 -addnode=138.201.136.145 & +./komodod -pubkey=$pubkey -ac_name=MORTY -ac_supply=90000000000 -ac_reward=100000000 -ac_cc=3 -ac_staked=10 -addnode=95.217.44.58 -addnode=138.201.136.145 & ./komodod -pubkey=$pubkey -ac_name=VOTE2019 -ac_supply=123651638 -ac_public=1 -addnode=95.213.238.98 & ./komodod -pubkey=$pubkey -ac_name=KOIN -ac_supply=125000000 -addnode=3.0.32.10 & ./komodod -pubkey=$pubkey -ac_name=ZEXO -ac_supply=100000000 -ac_reward=1478310502 -ac_halving=525600 -ac_cc=42 -ac_ccenable=236 -ac_perc=77700 -ac_staked=93 -ac_pubkey=02713bd85e054db923694b6b7a85306264edf4d6bd6d331814f2b40af444b3ebbc -ac_public=1 -addnode=80.240.17.222 & diff --git a/src/assetchains_stop b/src/assetchains_stop index 60549dc20..dfdfed0c9 100755 --- a/src/assetchains_stop +++ b/src/assetchains_stop @@ -1,6 +1,8 @@ #!/bin/bash set -eo pipefail +komodo_cli='./komodo-cli' ./listassetchains | while read chain; do - ./komodo-cli --ac_name=$chain stop + $komodo_cli --ac_name=$chain stop done + diff --git a/src/bitcoind.cpp b/src/bitcoind.cpp index 6180cd12b..f32b559bd 100644 --- a/src/bitcoind.cpp +++ b/src/bitcoind.cpp @@ -76,14 +76,14 @@ void WaitForShutdown(boost::thread_group* threadGroup) fprintf(stderr,"error: earlytx must be before block height %d or tx does not exist\n",KOMODO_EARLYTXID_HEIGHT); StartShutdown(); } - if ( ASSETCHAINS_STAKED == 0 && ASSETCHAINS_ADAPTIVEPOW == 0 && (pindex= komodo_chainactive(1)) != 0 ) + /*if ( ASSETCHAINS_STAKED == 0 && ASSETCHAINS_ADAPTIVEPOW == 0 && (pindex= komodo_chainactive(1)) != 0 ) { if ( pindex->nTime > ADAPTIVEPOW_CHANGETO_DEFAULTON ) { ASSETCHAINS_ADAPTIVEPOW = 1; fprintf(stderr,"default activate adaptivepow\n"); } else fprintf(stderr,"height1 time %u vs %u\n",pindex->nTime,ADAPTIVEPOW_CHANGETO_DEFAULTON); - } //else fprintf(stderr,"cant find height 1\n"); + } //else fprintf(stderr,"cant find height 1\n");*/ if ( ASSETCHAINS_CBOPRET != 0 ) komodo_pricesinit(); while (!fShutdown) diff --git a/src/cc/gateways.cpp b/src/cc/gateways.cpp index 2a2168de8..1a48928c4 100644 --- a/src/cc/gateways.cpp +++ b/src/cc/gateways.cpp @@ -1114,7 +1114,7 @@ std::string GatewaysClaim(uint64_t txfee,uint256 bindtxid,std::string refcoin,ui if ( CCchange != 0 ) mtx.vout.push_back(MakeTokensCC1vout(EVAL_GATEWAYS,CCchange,gatewayspk)); return(FinalizeCCTx(0,cp,mtx,mypk,txfee,EncodeGatewaysClaimOpRet('C',tokenid,bindtxid,refcoin,deposittxid,destpub,amount))); } - return ""; + return(""); } std::string GatewaysWithdraw(uint64_t txfee,uint256 bindtxid,std::string refcoin,CPubKey withdrawpub,int64_t amount) diff --git a/src/cc/payments.cpp b/src/cc/payments.cpp index 17507a80e..2f86b7ef2 100644 --- a/src/cc/payments.cpp +++ b/src/cc/payments.cpp @@ -77,6 +77,18 @@ // start of consensus code +void mpz_set_lli( mpz_t rop, long long op ) +{ + mpz_import(rop, 1, 1, sizeof(op), 0, 0, &op); +} + +int64_t mpz_get_si2( mpz_t op ) +{ + int64_t ret = 0; + mpz_export(&ret, NULL, 1, sizeof(ret), 0, 0, op); + return ret; +} + CScript EncodePaymentsTxidOpRet(int64_t allocation,std::vector scriptPubKey,std::vector destopret) { CScript opret; uint8_t evalcode = EVAL_PAYMENTS; @@ -277,7 +289,7 @@ int32_t payments_getallocations(int32_t top, int32_t bottom, const std::vectorInvalid("could not decode ccopret")); if ( tx.vout.back().scriptPubKey.IsOpReturn() ) fHasOpret = true; - mpz_set_si(mpzCheckamount,amountReleased); + mpz_set_lli(mpzCheckamount,amountReleased); } else return(eval->Invalid("could not decode ccopret")); // use the createtxid to fetch the tx and all of the plans info. @@ -382,7 +394,7 @@ bool PaymentsValidate(struct CCcontract_info *cp,Eval* eval,const CTransaction & //fprintf(stderr, "totalallocations.%li checkallocations.%li\n",totalallocations, checkallocations); if ( totalallocations != checkallocations ) return(eval->Invalid("allocation missmatch")); - mpz_set_si(mpzTotalAllocations,totalallocations); + mpz_set_lli(mpzTotalAllocations,totalallocations); } else if ( funcid == 'S' || funcid == 'O' ) { @@ -438,16 +450,16 @@ bool PaymentsValidate(struct CCcontract_info *cp,Eval* eval,const CTransaction & else { mpz_init(mpzAllocation); - mpz_set_si(mpzAllocation,allocations[n]); + mpz_set_lli(mpzAllocation,allocations[n]); mpz_mul(mpzAllocation,mpzAllocation,mpzCheckamount); mpz_tdiv_q(mpzAllocation,mpzAllocation,mpzTotalAllocations); - test = mpz_get_si(mpzAllocation); + test = mpz_get_si2(mpzAllocation); mpz_clear(mpzAllocation); } - //fprintf(stderr, "vout %i test.%li nValue.%li\n", i, test, tx.vout[i].nValue); + //fprintf(stderr, "vout.%i test.%lli vs nVlaue.%lli\n",i, (long long)test, (long long)tx.vout[i].nValue); if ( test != tx.vout[i].nValue ) { - fprintf(stderr, "vout.%i test.%li vs nVlaue.%li\n",i, test, tx.vout[i].nValue); + fprintf(stderr, "vout.%i test.%lli vs nVlaue.%lli\n",i, (long long)test, (long long)tx.vout[i].nValue); return(eval->Invalid("amounts do not match")); } if ( test < minimum ) @@ -463,10 +475,10 @@ bool PaymentsValidate(struct CCcontract_info *cp,Eval* eval,const CTransaction & { // need to check that the next allocation was less than minimum, otherwise ppl can truncate the tx at any place not paying all elegible addresses. mpz_init(mpzAllocation); - mpz_set_si(mpzAllocation,allocations[n+1]); + mpz_set_lli(mpzAllocation,allocations[n+1]); mpz_mul(mpzAllocation,mpzAllocation,mpzCheckamount); mpz_tdiv_q(mpzAllocation,mpzAllocation,mpzTotalAllocations); - int64_t test = mpz_get_si(mpzAllocation); + int64_t test = mpz_get_si2(mpzAllocation); //fprintf(stderr, "check next vout pays under min: test.%li > minimuim.%i\n", test, minimum); if ( test > minimum ) return(eval->Invalid("next allocation was not under minimum")); @@ -785,7 +797,7 @@ UniValue PaymentsRelease(struct CCcontract_info *cp,char *jsonstr) return(result); } // set totalallocations to a mpz_t bignum, for amounts calculation later. - mpz_set_si(mpzTotalAllocations,totalallocations); + mpz_set_lli(mpzTotalAllocations,totalallocations); } else if ( funcid == 'S' || funcid == 'O' ) { @@ -852,7 +864,7 @@ UniValue PaymentsRelease(struct CCcontract_info *cp,char *jsonstr) } newamount = amount; int64_t totalamountsent = 0; - mpz_t mpzAmount; mpz_init(mpzAmount); mpz_set_si(mpzAmount,amount); + mpz_t mpzAmount; mpz_init(mpzAmount); mpz_set_lli(mpzAmount,amount); for (i=0; i request) // received a req iguana_rwnum(0,&request[len-8],sizeof(skipcount),&skipcount); iguana_rwnum(0,&request[len-4],sizeof(filter),&filter); } - if ( isCC != 0 ) + if ( 0 && isCC != 0 ) fprintf(stderr,"utxos %s isCC.%d skipcount.%d filter.%x\n",coinaddr,isCC,skipcount,filter); memset(&U,0,sizeof(U)); if ( (slen= NSPV_getaddressutxos(&U,coinaddr,isCC,skipcount,filter)) > 0 ) @@ -660,7 +660,7 @@ void komodo_nSPVreq(CNode *pfrom,std::vector request) // received a req iguana_rwnum(0,&request[len-8],sizeof(skipcount),&skipcount); iguana_rwnum(0,&request[len-4],sizeof(filter),&filter); } - //if ( isCC != 0 ) + if ( 0 && isCC != 0 ) fprintf(stderr,"txids %s isCC.%d skipcount.%d filter.%d\n",coinaddr,isCC,skipcount,filter); memset(&T,0,sizeof(T)); if ( (slen= NSPV_getaddresstxids(&T,coinaddr,isCC,skipcount,filter)) > 0 ) diff --git a/src/main.cpp b/src/main.cpp index a339648df..a8399bbb6 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -4453,8 +4453,8 @@ static bool ActivateBestChainStep(bool fSkipdpow, CValidationState &state, CBloc notarizedht = komodo_notarized_height(&prevMoMheight,¬arizedhash,&txid); if ( !fSkipdpow && pindexFork != 0 && pindexOldTip->GetHeight() > notarizedht && pindexFork->GetHeight() < notarizedht ) { - fprintf(stderr,"pindexOldTip->GetHeight().%d > notarizedht %d && pindexFork->GetHeight().%d is < notarizedht %d, so ignore it\n",(int32_t)pindexFork->GetHeight(),notarizedht,(int32_t)pindexOldTip->GetHeight(),notarizedht); - return state.DoS(100, error("ActivateBestChainStep(): pindexOldTip->GetHeight().%d > notarizedht %d && pindexFork->GetHeight().%d is < notarizedht %d, so ignore it",(int32_t)pindexFork->GetHeight(),notarizedht,(int32_t)pindexOldTip->GetHeight(),notarizedht), + fprintf(stderr,"pindexOldTip->GetHeight().%d > notarizedht %d && pindexFork->GetHeight().%d is < notarizedht %d, so ignore it\n",(int32_t)pindexOldTip->GetHeight(),notarizedht,(int32_t)pindexFork->GetHeight(),notarizedht); + return state.DoS(100, error("ActivateBestChainStep(): pindexOldTip->GetHeight().%d > notarizedht %d && pindexFork->GetHeight().%d is < notarizedht %d, so ignore it",(int32_t)pindexOldTip->GetHeight(),notarizedht,(int32_t)pindexFork->GetHeight(),notarizedht), REJECT_INVALID, "past-notarized-height"); } // - On ChainDB initialization, pindexOldTip will be null, so there are no removable blocks.