diff --git a/src/komodo.h b/src/komodo.h index d69768e8f..690e91248 100644 --- a/src/komodo.h +++ b/src/komodo.h @@ -598,14 +598,15 @@ int32_t komodo_voutupdate(int32_t *isratificationp,int32_t notaryid,uint8_t *scr } else { + if ( scriptbuf[len] == 'K' ) + { + fprintf(stderr,"i.%d j.%d KV OPRET len.%d %.8f\n",i,j,opretlen,dstr(value)); + komodo_stateupdate(height,0,0,0,txhash,0,0,0,0,0,0,value,&scriptbuf[len],opretlen,j,zero,0); + return(-1); + } if ( strcmp(ASSETCHAINS_SYMBOL,(char *)&scriptbuf[len+32*2+4]) == 0 ) matched = 1; } - if ( scriptbuf[len] == 'K' ) - { - fprintf(stderr,"i.%d j.%d KV OPRET len.%d %.8f\n",i,j,opretlen,dstr(value)); - return(-1); - } offset = 32 * (1 + matched) + 4; nameoffset = (int32_t)strlen((char *)&scriptbuf[len+offset]); nameoffset++; diff --git a/src/komodo_bitcoind.h b/src/komodo_bitcoind.h index a5ef1ccab..12ba756fe 100644 --- a/src/komodo_bitcoind.h +++ b/src/komodo_bitcoind.h @@ -1197,7 +1197,7 @@ arith_uint256 komodo_PoWtarget(int32_t *percPoSp,arith_uint256 target,int32_t he } else return(target); if ( percPoS < goalperc ) // increase PoW diff -> lower bnTarget { - bnTarget = (ave * arith_uint256(percPoS * percPoS)) / arith_uint256((goalperc) * (goalperc)); + bnTarget = (ave * arith_uint256(percPoS * percPoS)) / arith_uint256(goalperc * goalperc * goalperc); if ( 1 ) { for (i=31; i>=24; i--) diff --git a/src/komodo_gateway.h b/src/komodo_gateway.h index 3b2922a7b..5717a2586 100644 --- a/src/komodo_gateway.h +++ b/src/komodo_gateway.h @@ -747,17 +747,18 @@ int32_t komodo_check_deposit(int32_t height,const CBlock& block,uint32_t prevtim if ( ASSETCHAINS_COMMISSION != 0 && height > 1 ) { if ( (checktoshis= komodo_checkcommission((CBlock *)&block,height)) < 0 ) - return(-1); - } - else - { - if ( overflow != 0 || total > checktoshis || strangeout != 0 ) { - if ( strangeout != 0 ) - fprintf(stderr,">>>>>>>>>>>>> %s DUST ht.%d strangout.%d notmatched.%d <<<<<<<<<\n",ASSETCHAINS_SYMBOL,height,strangeout,notmatched); + fprintf(stderr,"ht.%d checktoshis %.8f overflow.%d total %.8f strangeout.%d\n",height,dstr(checktoshis),overflow,dstr(total),strangeout); return(-1); } } + if ( height >= 2 && (overflow != 0 || total > checktoshis || strangeout != 0) ) + { + fprintf(stderr,"checkdeposit: ht.%d checktoshis %.8f overflow.%d total %.8f strangeout.%d\n",height,dstr(checktoshis),overflow,dstr(total),strangeout); + if ( strangeout != 0 ) + fprintf(stderr,">>>>>>>>>>>>> %s DUST ht.%d strangout.%d notmatched.%d <<<<<<<<<\n",ASSETCHAINS_SYMBOL,height,strangeout,notmatched); + return(-1); + } } return(0); } diff --git a/src/komodo_kv.h b/src/komodo_kv.h index 80fac5ff8..ee0496aae 100644 --- a/src/komodo_kv.h +++ b/src/komodo_kv.h @@ -111,7 +111,7 @@ void komodo_kvupdate(uint8_t *opretbuf,int32_t opretlen,uint64_t value) if ( keylen+13 > opretlen ) { static uint32_t counter; - if ( ++counter < 100 ) + if ( ++counter < 1 ) fprintf(stderr,"komodo_kvupdate: keylen.%d + 13 > opretlen.%d, this can be ignored\n",keylen,opretlen); return; } diff --git a/src/komodo_port.c b/src/komodo_port.c index 991be2013..14a97e159 100644 --- a/src/komodo_port.c +++ b/src/komodo_port.c @@ -826,7 +826,7 @@ uint16_t komodo_calcport(char *name,uint64_t supply,uint64_t endsubsidy,uint64_t int main(int argc, char * argv[]) { - uint16_t rpcport; int32_t i,j,offset=0,num = 1; uint64_t supply=10,commission=0,endsubsidy,reward,halving,decay; uint8_t *allocated=0,staked=0; uint32_t cc = 1; + uint16_t rpcport; int32_t i,j,offset=0,jsonflag=0,num = 1; uint64_t supply=10,commission=0,endsubsidy,reward,halving,decay; uint8_t *allocated=0,staked=0; uint32_t cc = 3; endsubsidy = reward = halving = decay = 0; if ( argc < 2 ) { @@ -835,9 +835,11 @@ int main(int argc, char * argv[]) printf("%s -gen num name supply endsubsidy reward halving decay\n",argv[0]); return(-1); } - if ( strcmp(argv[1],"-gen") == 0 ) + if ( strncmp(argv[1],"-gen",3) == 0 ) { num = atoi(argv[2]); + if ( strcmp(argv[1],"-genjson") == 0 ) + jsonflag = 1; offset = 2; allocated = calloc(1,1 << 16); } @@ -852,7 +854,7 @@ int main(int argc, char * argv[]) if ( argc > offset + 6 ) decay = (long long)atof(argv[offset + 6]); rpcport = 1 + komodo_calcport(argv[offset + 1],supply,endsubsidy,reward,halving,decay,commission,staked,cc); - printf("./komodod -ac_name=%s -ac_cc=%u -ac_supply=%llu -ac_end=%llu -ac_reward=%llu -ac_halving=%llu -ac_decay=%llu & # rpcport %u\n",argv[offset + 1],cc,(long long)supply,(long long)endsubsidy,(long long)reward,(long long)halving,(long long)decay,rpcport); + printf("./komodod -ac_name=%s -ac_cc=%u -ac_supply=%llu -ac_end=%llu -ac_reward=%llu -ac_halving=%llu -ac_decay=%llu & # rpcport %u\n[",argv[offset + 1],cc,(long long)supply,(long long)endsubsidy,(long long)reward,(long long)halving,(long long)decay,rpcport); if ( allocated != 0 ) { char name[64],newname[64]; @@ -868,7 +870,14 @@ int main(int argc, char * argv[]) rpcport = 1 + komodo_calcport(newname,supply+j,endsubsidy,reward,halving,decay,commission,staked,cc); if ( allocated[rpcport] == 0 && allocated[rpcport-1] == 0 ) { - printf("./komodod -ac_name=%s -ac_cc=%u -ac_supply=%llu -ac_end=%llu -ac_reward=%llu -ac_halving=%llu -ac_decay=%llu & # rpcport %u\n",newname,cc,(long long)supply+j,(long long)endsubsidy,(long long)reward,(long long)halving,(long long)decay,rpcport); + if ( jsonflag == 0 ) + { + printf("./komodod -ac_name=%s -ac_cc=%u -ac_supply=%llu -ac_end=%llu -ac_reward=%llu -ac_halving=%llu -ac_decay=%llu & # rpcport %u\n",newname,cc,(long long)supply+j,(long long)endsubsidy,(long long)reward,(long long)halving,(long long)decay,rpcport); + } + else + { + printf("{ \"assetname\": \"%s\", \"p2p\": %u, \"rpc\": %u, \"supply\": %llu, \"ac_cc\": %u, \"ac_reward\": %llu, \"notarize\": %s }%s ",newname,rpcport-1,rpcport,(long long)supply+j,cc,(long long)reward,i<64?"true":"false",i