diff --git a/basilisk/basilisk_bitcoin.c b/basilisk/basilisk_bitcoin.c index b78d9d8e6..2aa37dc02 100755 --- a/basilisk/basilisk_bitcoin.c +++ b/basilisk/basilisk_bitcoin.c @@ -585,7 +585,7 @@ char *iguana_utxoduplicates(struct supernet_info *myinfo,struct iguana_info *coi if ( signedtxidp != 0 ) memset(signedtxidp,0,sizeof(*signedtxidp)); bitcoin_address(changeaddr,coin->chain->pubtype,myinfo->persistent_pubkey33,33); - txfee = (coin->txfee + duplicates*coin->txfee*2); + txfee = (coin->txfee + duplicates*coin->txfee/10); if ( (txobj= bitcoin_txcreate(coin->symbol,coin->chain->isPoS,0,1,0)) != 0 ) { if ( duplicates <= 0 ) diff --git a/iguana/acsplit b/iguana/acsplit index 6bf73d890..d5e0561d1 100755 --- a/iguana/acsplit +++ b/iguana/acsplit @@ -1 +1 @@ -curl --url "http://127.0.0.1:7776" --data "{\"coin\":\""${1}"\",\"agent\":\"iguana\",\"method\":\"splitfunds\",\"satoshis\":\"50000\",\"sendflag\":1,\"duplicates\":"${2}"}" +curl --url "http://127.0.0.1:7776" --data "{\"coin\":\""${1}"\",\"agent\":\"iguana\",\"method\":\"splitfunds\",\"satoshis\":\"10000\",\"sendflag\":1,\"duplicates\":"${2}"}" diff --git a/iguana/dPoW.h b/iguana/dPoW.h index e3a37118b..85e8795ef 100755 --- a/iguana/dPoW.h +++ b/iguana/dPoW.h @@ -29,7 +29,7 @@ #define DPOW_VERSION 0x1782 #define DPOW_UTXOSIZE 10000//50000 #define DPOW_MINOUTPUT 6000 -#define DPOW_DURATION 600 +#define DPOW_DURATION 1200 #define DPOW_RATIFYDURATION (3600 * 24) //#define DPOW_ENTRIESCHANNEL ('e' | ('n' << 8) | ('t' << 16) | ('r' << 24)) @@ -142,7 +142,7 @@ struct dpow_info struct pax_transaction *PAX; portable_mutex_t paxmutex,dexmutex; uint32_t ipbits[128],numipbits; - struct dpow_block **blocks; + struct dpow_block **blocks,*currentbp; }; struct komodo_ccdatapair { int32_t notarization_height; uint32_t MoMoMoffset; }; diff --git a/iguana/dpow/dpow_fsm.c b/iguana/dpow/dpow_fsm.c index daa713253..778415025 100755 --- a/iguana/dpow/dpow_fsm.c +++ b/iguana/dpow/dpow_fsm.c @@ -360,6 +360,7 @@ void dpow_statemachinestart(void *ptr) } bp->bestk = -1; dp->blocks[checkpoint.blockhash.height] = bp; + dp->currentbp = bp; bp->beacon = rand256(0); vcalc_sha256(0,bp->commit.bytes,bp->beacon.bytes,sizeof(bp->beacon)); } diff --git a/iguana/dpow/dpow_network.c b/iguana/dpow/dpow_network.c index a39197cd1..9c1d50c9f 100755 --- a/iguana/dpow/dpow_network.c +++ b/iguana/dpow/dpow_network.c @@ -1778,6 +1778,30 @@ void dpow_ratify_update(struct supernet_info *myinfo,struct dpow_info *dp,struct } } +cJSON *dpow_recvmasks(struct supernet_info *myinfo,struct dpow_info *dp,struct dpow_block *bp) +{ + int32_t i,j; cJSON *retjson,*item; char hexstr[64]; + retjson = cJSON_CreateArray(); + if ( dp == 0 || bp == 0 ) + return(retjson); + for (i=0; inumnotaries; i++) + { + item = cJSON_CreateObject(); + jaddstr(item,"notary",Notaries_elected[i][0]); + jaddnum(item,"bestk",bp->notaries[i].bestk); + for (j=7; j>=0; j--) + sprintf(hexstr,"%02x",((uint8_t *)&bp->notaries[i].recvmask)[j]); + hexstr[16] = 0; + jaddstr(item,"recvmask",hexstr); + for (j=7; j>=0; j--) + sprintf(hexstr,"%02x",((uint8_t *)&bp->notaries[i].bestmask)[j]); + hexstr[16] = 0; + jaddstr(item,"bestmask",hexstr); + jaddi(retjson,item); + } + return(retjson); +} + void dpow_notarize_update(struct supernet_info *myinfo,struct dpow_info *dp,struct dpow_block *bp,uint8_t senderind,int8_t bestk,uint64_t bestmask,uint64_t recvmask,bits256 srcutxo,uint16_t srcvout,bits256 destutxo,uint16_t destvout,uint8_t siglens[2],uint8_t sigs[2][DPOW_MAXSIGLEN],uint32_t paxwdcrc) { bits256 srchash; int32_t i,flag,bestmatches = 0,matches = 0,paxmatches = 0,paxbestmatches = 0; diff --git a/iguana/dpow/dpow_rpc.c b/iguana/dpow/dpow_rpc.c index a436abc00..088756159 100755 --- a/iguana/dpow/dpow_rpc.c +++ b/iguana/dpow/dpow_rpc.c @@ -375,11 +375,23 @@ cJSON *dpow_getblock(struct supernet_info *myinfo,struct iguana_info *coin,bits2 char *dpow_validateaddress(struct supernet_info *myinfo,struct iguana_info *coin,char *address) { - char buf[128],*retstr=0; + char buf[128],*retstr=0; cJSON *retjson; if ( coin->FULLNODE < 0 ) { sprintf(buf,"\"%s\"",address); - retstr = bitcoind_passthru(coin->symbol,coin->chain->serverport,coin->chain->userpass,"validateaddress",buf); + retstr = bitcoind_passthru(coin->symbol,coin->chain->serverport,coin->chain->userpass,coin->validateaddress,buf); + if ( (retjson= cJSON_Parse(retstr)) != 0 ) + { + if ( strcmp(coin->symbol,"BTC") == 0 && jobj(retjson,"error") == 0 && jobj(retjson,"ismine") == 0 && strcmp(coin->validateaddress,"validateaddress") == 0 ) + { + printf("autochange %s validateaddress -> getaddressinfo\n",coin->symbol); + strcpy(coin->validateaddress,"getaddressinfo"); + free_json(retjson); + free(retjson); + return(bitcoind_passthru(coin->symbol,coin->chain->serverport,coin->chain->userpass,coin->validateaddress,buf)); + } + free_json(retjson); + } usleep(10000); } else if ( coin->FULLNODE > 0 || coin->VALIDATENODE > 0 ) diff --git a/iguana/elected b/iguana/elected index 60f3cecb6..d26b08c36 100644 --- a/iguana/elected +++ b/iguana/elected @@ -7,6 +7,7 @@ "37.9.62.186", "145.239.204.33", "185.169.229.64", + "164.132.202.176", "163.172.100.144", "139.60.161.30", "209.58.190.117", diff --git a/iguana/exchanges/LP_rpc.c b/iguana/exchanges/LP_rpc.c index 626fba0a0..e8dc6f5ef 100644 --- a/iguana/exchanges/LP_rpc.c +++ b/iguana/exchanges/LP_rpc.c @@ -348,7 +348,7 @@ cJSON *LP_validateaddress(char *symbol,char *address) strcpy(coin->validateaddress,"validateaddress"); if ( (retjson= bitcoin_json(coin,coin->validateaddress,buf)) != 0 ) { - if ( jobj(retjson,"error") == 0 && jobj(retjson,"ismine") == 0 && strcmp(coin->validateaddress,"validateaddress") == 0 ) + if ( strcmp(coin->symbol,"BTC") == 0 && jobj(retjson,"error") == 0 && jobj(retjson,"ismine") == 0 && strcmp(coin->validateaddress,"validateaddress") == 0 ) { printf("autochange %s validateaddress -> getaddressinfo\n",coin->symbol); strcpy(coin->validateaddress,"getaddressinfo"); diff --git a/iguana/iguana777.c b/iguana/iguana777.c index 7cefce98d..69f6f8890 100755 --- a/iguana/iguana777.c +++ b/iguana/iguana777.c @@ -49,6 +49,8 @@ struct iguana_info *iguana_coinadd(char *symbol,char *name,cJSON *argjson,int32_ myinfo->allcoins_being_added = 1; coin = mycalloc('C',1,sizeof(*coin)); strcpy(coin->getinfostr,"getinfo"); + strcpy(coin->validateaddress,"validateaddress"); + strcpy(coin->estimatefeestr,"estimatefee"); coin->blockspacesize = IGUANA_MAXPACKETSIZE + 8192; coin->blockspace = calloc(1,coin->blockspacesize); if ( virtcoin != 0 || ((privatechain= jstr(argjson,"geckochain")) != 0 && privatechain[0] != 0) ) diff --git a/iguana/iguana777.h b/iguana/iguana777.h index 0cea7f2e6..bc4a45d60 100755 --- a/iguana/iguana777.h +++ b/iguana/iguana777.h @@ -180,7 +180,7 @@ struct supernet_info #ifdef NOTARY_TESTMODE char dexseed_ipaddrs[1][64]; #else - char dexseed_ipaddrs[4][64]; + char dexseed_ipaddrs[8][64]; #endif uint32_t dexipbits[128]; int32_t numdexipbits; portable_mutex_t dexmutex; // compatibility diff --git a/iguana/iguana_notary.c b/iguana/iguana_notary.c index ecb45b3a7..09262465d 100755 --- a/iguana/iguana_notary.c +++ b/iguana/iguana_notary.c @@ -148,6 +148,8 @@ void dpow_srcupdate(struct supernet_info *myinfo,struct dpow_info *dp,int32_t he { if ( (i % DPOW_MAXFREQ) != 0 && (bp= dp->blocks[i]) != 0 && bp->state == 0xffffffff ) { + if ( dp->currentbp == dp->blocks[i] ) + dp->currentbp = 0; dp->blocks[i] = 0; Numallocated--; free(bp); @@ -857,9 +859,14 @@ STRING_AND_INT(dpow,fundnotaries,symbol,numblocks) return(clonestr("{\"result\":\"success\"}")); } +extern char *Notaries_elected[65][2]; +cJSON *dpow_recvmasks(struct supernet_info *myinfo,struct dpow_info *dp,struct dpow_block *bp); + STRING_ARG(dpow,active,maskhex) { - uint8_t data[8],revdata[8],pubkeys[64][33]; char pubkeystr[67]; int32_t i,len,current,n; uint64_t mask; cJSON *infojson,*retjson,*array = cJSON_CreateArray(); + uint8_t data[8],revdata[8],pubkeys[64][33]; int32_t i,len,current,n; uint64_t mask; cJSON *infojson,*retjson,*array,*notarray; + array = cJSON_CreateArray(); + notarray = cJSON_CreateArray(); if ( (infojson= dpow_getinfo(myinfo,coin)) != 0 ) { current = jint(infojson,"blocks"); @@ -868,22 +875,24 @@ STRING_ARG(dpow,active,maskhex) n = komodo_notaries("KMD",pubkeys,current); if ( maskhex == 0 || maskhex[0] == 0 ) { - mask = myinfo->DPOWS[0]->lastrecvmask; + return(jprint(dpow_recvmasks(myinfo,myinfo->DPOWS[0],myinfo->DPOWS[0]->currentbp),1)); + + /*mask = myinfo->DPOWS[0]->lastrecvmask; for (i=0; i>= 1; @@ -893,17 +902,24 @@ STRING_ARG(dpow,active,maskhex) revdata[i] = data[len-1-i]; mask = 0; memcpy(&mask,revdata,sizeof(revdata)); - for (i=0; i