From 02b3f8b57b80f058a1ca2dbcf1aaf46dbf8a60b6 Mon Sep 17 00:00:00 2001 From: blackjok3rtt <30971146+blackjok3rtt@users.noreply.github.com> Date: Wed, 5 Sep 2018 23:07:03 +0800 Subject: [PATCH 001/167] using elected file disable auto split --- iguana/main.c | 1 + 1 file changed, 1 insertion(+) diff --git a/iguana/main.c b/iguana/main.c index 571f45549..7f5719a4a 100755 --- a/iguana/main.c +++ b/iguana/main.c @@ -2226,6 +2226,7 @@ void iguana_main(void *arg) myinfo->IAMNOTARY = 1; myinfo->DEXEXPLORER = 0;//1; disable as SPV is used now elected = (char *)arg; + myinfo->nosplit = 1; } } if ( komodo_initjson(elected) < 0 ) From 36866e7dab543e2f2c689aa8b859027ce1ad0128 Mon Sep 17 00:00:00 2001 From: blackjok3rtt <30971146+blackjok3rtt@users.noreply.github.com> Date: Sun, 9 Sep 2018 18:37:20 +0800 Subject: [PATCH 002/167] add check for supress/STAKED chain --- iguana/iguana_notary.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iguana/iguana_notary.c b/iguana/iguana_notary.c index d51d6de0d..87943b8c5 100755 --- a/iguana/iguana_notary.c +++ b/iguana/iguana_notary.c @@ -69,7 +69,7 @@ void dpow_srcupdate(struct supernet_info *myinfo,struct dpow_info *dp,int32_t he { if ( dp->DESTHEIGHT < dp->prevDESTHEIGHT+DPOW_CHECKPOINTFREQ ) { - suppress = 1; + suppress = strncmp("STAKED",dp->symbol,6) != 0; //fprintf(stderr,"suppress %s -> KMD\n",dp->symbol); } } From 3cc5f72a9b6f85c50cfe8247c686cc08f16b9745 Mon Sep 17 00:00:00 2001 From: blackjok3rtt <30971146+blackjok3rtt@users.noreply.github.com> Date: Mon, 10 Sep 2018 00:49:48 +0800 Subject: [PATCH 003/167] change TXSCL MoMoM to STAKED --- iguana/dpow/dpow_rpc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iguana/dpow/dpow_rpc.c b/iguana/dpow/dpow_rpc.c index edcd687d3..8b8f3702a 100755 --- a/iguana/dpow/dpow_rpc.c +++ b/iguana/dpow/dpow_rpc.c @@ -288,7 +288,7 @@ int32_t dpow_paxpending(struct supernet_info *myinfo,uint8_t *hex,int32_t hexsiz n += iguana_rwbignum(1,&hex[n],sizeof(MoM),MoM.bytes); MoMdepth = (MoMdepth & 0xffff) | ((uint32_t)CCid<<16); n += iguana_rwnum(1,&hex[n],sizeof(MoMdepth),(uint32_t *)&MoMdepth); - if ( strncmp(bp->srccoin->symbol,"TXSCL",5) == 0 && src_or_dest == 0 && strcmp(bp->destcoin->symbol,"KMD") == 0 ) + if ( strncmp(bp->srccoin->symbol,"STAKED",6) == 0 && src_or_dest == 0 && strcmp(bp->destcoin->symbol,"KMD") == 0 ) { kmdcoin = bp->destcoin; if ( (infojson= dpow_getinfo(myinfo,kmdcoin)) != 0 ) From 1224807ff3cf5d2144867df4441aee994b512dd8 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Tue, 11 Sep 2018 09:33:20 +0800 Subject: [PATCH 004/167] remove the spam od MoMoM prints --- iguana/dpow/dpow_rpc.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/iguana/dpow/dpow_rpc.c b/iguana/dpow/dpow_rpc.c index 8b8f3702a..3e6e9981c 100755 --- a/iguana/dpow/dpow_rpc.c +++ b/iguana/dpow/dpow_rpc.c @@ -236,7 +236,7 @@ bits256 dpow_getbestblockhash(struct supernet_info *myinfo,struct iguana_info *c } else { - + } if ( bits256_nonz(blockhash) != 0 ) { @@ -271,7 +271,7 @@ cJSON *dpow_MoMoMdata(struct iguana_info *coin,char *symbol,int32_t kmdheight,ui if ( (retstr= bitcoind_passthru(coin->symbol,coin->chain->serverport,coin->chain->userpass,"MoMoMdata",buf)) != 0 ) { retjson = cJSON_Parse(retstr); - printf("%s kmdheight.%d CCid.%u MoMoM.%s -> %s\n",symbol,kmdheight,CCid,buf,retstr); + //printf("%s kmdheight.%d CCid.%u MoMoM.%s -> %s\n",symbol,kmdheight,CCid,buf,retstr); free(retstr); } usleep(10000); @@ -399,7 +399,7 @@ cJSON *dpow_getblock(struct supernet_info *myinfo,struct iguana_info *coin,bits2 int32_t dpow_is015(char *symbol) { - if ( strcmp("CHIPS",symbol) == 0 || strcmp("GAME",symbol) == 0 ) //strcmp("BTC",symbol) == 0 || + if ( strcmp("CHIPS",symbol) == 0 || strcmp("GAME",symbol) == 0 ) //strcmp("BTC",symbol) == 0 || return(1); else return(0); } @@ -1254,7 +1254,7 @@ void dpow_issuer_voutupdate(struct dpow_info *dp,char *symbol,int32_t isspecial, printf(" opret[%c] fiatoshis %.8f vs check %.8f\n",script[0],dstr(fiatoshis),dstr(checktoshis)); if ( seed == 0 || fiatoshis < checktoshis ) { - + }*/ } } @@ -1424,4 +1424,3 @@ int32_t dpow_issuer_iteration(struct dpow_info *dp,struct iguana_info *coin,int3 //printf("[%s -> %s] %s ht.%d current.%d\n",dp->symbol,dp->dest,coin->symbol,height,currentheight); return(height); } - From 4af64070fc262c8f9196e5249397f5a42f9d7d61 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Tue, 11 Sep 2018 09:47:37 +0800 Subject: [PATCH 005/167] add game print for all coins --- iguana/dpow/dpow_tx.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/iguana/dpow/dpow_tx.c b/iguana/dpow/dpow_tx.c index 040d9e873..23e2da44e 100755 --- a/iguana/dpow/dpow_tx.c +++ b/iguana/dpow/dpow_tx.c @@ -581,8 +581,7 @@ void dpow_sigscheck(struct supernet_info *myinfo,struct dpow_info *dp,struct dpo { dpow_notarytx(myinfo,bp->signedtx,&numsigs,coin->chain->isPoS,bp,bestk,bestmask,0,src_or_dest,pubkeys,numratified); // setcrcval signedtxid = dpow_notarytx(myinfo,bp->signedtx,&numsigs,coin->chain->isPoS,bp,bestk,bestmask,1,src_or_dest,pubkeys,numratified); - if ( strcmp("GAME",coin->symbol) == 0 ) - printf("src_or_dest.%d bestk.%d %llx %s numsigs.%d signedtx.(%s)\n",src_or_dest,bestk,(long long)bestmask,bits256_str(str,signedtxid),numsigs,bp->signedtx); + printf("src_or_dest.%d bestk.%d %llx %s numsigs.%d signedtx.(%s)\n",src_or_dest,bestk,(long long)bestmask,bits256_str(str,signedtxid),numsigs,bp->signedtx); bp->state = 1; if ( bits256_nonz(signedtxid) != 0 && numsigs == bp->minsigs ) { @@ -628,4 +627,3 @@ void dpow_sigscheck(struct supernet_info *myinfo,struct dpow_info *dp,struct dpo } else printf("numsigs.%d vs required.%d\n",numsigs,bp->minsigs); } } - From 356ae84131feb91ad9e843f6e0c10cd71b3357b7 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Tue, 11 Sep 2018 09:49:22 +0800 Subject: [PATCH 006/167] remove some more MoMoM prints --- iguana/dpow/dpow_rpc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iguana/dpow/dpow_rpc.c b/iguana/dpow/dpow_rpc.c index 3e6e9981c..ed1c39b74 100755 --- a/iguana/dpow/dpow_rpc.c +++ b/iguana/dpow/dpow_rpc.c @@ -301,7 +301,7 @@ int32_t dpow_paxpending(struct supernet_info *myinfo,uint8_t *hex,int32_t hexsiz if ( (hexstr= jstr(retjson,"data")) != 0 && (hexlen= (int32_t)strlen(hexstr)) > 0 && n+hexlen/2 <= hexsize ) { hexlen >>= 1; - printf("add MoMoMdata.(%s)\n",hexstr); + //printf("add MoMoMdata.(%s)\n",hexstr); decode_hex(&hex[n],hexlen,hexstr), n += hexlen; } free_json(retjson); From 9ac562fcf5d29b36929e89c7237cc8d1e60cb08e Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Tue, 11 Sep 2018 10:34:19 +0800 Subject: [PATCH 007/167] remove another print --- iguana/dpow/dpow_rpc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/iguana/dpow/dpow_rpc.c b/iguana/dpow/dpow_rpc.c index ed1c39b74..02926ba0d 100755 --- a/iguana/dpow/dpow_rpc.c +++ b/iguana/dpow/dpow_rpc.c @@ -309,8 +309,8 @@ int32_t dpow_paxpending(struct supernet_info *myinfo,uint8_t *hex,int32_t hexsiz } paxwdcrc = calc_crc32(0,hex,n) & 0xffffff00; paxwdcrc |= (n & 0xff); - if ( hexlen > 0 ) - printf("%s.ht.%d opretlen.%d src_or_dest.%d dest.(%s) lastbest.%d paxwdcrc.%x\n",bp->srccoin->symbol,bp->height,n,src_or_dest,bp->destcoin->symbol,kmdcoin!=0?((kmdcoin->lastbestheight/10)*10 - 5):-1,paxwdcrc); + //if ( hexlen > 0 ) + //printf("%s.ht.%d opretlen.%d src_or_dest.%d dest.(%s) lastbest.%d paxwdcrc.%x\n",bp->srccoin->symbol,bp->height,n,src_or_dest,bp->destcoin->symbol,kmdcoin!=0?((kmdcoin->lastbestheight/10)*10 - 5):-1,paxwdcrc); } *paxwdcrcp = paxwdcrc; return(n); From 28740a783ae16d8666ce59e64987cfc9d0e11b70 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Wed, 12 Sep 2018 10:29:18 +0800 Subject: [PATCH 008/167] remove signed TX print --- iguana/dpow/dpow_tx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iguana/dpow/dpow_tx.c b/iguana/dpow/dpow_tx.c index 23e2da44e..9ffa025f6 100755 --- a/iguana/dpow/dpow_tx.c +++ b/iguana/dpow/dpow_tx.c @@ -581,7 +581,7 @@ void dpow_sigscheck(struct supernet_info *myinfo,struct dpow_info *dp,struct dpo { dpow_notarytx(myinfo,bp->signedtx,&numsigs,coin->chain->isPoS,bp,bestk,bestmask,0,src_or_dest,pubkeys,numratified); // setcrcval signedtxid = dpow_notarytx(myinfo,bp->signedtx,&numsigs,coin->chain->isPoS,bp,bestk,bestmask,1,src_or_dest,pubkeys,numratified); - printf("src_or_dest.%d bestk.%d %llx %s numsigs.%d signedtx.(%s)\n",src_or_dest,bestk,(long long)bestmask,bits256_str(str,signedtxid),numsigs,bp->signedtx); + //printf("src_or_dest.%d bestk.%d %llx %s numsigs.%d signedtx.(%s)\n",src_or_dest,bestk,(long long)bestmask,bits256_str(str,signedtxid),numsigs,bp->signedtx); bp->state = 1; if ( bits256_nonz(signedtxid) != 0 && numsigs == bp->minsigs ) { From d6f6da01eead65053546d029af10651a4f50a74d Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Wed, 12 Sep 2018 23:37:10 +0800 Subject: [PATCH 009/167] FIX STKD != STAKED --- iguana/dpow/dpow_rpc.c | 2 +- iguana/iguana_notary.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/iguana/dpow/dpow_rpc.c b/iguana/dpow/dpow_rpc.c index 02926ba0d..879bf8554 100755 --- a/iguana/dpow/dpow_rpc.c +++ b/iguana/dpow/dpow_rpc.c @@ -288,7 +288,7 @@ int32_t dpow_paxpending(struct supernet_info *myinfo,uint8_t *hex,int32_t hexsiz n += iguana_rwbignum(1,&hex[n],sizeof(MoM),MoM.bytes); MoMdepth = (MoMdepth & 0xffff) | ((uint32_t)CCid<<16); n += iguana_rwnum(1,&hex[n],sizeof(MoMdepth),(uint32_t *)&MoMdepth); - if ( strncmp(bp->srccoin->symbol,"STAKED",6) == 0 && src_or_dest == 0 && strcmp(bp->destcoin->symbol,"KMD") == 0 ) + if ( strncmp(bp->srccoin->symbol,"STKD",4) == 0 && src_or_dest == 0 && strcmp(bp->destcoin->symbol,"KMD") == 0 ) { kmdcoin = bp->destcoin; if ( (infojson= dpow_getinfo(myinfo,kmdcoin)) != 0 ) diff --git a/iguana/iguana_notary.c b/iguana/iguana_notary.c index 87943b8c5..b3ce9435d 100755 --- a/iguana/iguana_notary.c +++ b/iguana/iguana_notary.c @@ -69,7 +69,7 @@ void dpow_srcupdate(struct supernet_info *myinfo,struct dpow_info *dp,int32_t he { if ( dp->DESTHEIGHT < dp->prevDESTHEIGHT+DPOW_CHECKPOINTFREQ ) { - suppress = strncmp("STAKED",dp->symbol,6) != 0; + suppress = strncmp("STKD",dp->symbol,4) != 0; //fprintf(stderr,"suppress %s -> KMD\n",dp->symbol); } } @@ -143,7 +143,7 @@ void dpow_srcupdate(struct supernet_info *myinfo,struct dpow_info *dp,int32_t he printf("ht.%d maxblocks.%d\n",ht,dp->maxblocks); for (i=ht-DPOW_MAXFREQ*5; i>ht-DPOW_MAXFREQ*100&&i>DPOW_MAXFREQ; i--) { - if ( (bp= dp->blocks[i]) != 0 && bp->state == 0xffffffff ) //(i % DPOW_MAXFREQ) != 0 && + if ( (bp= dp->blocks[i]) != 0 && bp->state == 0xffffffff ) //(i % DPOW_MAXFREQ) != 0 && { if ( dp->currentbp == dp->blocks[i] ) dp->currentbp = 0; @@ -535,7 +535,7 @@ STRING_ARG(iguana,addnotary,ipaddr) } char NOTARY_CURRENCIES[][65] = { - "REVS", "SUPERNET", "DEX", "PANGEA", "JUMBLR", "BET", "CRYPTO", "HODL", "BOTS", "MGW", "COQUI", "WLC", "KV", "CEAL", "MESH", "MNZ", "CHIPS", "MSHARK", "AXO", "ETOMIC", "BTCH", "VOTE2018", "NINJA", "OOT", "CHAIN", "BNTN", "PRLPAY", "DSEC", "GLXT", "EQL", "ZILLA", "RFOX", "SEC" + "REVS", "SUPERNET", "DEX", "PANGEA", "JUMBLR", "BET", "CRYPTO", "HODL", "BOTS", "MGW", "COQUI", "WLC", "KV", "CEAL", "MESH", "MNZ", "CHIPS", "MSHARK", "AXO", "ETOMIC", "BTCH", "VOTE2018", "NINJA", "OOT", "CHAIN", "BNTN", "PRLPAY", "DSEC", "GLXT", "EQL", "ZILLA", "RFOX", "SEC" }; // "LTC", "USD", "EUR", "JPY", "GBP", "AUD", "CAD", "CHF", "NZD", "CNY", "RUB", "MXN", "BRL", "INR", "HKD", "TRY", "ZAR", "PLN", "NOK", "SEK", "DKK", "CZK", "HUF", "ILS", "KRW", "MYR", "PHP", "RON", "SGD", "THB", "BGN", "IDR", "HRK", From ba8ef264cc69b029df3e5cdeabce328af37d48b1 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Thu, 13 Sep 2018 13:21:48 +0800 Subject: [PATCH 010/167] Change to STAKED + STKD and try out surpress every 5 KMD blocks --- iguana/dpow/dpow_rpc.c | 5 +++-- iguana/iguana_notary.c | 12 ++++++++---- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/iguana/dpow/dpow_rpc.c b/iguana/dpow/dpow_rpc.c index 879bf8554..4cfbbcfcb 100755 --- a/iguana/dpow/dpow_rpc.c +++ b/iguana/dpow/dpow_rpc.c @@ -288,7 +288,8 @@ int32_t dpow_paxpending(struct supernet_info *myinfo,uint8_t *hex,int32_t hexsiz n += iguana_rwbignum(1,&hex[n],sizeof(MoM),MoM.bytes); MoMdepth = (MoMdepth & 0xffff) | ((uint32_t)CCid<<16); n += iguana_rwnum(1,&hex[n],sizeof(MoMdepth),(uint32_t *)&MoMdepth); - if ( strncmp(bp->srccoin->symbol,"STKD",4) == 0 && src_or_dest == 0 && strcmp(bp->destcoin->symbol,"KMD") == 0 ) + + if ( ( (strlen(symbol) >= 4 && strncmp(symbol, "STKD", 4) == 0) || (strlen(symbol) >= 6 && strncmp(symbol, "STAKED", 6) == 0) ) && src_or_dest == 0 && strcmp(bp->destcoin->symbol,"KMD") == 0 ) { kmdcoin = bp->destcoin; if ( (infojson= dpow_getinfo(myinfo,kmdcoin)) != 0 ) @@ -301,7 +302,7 @@ int32_t dpow_paxpending(struct supernet_info *myinfo,uint8_t *hex,int32_t hexsiz if ( (hexstr= jstr(retjson,"data")) != 0 && (hexlen= (int32_t)strlen(hexstr)) > 0 && n+hexlen/2 <= hexsize ) { hexlen >>= 1; - //printf("add MoMoMdata.(%s)\n",hexstr); + printf("add MoMoMdata.(%s)\n",hexstr); decode_hex(&hex[n],hexlen,hexstr), n += hexlen; } free_json(retjson); diff --git a/iguana/iguana_notary.c b/iguana/iguana_notary.c index b3ce9435d..e419f631f 100755 --- a/iguana/iguana_notary.c +++ b/iguana/iguana_notary.c @@ -61,16 +61,20 @@ void dpow_checkpointset(struct supernet_info *myinfo,struct dpow_checkpoint *che void dpow_srcupdate(struct supernet_info *myinfo,struct dpow_info *dp,int32_t height,bits256 hash,uint32_t timestamp,uint32_t blocktime) { //struct komodo_ccdataMoMoM mdata; cJSON *blockjson; uint64_t signedmask; struct iguana_info *coin; - void **ptrs; char str[65]; struct dpow_checkpoint checkpoint; int32_t i,ht,suppress=0; struct dpow_block *bp; + void **ptrs; char str[65]; struct dpow_checkpoint checkpoint; int32_t checkpointfreq,i,ht,suppress=0; struct dpow_block *bp; dpow_checkpointset(myinfo,&dp->last,height,hash,timestamp,blocktime); checkpoint = dp->srcfifo[dp->srcconfirms]; dpow_fifoupdate(myinfo,dp->srcfifo,dp->last); if ( strcmp(dp->dest,"KMD") == 0 ) { - if ( dp->DESTHEIGHT < dp->prevDESTHEIGHT+DPOW_CHECKPOINTFREQ ) + checkpointfreq = DPOW_CHECKPOINTFREQ + if ( (strlen(dp->symbol) >= 4 && strncmp(dp->symbol, "STKD", 4) == 0) || (strlen(dp->symbol) >= 6 && strncmp(dp->symbol, "STAKED", 6) == 0) ) + checkpointfreq = 5; + if ( dp->DESTHEIGHT < dp->prevDESTHEIGHT+checkpointfreq ) { - suppress = strncmp("STKD",dp->symbol,4) != 0; - //fprintf(stderr,"suppress %s -> KMD\n",dp->symbol); + suppress = 1; + // suppress = strncmp("STKD",dp->symbol,4) != 0; + fprintf(stderr,"suppress %s -> KMD freq KMD blocks.%d\n",dp->symbol,checkpointfreq); } } /*if ( strcmp(dp->dest,"KMD") == 0 )//|| strcmp(dp->dest,"CHAIN") == 0 ) From 5e7dfd38e67953a1753c547853e248b120d50609 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Thu, 13 Sep 2018 13:56:57 +0800 Subject: [PATCH 011/167] fix stupid mistake --- iguana/dpow/dpow_rpc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iguana/dpow/dpow_rpc.c b/iguana/dpow/dpow_rpc.c index 4cfbbcfcb..661aba0cc 100755 --- a/iguana/dpow/dpow_rpc.c +++ b/iguana/dpow/dpow_rpc.c @@ -289,7 +289,7 @@ int32_t dpow_paxpending(struct supernet_info *myinfo,uint8_t *hex,int32_t hexsiz MoMdepth = (MoMdepth & 0xffff) | ((uint32_t)CCid<<16); n += iguana_rwnum(1,&hex[n],sizeof(MoMdepth),(uint32_t *)&MoMdepth); - if ( ( (strlen(symbol) >= 4 && strncmp(symbol, "STKD", 4) == 0) || (strlen(symbol) >= 6 && strncmp(symbol, "STAKED", 6) == 0) ) && src_or_dest == 0 && strcmp(bp->destcoin->symbol,"KMD") == 0 ) + if ( ( (strlen(bp->srccoin->symbol) >= 4 && strncmp(bp->srccoin->symbol, "STKD", 4) == 0) || (strlen(bp->srccoin->symbol) >= 6 && strncmp(bp->srccoin->symbol, "STAKED", 6) == 0) ) && src_or_dest == 0 && strcmp(bp->destcoin->symbol,"KMD") == 0 ) { kmdcoin = bp->destcoin; if ( (infojson= dpow_getinfo(myinfo,kmdcoin)) != 0 ) From 0159f5e602d36a33e03cc43d13d488440c02b480 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Thu, 13 Sep 2018 13:58:30 +0800 Subject: [PATCH 012/167] and another one --- iguana/iguana_notary.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iguana/iguana_notary.c b/iguana/iguana_notary.c index e419f631f..ebddec15d 100755 --- a/iguana/iguana_notary.c +++ b/iguana/iguana_notary.c @@ -67,7 +67,7 @@ void dpow_srcupdate(struct supernet_info *myinfo,struct dpow_info *dp,int32_t he dpow_fifoupdate(myinfo,dp->srcfifo,dp->last); if ( strcmp(dp->dest,"KMD") == 0 ) { - checkpointfreq = DPOW_CHECKPOINTFREQ + checkpointfreq = DPOW_CHECKPOINTFREQ; if ( (strlen(dp->symbol) >= 4 && strncmp(dp->symbol, "STKD", 4) == 0) || (strlen(dp->symbol) >= 6 && strncmp(dp->symbol, "STAKED", 6) == 0) ) checkpointfreq = 5; if ( dp->DESTHEIGHT < dp->prevDESTHEIGHT+checkpointfreq ) From 9bfa7e7a8d747c9799208103ddac1f02ff0bc0ad Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Thu, 13 Sep 2018 19:34:19 +0800 Subject: [PATCH 013/167] disable our suppress for now --- iguana/iguana_notary.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/iguana/iguana_notary.c b/iguana/iguana_notary.c index ebddec15d..52c15f682 100755 --- a/iguana/iguana_notary.c +++ b/iguana/iguana_notary.c @@ -68,12 +68,12 @@ void dpow_srcupdate(struct supernet_info *myinfo,struct dpow_info *dp,int32_t he if ( strcmp(dp->dest,"KMD") == 0 ) { checkpointfreq = DPOW_CHECKPOINTFREQ; - if ( (strlen(dp->symbol) >= 4 && strncmp(dp->symbol, "STKD", 4) == 0) || (strlen(dp->symbol) >= 6 && strncmp(dp->symbol, "STAKED", 6) == 0) ) - checkpointfreq = 5; + //if ( (strlen(dp->symbol) >= 4 && strncmp(dp->symbol, "STKD", 4) == 0) || (strlen(dp->symbol) >= 6 && strncmp(dp->symbol, "STAKED", 6) == 0) ) + //checkpointfreq = 5; if ( dp->DESTHEIGHT < dp->prevDESTHEIGHT+checkpointfreq ) { - suppress = 1; - // suppress = strncmp("STKD",dp->symbol,4) != 0; + //suppress = 1; + suppress = ( (strlen(dp->symbol) >= 4 && strncmp(dp->symbol, "STKD", 4) == 0) || (strlen(dp->symbol) >= 6 && strncmp(dp->symbol, "STAKED", 6) == 0) ) != 0; fprintf(stderr,"suppress %s -> KMD freq KMD blocks.%d\n",dp->symbol,checkpointfreq); } } From 52c58f786d831902448f1e7e9ffc3b365b338f8b Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Thu, 13 Sep 2018 19:49:37 +0800 Subject: [PATCH 014/167] fix the print --- iguana/iguana_notary.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iguana/iguana_notary.c b/iguana/iguana_notary.c index 52c15f682..91e0ee549 100755 --- a/iguana/iguana_notary.c +++ b/iguana/iguana_notary.c @@ -74,7 +74,7 @@ void dpow_srcupdate(struct supernet_info *myinfo,struct dpow_info *dp,int32_t he { //suppress = 1; suppress = ( (strlen(dp->symbol) >= 4 && strncmp(dp->symbol, "STKD", 4) == 0) || (strlen(dp->symbol) >= 6 && strncmp(dp->symbol, "STAKED", 6) == 0) ) != 0; - fprintf(stderr,"suppress %s -> KMD freq KMD blocks.%d\n",dp->symbol,checkpointfreq); + fprintf(stderr,"suppress.[%d] %s -> KMD freq KMD blocks.%d\n",suppress,dp->symbol,checkpointfreq); } } /*if ( strcmp(dp->dest,"KMD") == 0 )//|| strcmp(dp->dest,"CHAIN") == 0 ) From 9a2f2a4bde89fbceaaa3d4951c2f85acb140c601 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Thu, 13 Sep 2018 19:52:42 +0800 Subject: [PATCH 015/167] disable it alltogether --- iguana/iguana_notary.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iguana/iguana_notary.c b/iguana/iguana_notary.c index 91e0ee549..b056dce7d 100755 --- a/iguana/iguana_notary.c +++ b/iguana/iguana_notary.c @@ -73,7 +73,7 @@ void dpow_srcupdate(struct supernet_info *myinfo,struct dpow_info *dp,int32_t he if ( dp->DESTHEIGHT < dp->prevDESTHEIGHT+checkpointfreq ) { //suppress = 1; - suppress = ( (strlen(dp->symbol) >= 4 && strncmp(dp->symbol, "STKD", 4) == 0) || (strlen(dp->symbol) >= 6 && strncmp(dp->symbol, "STAKED", 6) == 0) ) != 0; + suppress = 0 //( (strlen(dp->symbol) >= 4 && strncmp(dp->symbol, "STKD", 4) == 0) || (strlen(dp->symbol) >= 6 && strncmp(dp->symbol, "STAKED", 6) == 0) ) != 0; fprintf(stderr,"suppress.[%d] %s -> KMD freq KMD blocks.%d\n",suppress,dp->symbol,checkpointfreq); } } From cfc959985ec904624a585bdbcba942bfafb65c68 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Thu, 13 Sep 2018 19:54:33 +0800 Subject: [PATCH 016/167] oops --- iguana/iguana_notary.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iguana/iguana_notary.c b/iguana/iguana_notary.c index b056dce7d..dddc798d7 100755 --- a/iguana/iguana_notary.c +++ b/iguana/iguana_notary.c @@ -73,7 +73,7 @@ void dpow_srcupdate(struct supernet_info *myinfo,struct dpow_info *dp,int32_t he if ( dp->DESTHEIGHT < dp->prevDESTHEIGHT+checkpointfreq ) { //suppress = 1; - suppress = 0 //( (strlen(dp->symbol) >= 4 && strncmp(dp->symbol, "STKD", 4) == 0) || (strlen(dp->symbol) >= 6 && strncmp(dp->symbol, "STAKED", 6) == 0) ) != 0; + suppress = 0; //( (strlen(dp->symbol) >= 4 && strncmp(dp->symbol, "STKD", 4) == 0) || (strlen(dp->symbol) >= 6 && strncmp(dp->symbol, "STAKED", 6) == 0) ) != 0; fprintf(stderr,"suppress.[%d] %s -> KMD freq KMD blocks.%d\n",suppress,dp->symbol,checkpointfreq); } } From 3fe4ad68a34246ac1060d60b456419ea8fe74ce5 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Thu, 13 Sep 2018 20:15:30 +0800 Subject: [PATCH 017/167] test for now --- iguana/iguana_notary.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/iguana/iguana_notary.c b/iguana/iguana_notary.c index dddc798d7..cde5c75d4 100755 --- a/iguana/iguana_notary.c +++ b/iguana/iguana_notary.c @@ -72,9 +72,8 @@ void dpow_srcupdate(struct supernet_info *myinfo,struct dpow_info *dp,int32_t he //checkpointfreq = 5; if ( dp->DESTHEIGHT < dp->prevDESTHEIGHT+checkpointfreq ) { - //suppress = 1; - suppress = 0; //( (strlen(dp->symbol) >= 4 && strncmp(dp->symbol, "STKD", 4) == 0) || (strlen(dp->symbol) >= 6 && strncmp(dp->symbol, "STAKED", 6) == 0) ) != 0; - fprintf(stderr,"suppress.[%d] %s -> KMD freq KMD blocks.%d\n",suppress,dp->symbol,checkpointfreq); + suppress = 0; + //fprintf(stderr,"suppress.[%d] %s -> KMD freq KMD blocks.%d\n",suppress,dp->symbol,checkpointfreq); } } /*if ( strcmp(dp->dest,"KMD") == 0 )//|| strcmp(dp->dest,"CHAIN") == 0 ) From 4f378da03325b2f57ab3107255cd987fc9036ee3 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Thu, 13 Sep 2018 22:37:02 +0800 Subject: [PATCH 018/167] test suppress again --- iguana/iguana_notary.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/iguana/iguana_notary.c b/iguana/iguana_notary.c index cde5c75d4..9d42efb20 100755 --- a/iguana/iguana_notary.c +++ b/iguana/iguana_notary.c @@ -68,12 +68,12 @@ void dpow_srcupdate(struct supernet_info *myinfo,struct dpow_info *dp,int32_t he if ( strcmp(dp->dest,"KMD") == 0 ) { checkpointfreq = DPOW_CHECKPOINTFREQ; - //if ( (strlen(dp->symbol) >= 4 && strncmp(dp->symbol, "STKD", 4) == 0) || (strlen(dp->symbol) >= 6 && strncmp(dp->symbol, "STAKED", 6) == 0) ) - //checkpointfreq = 5; + if ( (strlen(dp->symbol) >= 4 && strncmp(dp->symbol, "STKD", 4) == 0) || (strlen(dp->symbol) >= 6 && strncmp(dp->symbol, "STAKED", 6) == 0) ) + checkpointfreq = 5; if ( dp->DESTHEIGHT < dp->prevDESTHEIGHT+checkpointfreq ) { - suppress = 0; - //fprintf(stderr,"suppress.[%d] %s -> KMD freq KMD blocks.%d\n",suppress,dp->symbol,checkpointfreq); + suppress = 1; + fprintf(stderr,"suppress.[%d] %s -> KMD freq KMD blocks.%d\n",suppress,dp->symbol,checkpointfreq); } } /*if ( strcmp(dp->dest,"KMD") == 0 )//|| strcmp(dp->dest,"CHAIN") == 0 ) From 45f17d36bc451af326846beb0f3340baf1a3806e Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Thu, 13 Sep 2018 22:44:49 +0800 Subject: [PATCH 019/167] test --- iguana/iguana_notary.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iguana/iguana_notary.c b/iguana/iguana_notary.c index 9d42efb20..e19f200ff 100755 --- a/iguana/iguana_notary.c +++ b/iguana/iguana_notary.c @@ -73,7 +73,7 @@ void dpow_srcupdate(struct supernet_info *myinfo,struct dpow_info *dp,int32_t he if ( dp->DESTHEIGHT < dp->prevDESTHEIGHT+checkpointfreq ) { suppress = 1; - fprintf(stderr,"suppress.[%d] %s -> KMD freq KMD blocks.%d\n",suppress,dp->symbol,checkpointfreq); + fprintf(stderr,"suppress.[%d] %s -> KMD freq KMD prevDESTHEIGHT.%d\n",suppress,dp->symbol,dp->prevDESTHEIGHT); } } /*if ( strcmp(dp->dest,"KMD") == 0 )//|| strcmp(dp->dest,"CHAIN") == 0 ) From c83e794f9931a621d086a5e176c27c31d0b591a9 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Thu, 13 Sep 2018 23:05:05 +0800 Subject: [PATCH 020/167] who knows --- iguana/iguana_notary.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/iguana/iguana_notary.c b/iguana/iguana_notary.c index e19f200ff..3ad34be16 100755 --- a/iguana/iguana_notary.c +++ b/iguana/iguana_notary.c @@ -61,20 +61,21 @@ void dpow_checkpointset(struct supernet_info *myinfo,struct dpow_checkpoint *che void dpow_srcupdate(struct supernet_info *myinfo,struct dpow_info *dp,int32_t height,bits256 hash,uint32_t timestamp,uint32_t blocktime) { //struct komodo_ccdataMoMoM mdata; cJSON *blockjson; uint64_t signedmask; struct iguana_info *coin; - void **ptrs; char str[65]; struct dpow_checkpoint checkpoint; int32_t checkpointfreq,i,ht,suppress=0; struct dpow_block *bp; + void **ptrs; char str[65]; struct dpow_checkpoint checkpoint; int32_t i,ht,suppress=0; struct dpow_block *bp; dpow_checkpointset(myinfo,&dp->last,height,hash,timestamp,blocktime); checkpoint = dp->srcfifo[dp->srcconfirms]; dpow_fifoupdate(myinfo,dp->srcfifo,dp->last); if ( strcmp(dp->dest,"KMD") == 0 ) { - checkpointfreq = DPOW_CHECKPOINTFREQ; - if ( (strlen(dp->symbol) >= 4 && strncmp(dp->symbol, "STKD", 4) == 0) || (strlen(dp->symbol) >= 6 && strncmp(dp->symbol, "STAKED", 6) == 0) ) - checkpointfreq = 5; if ( dp->DESTHEIGHT < dp->prevDESTHEIGHT+checkpointfreq ) { + if ( strncmp(dp->symbol, "STKD", 4) == 0) || strncmp(dp->symbol, "STAKED", 6) == 0) ) + suppress = 0 + else suppress = 1; - fprintf(stderr,"suppress.[%d] %s -> KMD freq KMD prevDESTHEIGHT.%d\n",suppress,dp->symbol,dp->prevDESTHEIGHT); + //fprintf(stderr,"suppress.[%d] %s -> KMD freq KMD prevDESTHEIGHT.%d\n",suppress,dp->symbol,dp->prevDESTHEIGHT); } + } /*if ( strcmp(dp->dest,"KMD") == 0 )//|| strcmp(dp->dest,"CHAIN") == 0 ) { From 728298aabe6839a879732138c7c0957b2ebb7e25 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Thu, 13 Sep 2018 23:06:29 +0800 Subject: [PATCH 021/167] oops --- iguana/iguana_notary.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iguana/iguana_notary.c b/iguana/iguana_notary.c index 3ad34be16..fb4205105 100755 --- a/iguana/iguana_notary.c +++ b/iguana/iguana_notary.c @@ -70,7 +70,7 @@ void dpow_srcupdate(struct supernet_info *myinfo,struct dpow_info *dp,int32_t he if ( dp->DESTHEIGHT < dp->prevDESTHEIGHT+checkpointfreq ) { if ( strncmp(dp->symbol, "STKD", 4) == 0) || strncmp(dp->symbol, "STAKED", 6) == 0) ) - suppress = 0 + suppress = 0; else suppress = 1; //fprintf(stderr,"suppress.[%d] %s -> KMD freq KMD prevDESTHEIGHT.%d\n",suppress,dp->symbol,dp->prevDESTHEIGHT); From cb8484d9f74c278ae5ffa7e450623605d9e34905 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Thu, 13 Sep 2018 23:10:38 +0800 Subject: [PATCH 022/167] test --- iguana/dpow/dpow_rpc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iguana/dpow/dpow_rpc.c b/iguana/dpow/dpow_rpc.c index 661aba0cc..5a44553ba 100755 --- a/iguana/dpow/dpow_rpc.c +++ b/iguana/dpow/dpow_rpc.c @@ -289,7 +289,7 @@ int32_t dpow_paxpending(struct supernet_info *myinfo,uint8_t *hex,int32_t hexsiz MoMdepth = (MoMdepth & 0xffff) | ((uint32_t)CCid<<16); n += iguana_rwnum(1,&hex[n],sizeof(MoMdepth),(uint32_t *)&MoMdepth); - if ( ( (strlen(bp->srccoin->symbol) >= 4 && strncmp(bp->srccoin->symbol, "STKD", 4) == 0) || (strlen(bp->srccoin->symbol) >= 6 && strncmp(bp->srccoin->symbol, "STAKED", 6) == 0) ) && src_or_dest == 0 && strcmp(bp->destcoin->symbol,"KMD") == 0 ) + if ( (strncmp(bp->srccoin->symbol, "STKD", 4) == 0) || (strncmp(bp->srccoin->symbol, "STAKED", 6) == 0) ) && src_or_dest == 0 && strcmp(bp->destcoin->symbol,"KMD") == 0 ) { kmdcoin = bp->destcoin; if ( (infojson= dpow_getinfo(myinfo,kmdcoin)) != 0 ) From a067f0eb8f2b1205eebf47e9c709d472ac981df0 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Thu, 13 Sep 2018 23:14:39 +0800 Subject: [PATCH 023/167] test --- iguana/dpow/dpow_rpc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iguana/dpow/dpow_rpc.c b/iguana/dpow/dpow_rpc.c index 5a44553ba..5c1bf38d5 100755 --- a/iguana/dpow/dpow_rpc.c +++ b/iguana/dpow/dpow_rpc.c @@ -289,7 +289,7 @@ int32_t dpow_paxpending(struct supernet_info *myinfo,uint8_t *hex,int32_t hexsiz MoMdepth = (MoMdepth & 0xffff) | ((uint32_t)CCid<<16); n += iguana_rwnum(1,&hex[n],sizeof(MoMdepth),(uint32_t *)&MoMdepth); - if ( (strncmp(bp->srccoin->symbol, "STKD", 4) == 0) || (strncmp(bp->srccoin->symbol, "STAKED", 6) == 0) ) && src_or_dest == 0 && strcmp(bp->destcoin->symbol,"KMD") == 0 ) + if ( ((strncmp(bp->srccoin->symbol, "STKD", 4) == 0) || (strncmp(bp->srccoin->symbol, "STAKED", 6) == 0) ) && src_or_dest == 0 && strcmp(bp->destcoin->symbol,"KMD") == 0 ) { kmdcoin = bp->destcoin; if ( (infojson= dpow_getinfo(myinfo,kmdcoin)) != 0 ) From 01825b5b69839d16e1d6bc01a8c828b1bbc7430f Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Thu, 13 Sep 2018 23:21:36 +0800 Subject: [PATCH 024/167] another --- iguana/dpow/dpow_rpc.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/iguana/dpow/dpow_rpc.c b/iguana/dpow/dpow_rpc.c index 5c1bf38d5..1e31e6548 100755 --- a/iguana/dpow/dpow_rpc.c +++ b/iguana/dpow/dpow_rpc.c @@ -288,8 +288,8 @@ int32_t dpow_paxpending(struct supernet_info *myinfo,uint8_t *hex,int32_t hexsiz n += iguana_rwbignum(1,&hex[n],sizeof(MoM),MoM.bytes); MoMdepth = (MoMdepth & 0xffff) | ((uint32_t)CCid<<16); n += iguana_rwnum(1,&hex[n],sizeof(MoMdepth),(uint32_t *)&MoMdepth); - - if ( ((strncmp(bp->srccoin->symbol, "STKD", 4) == 0) || (strncmp(bp->srccoin->symbol, "STAKED", 6) == 0) ) && src_or_dest == 0 && strcmp(bp->destcoin->symbol,"KMD") == 0 ) +//( || (strncmp(bp->srccoin->symbol, "STAKED", 6) == 0) ) + if ( (strncmp(bp->srccoin->symbol, "STKD", 4) == 0) && src_or_dest == 0 && strcmp(bp->destcoin->symbol,"KMD") == 0 ) { kmdcoin = bp->destcoin; if ( (infojson= dpow_getinfo(myinfo,kmdcoin)) != 0 ) @@ -310,8 +310,8 @@ int32_t dpow_paxpending(struct supernet_info *myinfo,uint8_t *hex,int32_t hexsiz } paxwdcrc = calc_crc32(0,hex,n) & 0xffffff00; paxwdcrc |= (n & 0xff); - //if ( hexlen > 0 ) - //printf("%s.ht.%d opretlen.%d src_or_dest.%d dest.(%s) lastbest.%d paxwdcrc.%x\n",bp->srccoin->symbol,bp->height,n,src_or_dest,bp->destcoin->symbol,kmdcoin!=0?((kmdcoin->lastbestheight/10)*10 - 5):-1,paxwdcrc); + if ( hexlen > 0 ) + printf("%s.ht.%d opretlen.%d src_or_dest.%d dest.(%s) lastbest.%d paxwdcrc.%x\n",bp->srccoin->symbol,bp->height,n,src_or_dest,bp->destcoin->symbol,kmdcoin!=0?((kmdcoin->lastbestheight/10)*10 - 5):-1,paxwdcrc); } *paxwdcrcp = paxwdcrc; return(n); From 2a089459f41685e973e2eca284ecd161aae238a3 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Thu, 13 Sep 2018 23:24:43 +0800 Subject: [PATCH 025/167] a --- iguana/dpow/dpow_rpc.c | 4 ++-- iguana/iguana_notary.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/iguana/dpow/dpow_rpc.c b/iguana/dpow/dpow_rpc.c index 1e31e6548..005515565 100755 --- a/iguana/dpow/dpow_rpc.c +++ b/iguana/dpow/dpow_rpc.c @@ -288,8 +288,8 @@ int32_t dpow_paxpending(struct supernet_info *myinfo,uint8_t *hex,int32_t hexsiz n += iguana_rwbignum(1,&hex[n],sizeof(MoM),MoM.bytes); MoMdepth = (MoMdepth & 0xffff) | ((uint32_t)CCid<<16); n += iguana_rwnum(1,&hex[n],sizeof(MoMdepth),(uint32_t *)&MoMdepth); -//( || (strncmp(bp->srccoin->symbol, "STAKED", 6) == 0) ) - if ( (strncmp(bp->srccoin->symbol, "STKD", 4) == 0) && src_or_dest == 0 && strcmp(bp->destcoin->symbol,"KMD") == 0 ) +//( ) + if ( ( (strncmp(bp->srccoin->symbol, "STKD", 4) == 0) || (strncmp(bp->srccoin->symbol, "STAKED", 6) == 0) ) && src_or_dest == 0 && strcmp(bp->destcoin->symbol,"KMD") == 0 ) { kmdcoin = bp->destcoin; if ( (infojson= dpow_getinfo(myinfo,kmdcoin)) != 0 ) diff --git a/iguana/iguana_notary.c b/iguana/iguana_notary.c index fb4205105..7b158c02a 100755 --- a/iguana/iguana_notary.c +++ b/iguana/iguana_notary.c @@ -67,7 +67,7 @@ void dpow_srcupdate(struct supernet_info *myinfo,struct dpow_info *dp,int32_t he dpow_fifoupdate(myinfo,dp->srcfifo,dp->last); if ( strcmp(dp->dest,"KMD") == 0 ) { - if ( dp->DESTHEIGHT < dp->prevDESTHEIGHT+checkpointfreq ) + if ( dp->DESTHEIGHT < dp->prevDESTHEIGHT+DPOW_CHECKPOINTFREQ ) { if ( strncmp(dp->symbol, "STKD", 4) == 0) || strncmp(dp->symbol, "STAKED", 6) == 0) ) suppress = 0; From 4b6d7603e57e4cac9cfa9c9f42014b71687878ee Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Thu, 13 Sep 2018 23:26:53 +0800 Subject: [PATCH 026/167] a --- iguana/iguana_notary.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iguana/iguana_notary.c b/iguana/iguana_notary.c index 7b158c02a..c4ede176b 100755 --- a/iguana/iguana_notary.c +++ b/iguana/iguana_notary.c @@ -69,7 +69,7 @@ void dpow_srcupdate(struct supernet_info *myinfo,struct dpow_info *dp,int32_t he { if ( dp->DESTHEIGHT < dp->prevDESTHEIGHT+DPOW_CHECKPOINTFREQ ) { - if ( strncmp(dp->symbol, "STKD", 4) == 0) || strncmp(dp->symbol, "STAKED", 6) == 0) ) + if ( (strncmp(dp->symbol, "STKD", 4) == 0) || (strncmp(dp->symbol, "STAKED", 6) == 0) ) suppress = 0; else suppress = 1; From 81f379a8c642694ebe79f180f24a8b6de75fcf24 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Thu, 13 Sep 2018 23:43:30 +0800 Subject: [PATCH 027/167] maybe its this --- iguana/dpow/dpow_rpc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iguana/dpow/dpow_rpc.c b/iguana/dpow/dpow_rpc.c index 005515565..ef9008488 100755 --- a/iguana/dpow/dpow_rpc.c +++ b/iguana/dpow/dpow_rpc.c @@ -289,7 +289,7 @@ int32_t dpow_paxpending(struct supernet_info *myinfo,uint8_t *hex,int32_t hexsiz MoMdepth = (MoMdepth & 0xffff) | ((uint32_t)CCid<<16); n += iguana_rwnum(1,&hex[n],sizeof(MoMdepth),(uint32_t *)&MoMdepth); //( ) - if ( ( (strncmp(bp->srccoin->symbol, "STKD", 4) == 0) || (strncmp(bp->srccoin->symbol, "STAKED", 6) == 0) ) && src_or_dest == 0 && strcmp(bp->destcoin->symbol,"KMD") == 0 ) + if ( ( (strncmp(bp->srccoin->symbol, "STKE", 4) == 0) || (strncmp(bp->srccoin->symbol, "STAKEE", 6) == 0) ) && src_or_dest == 0 && strcmp(bp->destcoin->symbol,"KMD") == 0 ) { kmdcoin = bp->destcoin; if ( (infojson= dpow_getinfo(myinfo,kmdcoin)) != 0 ) From d9060206af0d455f7cda411053730b6da743d0f7 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 14 Sep 2018 00:18:26 +0800 Subject: [PATCH 028/167] try suppress again --- iguana/dpow/dpow_rpc.c | 2 +- iguana/iguana_notary.c | 13 ++++++------- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/iguana/dpow/dpow_rpc.c b/iguana/dpow/dpow_rpc.c index ef9008488..005515565 100755 --- a/iguana/dpow/dpow_rpc.c +++ b/iguana/dpow/dpow_rpc.c @@ -289,7 +289,7 @@ int32_t dpow_paxpending(struct supernet_info *myinfo,uint8_t *hex,int32_t hexsiz MoMdepth = (MoMdepth & 0xffff) | ((uint32_t)CCid<<16); n += iguana_rwnum(1,&hex[n],sizeof(MoMdepth),(uint32_t *)&MoMdepth); //( ) - if ( ( (strncmp(bp->srccoin->symbol, "STKE", 4) == 0) || (strncmp(bp->srccoin->symbol, "STAKEE", 6) == 0) ) && src_or_dest == 0 && strcmp(bp->destcoin->symbol,"KMD") == 0 ) + if ( ( (strncmp(bp->srccoin->symbol, "STKD", 4) == 0) || (strncmp(bp->srccoin->symbol, "STAKED", 6) == 0) ) && src_or_dest == 0 && strcmp(bp->destcoin->symbol,"KMD") == 0 ) { kmdcoin = bp->destcoin; if ( (infojson= dpow_getinfo(myinfo,kmdcoin)) != 0 ) diff --git a/iguana/iguana_notary.c b/iguana/iguana_notary.c index c4ede176b..e94447652 100755 --- a/iguana/iguana_notary.c +++ b/iguana/iguana_notary.c @@ -61,21 +61,20 @@ void dpow_checkpointset(struct supernet_info *myinfo,struct dpow_checkpoint *che void dpow_srcupdate(struct supernet_info *myinfo,struct dpow_info *dp,int32_t height,bits256 hash,uint32_t timestamp,uint32_t blocktime) { //struct komodo_ccdataMoMoM mdata; cJSON *blockjson; uint64_t signedmask; struct iguana_info *coin; - void **ptrs; char str[65]; struct dpow_checkpoint checkpoint; int32_t i,ht,suppress=0; struct dpow_block *bp; + void **ptrs; char str[65]; struct dpow_checkpoint checkpoint; int32_t checkpointfreq,i,ht,suppress=0; struct dpow_block *bp; dpow_checkpointset(myinfo,&dp->last,height,hash,timestamp,blocktime); checkpoint = dp->srcfifo[dp->srcconfirms]; dpow_fifoupdate(myinfo,dp->srcfifo,dp->last); if ( strcmp(dp->dest,"KMD") == 0 ) { - if ( dp->DESTHEIGHT < dp->prevDESTHEIGHT+DPOW_CHECKPOINTFREQ ) + checkpointfreq = DPOW_CHECKPOINTFREQ; + if ( (strncmp(dp->symbol, "STKD", 4) == 0) || (strncmp(dp->symbol, "STAKED", 6) == 0) ) + checkpointfreq = 5; + if ( dp->DESTHEIGHT < dp->prevDESTHEIGHT+checkpointfreq ) { - if ( (strncmp(dp->symbol, "STKD", 4) == 0) || (strncmp(dp->symbol, "STAKED", 6) == 0) ) - suppress = 0; - else suppress = 1; - //fprintf(stderr,"suppress.[%d] %s -> KMD freq KMD prevDESTHEIGHT.%d\n",suppress,dp->symbol,dp->prevDESTHEIGHT); + fprintf(stderr,"suppress.[%d] %s -> KMD freq KMD blocks.%d\n",suppress,dp->symbol,checkpointfreq); } - } /*if ( strcmp(dp->dest,"KMD") == 0 )//|| strcmp(dp->dest,"CHAIN") == 0 ) { From 9f5e36a48a24d680e0e6e0374019f983d5424840 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 14 Sep 2018 00:44:54 +0800 Subject: [PATCH 029/167] suppress SUCKS! --- iguana/iguana_notary.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/iguana/iguana_notary.c b/iguana/iguana_notary.c index e94447652..2c9ade687 100755 --- a/iguana/iguana_notary.c +++ b/iguana/iguana_notary.c @@ -61,19 +61,19 @@ void dpow_checkpointset(struct supernet_info *myinfo,struct dpow_checkpoint *che void dpow_srcupdate(struct supernet_info *myinfo,struct dpow_info *dp,int32_t height,bits256 hash,uint32_t timestamp,uint32_t blocktime) { //struct komodo_ccdataMoMoM mdata; cJSON *blockjson; uint64_t signedmask; struct iguana_info *coin; - void **ptrs; char str[65]; struct dpow_checkpoint checkpoint; int32_t checkpointfreq,i,ht,suppress=0; struct dpow_block *bp; + void **ptrs; char str[65]; struct dpow_checkpoint checkpoint; int32_t i,ht,suppress=0; struct dpow_block *bp; dpow_checkpointset(myinfo,&dp->last,height,hash,timestamp,blocktime); checkpoint = dp->srcfifo[dp->srcconfirms]; dpow_fifoupdate(myinfo,dp->srcfifo,dp->last); if ( strcmp(dp->dest,"KMD") == 0 ) { - checkpointfreq = DPOW_CHECKPOINTFREQ; - if ( (strncmp(dp->symbol, "STKD", 4) == 0) || (strncmp(dp->symbol, "STAKED", 6) == 0) ) - checkpointfreq = 5; - if ( dp->DESTHEIGHT < dp->prevDESTHEIGHT+checkpointfreq ) + if ( dp->DESTHEIGHT < dp->prevDESTHEIGHT+DPOW_CHECKPOINTFREQ ) { - suppress = 1; - fprintf(stderr,"suppress.[%d] %s -> KMD freq KMD blocks.%d\n",suppress,dp->symbol,checkpointfreq); + if ( (strncmp(dp->symbol, "STKD", 4) == 0) || (strncmp(dp->symbol, "STAKED", 6) == 0) ) + suppress = 0; + else + suppress = 1; + //fprintf(stderr,"suppress %s -> KMD freq KMD blocks.%d\n",dp->symbol,checkpointfreq); } } /*if ( strcmp(dp->dest,"KMD") == 0 )//|| strcmp(dp->dest,"CHAIN") == 0 ) From e41f87e08a2f9dcd2676fa7d886c4404a8d91132 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 14 Sep 2018 00:57:06 +0800 Subject: [PATCH 030/167] Remove the prints again --- iguana/dpow/dpow_rpc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/iguana/dpow/dpow_rpc.c b/iguana/dpow/dpow_rpc.c index 005515565..7fcbc1c4b 100755 --- a/iguana/dpow/dpow_rpc.c +++ b/iguana/dpow/dpow_rpc.c @@ -302,7 +302,7 @@ int32_t dpow_paxpending(struct supernet_info *myinfo,uint8_t *hex,int32_t hexsiz if ( (hexstr= jstr(retjson,"data")) != 0 && (hexlen= (int32_t)strlen(hexstr)) > 0 && n+hexlen/2 <= hexsize ) { hexlen >>= 1; - printf("add MoMoMdata.(%s)\n",hexstr); + //printf("add MoMoMdata.(%s)\n",hexstr); decode_hex(&hex[n],hexlen,hexstr), n += hexlen; } free_json(retjson); @@ -310,8 +310,8 @@ int32_t dpow_paxpending(struct supernet_info *myinfo,uint8_t *hex,int32_t hexsiz } paxwdcrc = calc_crc32(0,hex,n) & 0xffffff00; paxwdcrc |= (n & 0xff); - if ( hexlen > 0 ) - printf("%s.ht.%d opretlen.%d src_or_dest.%d dest.(%s) lastbest.%d paxwdcrc.%x\n",bp->srccoin->symbol,bp->height,n,src_or_dest,bp->destcoin->symbol,kmdcoin!=0?((kmdcoin->lastbestheight/10)*10 - 5):-1,paxwdcrc); + //if ( hexlen > 0 ) + //printf("%s.ht.%d opretlen.%d src_or_dest.%d dest.(%s) lastbest.%d paxwdcrc.%x\n",bp->srccoin->symbol,bp->height,n,src_or_dest,bp->destcoin->symbol,kmdcoin!=0?((kmdcoin->lastbestheight/10)*10 - 5):-1,paxwdcrc); } *paxwdcrcp = paxwdcrc; return(n); From 8efc12ae8556a1acc73e7bcb9cb7ad497df23d55 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sat, 15 Sep 2018 05:14:41 +0800 Subject: [PATCH 031/167] remove MoMoM --- iguana/dpow/dpow_rpc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iguana/dpow/dpow_rpc.c b/iguana/dpow/dpow_rpc.c index 7fcbc1c4b..536ddec03 100755 --- a/iguana/dpow/dpow_rpc.c +++ b/iguana/dpow/dpow_rpc.c @@ -289,7 +289,7 @@ int32_t dpow_paxpending(struct supernet_info *myinfo,uint8_t *hex,int32_t hexsiz MoMdepth = (MoMdepth & 0xffff) | ((uint32_t)CCid<<16); n += iguana_rwnum(1,&hex[n],sizeof(MoMdepth),(uint32_t *)&MoMdepth); //( ) - if ( ( (strncmp(bp->srccoin->symbol, "STKD", 4) == 0) || (strncmp(bp->srccoin->symbol, "STAKED", 6) == 0) ) && src_or_dest == 0 && strcmp(bp->destcoin->symbol,"KMD") == 0 ) + if ( ( (strncmp(bp->srccoin->symbol, "STKE", 4) == 0) || (strncmp(bp->srccoin->symbol, "STAKEE", 6) == 0) ) && src_or_dest == 0 && strcmp(bp->destcoin->symbol,"KMD") == 0 ) { kmdcoin = bp->destcoin; if ( (infojson= dpow_getinfo(myinfo,kmdcoin)) != 0 ) From 41235bc3a30285f586450d4e681274c648956033 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sat, 15 Sep 2018 05:56:07 +0800 Subject: [PATCH 032/167] disable MoMoM --- iguana/dpow/dpow_rpc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iguana/dpow/dpow_rpc.c b/iguana/dpow/dpow_rpc.c index 7fcbc1c4b..536ddec03 100755 --- a/iguana/dpow/dpow_rpc.c +++ b/iguana/dpow/dpow_rpc.c @@ -289,7 +289,7 @@ int32_t dpow_paxpending(struct supernet_info *myinfo,uint8_t *hex,int32_t hexsiz MoMdepth = (MoMdepth & 0xffff) | ((uint32_t)CCid<<16); n += iguana_rwnum(1,&hex[n],sizeof(MoMdepth),(uint32_t *)&MoMdepth); //( ) - if ( ( (strncmp(bp->srccoin->symbol, "STKD", 4) == 0) || (strncmp(bp->srccoin->symbol, "STAKED", 6) == 0) ) && src_or_dest == 0 && strcmp(bp->destcoin->symbol,"KMD") == 0 ) + if ( ( (strncmp(bp->srccoin->symbol, "STKE", 4) == 0) || (strncmp(bp->srccoin->symbol, "STAKEE", 6) == 0) ) && src_or_dest == 0 && strcmp(bp->destcoin->symbol,"KMD") == 0 ) { kmdcoin = bp->destcoin; if ( (infojson= dpow_getinfo(myinfo,kmdcoin)) != 0 ) From 6132b4e01f08d4d27b0133538fd3b4347515a611 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sat, 15 Sep 2018 13:12:35 +0800 Subject: [PATCH 033/167] enable MoMoM --- iguana/dpow/dpow_rpc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iguana/dpow/dpow_rpc.c b/iguana/dpow/dpow_rpc.c index 536ddec03..7fcbc1c4b 100755 --- a/iguana/dpow/dpow_rpc.c +++ b/iguana/dpow/dpow_rpc.c @@ -289,7 +289,7 @@ int32_t dpow_paxpending(struct supernet_info *myinfo,uint8_t *hex,int32_t hexsiz MoMdepth = (MoMdepth & 0xffff) | ((uint32_t)CCid<<16); n += iguana_rwnum(1,&hex[n],sizeof(MoMdepth),(uint32_t *)&MoMdepth); //( ) - if ( ( (strncmp(bp->srccoin->symbol, "STKE", 4) == 0) || (strncmp(bp->srccoin->symbol, "STAKEE", 6) == 0) ) && src_or_dest == 0 && strcmp(bp->destcoin->symbol,"KMD") == 0 ) + if ( ( (strncmp(bp->srccoin->symbol, "STKD", 4) == 0) || (strncmp(bp->srccoin->symbol, "STAKED", 6) == 0) ) && src_or_dest == 0 && strcmp(bp->destcoin->symbol,"KMD") == 0 ) { kmdcoin = bp->destcoin; if ( (infojson= dpow_getinfo(myinfo,kmdcoin)) != 0 ) From 7d80031469b5f10c5bf89f345ade40394701ac22 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Mon, 17 Sep 2018 21:31:34 +0800 Subject: [PATCH 034/167] enable MoMoM --- iguana/dpow/dpow_rpc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iguana/dpow/dpow_rpc.c b/iguana/dpow/dpow_rpc.c index 536ddec03..7fcbc1c4b 100755 --- a/iguana/dpow/dpow_rpc.c +++ b/iguana/dpow/dpow_rpc.c @@ -289,7 +289,7 @@ int32_t dpow_paxpending(struct supernet_info *myinfo,uint8_t *hex,int32_t hexsiz MoMdepth = (MoMdepth & 0xffff) | ((uint32_t)CCid<<16); n += iguana_rwnum(1,&hex[n],sizeof(MoMdepth),(uint32_t *)&MoMdepth); //( ) - if ( ( (strncmp(bp->srccoin->symbol, "STKE", 4) == 0) || (strncmp(bp->srccoin->symbol, "STAKEE", 6) == 0) ) && src_or_dest == 0 && strcmp(bp->destcoin->symbol,"KMD") == 0 ) + if ( ( (strncmp(bp->srccoin->symbol, "STKD", 4) == 0) || (strncmp(bp->srccoin->symbol, "STAKED", 6) == 0) ) && src_or_dest == 0 && strcmp(bp->destcoin->symbol,"KMD") == 0 ) { kmdcoin = bp->destcoin; if ( (infojson= dpow_getinfo(myinfo,kmdcoin)) != 0 ) From 3a8f0ea57323e70d6667217ad2b9332aa4a6420b Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Mon, 17 Sep 2018 21:45:46 +0800 Subject: [PATCH 035/167] try lockuspent function from Decker --- iguana/dpow/dpow_rpc.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/iguana/dpow/dpow_rpc.c b/iguana/dpow/dpow_rpc.c index 7fcbc1c4b..9f5ae3cf3 100755 --- a/iguana/dpow/dpow_rpc.c +++ b/iguana/dpow/dpow_rpc.c @@ -466,6 +466,23 @@ cJSON *dpow_gettxout(struct supernet_info *myinfo,struct iguana_info *coin,bits2 return(json); } +cJSON *dpow_lockunspent(struct supernet_info *myinfo,struct iguana_info *coin,char *coinaddr,char *txid,int32_t vout) +{ + char buf[128],*retstr; cJSON *json = 0; + if ( coin->FULLNODE < 0 ) + { + sprintf(buf,"false, [{\"txid\":\"%s\",\"vout\":%d}]", txid, vout); + if ( (retstr= bitcoind_passthru(coin->symbol,coin->chain->serverport,coin->chain->userpass,"lockunspent",buf)) != 0 ) + { + printf("RESULT.(%s)\n",retstr); + json = cJSON_Parse(retstr); + free(retstr); + return(json); + } else printf("%s null retstr from (%s)n",coin->symbol,buf); + } + return(0); +} + char *dpow_decoderawtransaction(struct supernet_info *myinfo,struct iguana_info *coin,char *rawtx) { char *retstr,*paramstr; cJSON *array; From d0d4884d0aafee242364c98effb2546eaf0c79ba Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Mon, 17 Sep 2018 22:45:18 +0800 Subject: [PATCH 036/167] add signed TX print back for Alright --- iguana/dpow/dpow_tx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iguana/dpow/dpow_tx.c b/iguana/dpow/dpow_tx.c index 9ffa025f6..23e2da44e 100755 --- a/iguana/dpow/dpow_tx.c +++ b/iguana/dpow/dpow_tx.c @@ -581,7 +581,7 @@ void dpow_sigscheck(struct supernet_info *myinfo,struct dpow_info *dp,struct dpo { dpow_notarytx(myinfo,bp->signedtx,&numsigs,coin->chain->isPoS,bp,bestk,bestmask,0,src_or_dest,pubkeys,numratified); // setcrcval signedtxid = dpow_notarytx(myinfo,bp->signedtx,&numsigs,coin->chain->isPoS,bp,bestk,bestmask,1,src_or_dest,pubkeys,numratified); - //printf("src_or_dest.%d bestk.%d %llx %s numsigs.%d signedtx.(%s)\n",src_or_dest,bestk,(long long)bestmask,bits256_str(str,signedtxid),numsigs,bp->signedtx); + printf("src_or_dest.%d bestk.%d %llx %s numsigs.%d signedtx.(%s)\n",src_or_dest,bestk,(long long)bestmask,bits256_str(str,signedtxid),numsigs,bp->signedtx); bp->state = 1; if ( bits256_nonz(signedtxid) != 0 && numsigs == bp->minsigs ) { From 62fa579ae5368053be029e6fd7dd3e01e7156c94 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Mon, 17 Sep 2018 22:47:53 +0800 Subject: [PATCH 037/167] location of print --- iguana/dpow/dpow_tx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/iguana/dpow/dpow_tx.c b/iguana/dpow/dpow_tx.c index 23e2da44e..ade70eb8b 100755 --- a/iguana/dpow/dpow_tx.c +++ b/iguana/dpow/dpow_tx.c @@ -581,7 +581,7 @@ void dpow_sigscheck(struct supernet_info *myinfo,struct dpow_info *dp,struct dpo { dpow_notarytx(myinfo,bp->signedtx,&numsigs,coin->chain->isPoS,bp,bestk,bestmask,0,src_or_dest,pubkeys,numratified); // setcrcval signedtxid = dpow_notarytx(myinfo,bp->signedtx,&numsigs,coin->chain->isPoS,bp,bestk,bestmask,1,src_or_dest,pubkeys,numratified); - printf("src_or_dest.%d bestk.%d %llx %s numsigs.%d signedtx.(%s)\n",src_or_dest,bestk,(long long)bestmask,bits256_str(str,signedtxid),numsigs,bp->signedtx); + //printf("src_or_dest.%d bestk.%d %llx %s numsigs.%d signedtx.(%s)\n",src_or_dest,bestk,(long long)bestmask,bits256_str(str,signedtxid),numsigs,bp->signedtx); bp->state = 1; if ( bits256_nonz(signedtxid) != 0 && numsigs == bp->minsigs ) { @@ -614,7 +614,7 @@ void dpow_sigscheck(struct supernet_info *myinfo,struct dpow_info *dp,struct dpo else { bp->state = 0xffffffff; - printf("dpow_sigscheck: mismatched txid.%s vs %s\n",bits256_str(str,txid),retstr); + printf("dpow_sigscheck: mismatched txid.%s vs %s \n signedtx.(%s)\n",bits256_str(str,txid),retstr,bp->signedtx)); } free(retstr); retstr = 0; From 68901595806b7c5f37dcd0b4433b1ddda8e84171 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Mon, 17 Sep 2018 22:49:06 +0800 Subject: [PATCH 038/167] add print of signed hex for mismatched txid --- iguana/dpow/dpow_tx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iguana/dpow/dpow_tx.c b/iguana/dpow/dpow_tx.c index 9ffa025f6..ade70eb8b 100755 --- a/iguana/dpow/dpow_tx.c +++ b/iguana/dpow/dpow_tx.c @@ -614,7 +614,7 @@ void dpow_sigscheck(struct supernet_info *myinfo,struct dpow_info *dp,struct dpo else { bp->state = 0xffffffff; - printf("dpow_sigscheck: mismatched txid.%s vs %s\n",bits256_str(str,txid),retstr); + printf("dpow_sigscheck: mismatched txid.%s vs %s \n signedtx.(%s)\n",bits256_str(str,txid),retstr,bp->signedtx)); } free(retstr); retstr = 0; From 26918653f3ba528b05018e2cf3c3f2225c926f7b Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Mon, 17 Sep 2018 22:51:14 +0800 Subject: [PATCH 039/167] fix --- iguana/dpow/dpow_tx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iguana/dpow/dpow_tx.c b/iguana/dpow/dpow_tx.c index ade70eb8b..12643c4ba 100755 --- a/iguana/dpow/dpow_tx.c +++ b/iguana/dpow/dpow_tx.c @@ -614,7 +614,7 @@ void dpow_sigscheck(struct supernet_info *myinfo,struct dpow_info *dp,struct dpo else { bp->state = 0xffffffff; - printf("dpow_sigscheck: mismatched txid.%s vs %s \n signedtx.(%s)\n",bits256_str(str,txid),retstr,bp->signedtx)); + printf("dpow_sigscheck: mismatched txid.%s vs %s \n signedtx.(%s)\n",bits256_str(str,txid),retstr,bp->signedtx); } free(retstr); retstr = 0; From 7e4707fafd64ee0bfa0efdca4629d5c49c52db22 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Mon, 17 Sep 2018 22:52:03 +0800 Subject: [PATCH 040/167] fix --- iguana/dpow/dpow_tx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iguana/dpow/dpow_tx.c b/iguana/dpow/dpow_tx.c index ade70eb8b..12643c4ba 100755 --- a/iguana/dpow/dpow_tx.c +++ b/iguana/dpow/dpow_tx.c @@ -614,7 +614,7 @@ void dpow_sigscheck(struct supernet_info *myinfo,struct dpow_info *dp,struct dpo else { bp->state = 0xffffffff; - printf("dpow_sigscheck: mismatched txid.%s vs %s \n signedtx.(%s)\n",bits256_str(str,txid),retstr,bp->signedtx)); + printf("dpow_sigscheck: mismatched txid.%s vs %s \n signedtx.(%s)\n",bits256_str(str,txid),retstr,bp->signedtx); } free(retstr); retstr = 0; From 72d1ff3a5ec89bf25cccd982aaf6c763005e5b2a Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Mon, 17 Sep 2018 23:42:13 +0800 Subject: [PATCH 041/167] print utxo selection ? --- iguana/dpow/dpow_fsm.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/iguana/dpow/dpow_fsm.c b/iguana/dpow/dpow_fsm.c index c531c27a7..cee934691 100755 --- a/iguana/dpow/dpow_fsm.c +++ b/iguana/dpow/dpow_fsm.c @@ -487,6 +487,8 @@ void dpow_statemachinestart(void *ptr) bp->notaries[myind].ratifysrcvout = ep->src.prev_vout; bp->notaries[myind].ratifydestutxo = ep->dest.prev_hash; bp->notaries[myind].ratifydestvout = ep->dest.prev_vout; + printf("src.prev_hash.(%s) vout.(%d)",ep->src.prev_hash,ep->src.prev_vout); + printf("dest.prev_hash.(%s) vout.(%d)",ep->dest.prev_hash,ep->dest.prev_vout); } else { @@ -598,4 +600,3 @@ void dpow_statemachinestart(void *ptr) bp->state = 0xffffffff; free(ptr); } - From 4a2565ed72a4394d414eb9921e3a609a38eb3002 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Mon, 17 Sep 2018 23:56:32 +0800 Subject: [PATCH 042/167] try again --- iguana/dpow/dpow_fsm.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/iguana/dpow/dpow_fsm.c b/iguana/dpow/dpow_fsm.c index cee934691..3ed3b4bce 100755 --- a/iguana/dpow/dpow_fsm.c +++ b/iguana/dpow/dpow_fsm.c @@ -487,8 +487,7 @@ void dpow_statemachinestart(void *ptr) bp->notaries[myind].ratifysrcvout = ep->src.prev_vout; bp->notaries[myind].ratifydestutxo = ep->dest.prev_hash; bp->notaries[myind].ratifydestvout = ep->dest.prev_vout; - printf("src.prev_hash.(%s) vout.(%d)",ep->src.prev_hash,ep->src.prev_vout); - printf("dest.prev_hash.(%s) vout.(%d)",ep->dest.prev_hash,ep->dest.prev_vout); + printf("Use srcutxo.(%s) vout.(%d) destutxo.(%s) vout.(%d)\n",bits256_str(str,ep->src.prev_hash),ep->src.prev_vout,bits256_str(str2,ep->dest.prev_hash),ep->dest.prev_vout); } else { From 9a6d9b8d90647546791d82101113e772e21c0501 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Tue, 18 Sep 2018 00:15:59 +0800 Subject: [PATCH 043/167] try another place --- iguana/dpow/dpow_fsm.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/iguana/dpow/dpow_fsm.c b/iguana/dpow/dpow_fsm.c index 3ed3b4bce..6f2627a7d 100755 --- a/iguana/dpow/dpow_fsm.c +++ b/iguana/dpow/dpow_fsm.c @@ -487,7 +487,6 @@ void dpow_statemachinestart(void *ptr) bp->notaries[myind].ratifysrcvout = ep->src.prev_vout; bp->notaries[myind].ratifydestutxo = ep->dest.prev_hash; bp->notaries[myind].ratifydestvout = ep->dest.prev_vout; - printf("Use srcutxo.(%s) vout.(%d) destutxo.(%s) vout.(%d)\n",bits256_str(str,ep->src.prev_hash),ep->src.prev_vout,bits256_str(str2,ep->dest.prev_hash),ep->dest.prev_vout); } else { @@ -502,6 +501,7 @@ void dpow_statemachinestart(void *ptr) bp->desttxid = bp->notaries[myind].src.prev_hash; dpow_signedtxgen(myinfo,dp,src,bp,bp->myind,1LL<myind,bp->myind,DPOW_SIGCHANNEL,0,0); }*/ + printf("Use srcutxo.(%s) vout.(%d) destutxo.(%s) vout.(%d)\n",bits256_str(str,bp->notaries[myind].ratifysrcutxo),bp->notaries[myind].ratifysrcvout,bits256_str(str2,ep->bp->notaries[myind].ratifydestutxo),bp->notaries[myind].ratifydestvout); bp->recvmask |= (1LL << myind); bp->notaries[myind].othermask |= (1LL << myind); dp->checkpoint = checkpoint; @@ -595,6 +595,7 @@ void dpow_statemachinestart(void *ptr) printf("[%d] END isratify.%d:%d bestk.%d %llx sigs.%llx state.%x machine ht.%d completed state.%x %s.%s %s.%s recvmask.%llx paxwdcrc.%x %p %p\n",Numallocated,bp->isratify,dp->ratifying,bp->bestk,(long long)bp->bestmask,(long long)(bp->bestk>=0?bp->destsigsmasks[bp->bestk]:0),bp->state,bp->height,bp->state,dp->dest,bits256_str(str,bp->desttxid),dp->symbol,bits256_str(str2,bp->srctxid),(long long)bp->recvmask,bp->paxwdcrc,src,dest); dp->lastrecvmask = bp->recvmask; dp->ratifying -= bp->isratify; + // call unlock unspent here // dp->blocks[bp->height] = 0; bp->state = 0xffffffff; free(ptr); From c5758e2b7608a7005a36a281ce238bd101fa04fa Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Tue, 18 Sep 2018 00:17:56 +0800 Subject: [PATCH 044/167] oops --- iguana/dpow/dpow_fsm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iguana/dpow/dpow_fsm.c b/iguana/dpow/dpow_fsm.c index 6f2627a7d..4964fa1e4 100755 --- a/iguana/dpow/dpow_fsm.c +++ b/iguana/dpow/dpow_fsm.c @@ -501,7 +501,7 @@ void dpow_statemachinestart(void *ptr) bp->desttxid = bp->notaries[myind].src.prev_hash; dpow_signedtxgen(myinfo,dp,src,bp,bp->myind,1LL<myind,bp->myind,DPOW_SIGCHANNEL,0,0); }*/ - printf("Use srcutxo.(%s) vout.(%d) destutxo.(%s) vout.(%d)\n",bits256_str(str,bp->notaries[myind].ratifysrcutxo),bp->notaries[myind].ratifysrcvout,bits256_str(str2,ep->bp->notaries[myind].ratifydestutxo),bp->notaries[myind].ratifydestvout); + printf("Use srcutxo.(%s) vout.(%d) destutxo.(%s) vout.(%d)\n",bits256_str(str,bp->notaries[myind].ratifysrcutxo),bp->notaries[myind].ratifysrcvout,bits256_str(str2,bp->notaries[myind].ratifydestutxo),bp->notaries[myind].ratifydestvout); bp->recvmask |= (1LL << myind); bp->notaries[myind].othermask |= (1LL << myind); dp->checkpoint = checkpoint; From 23a034249d863ce9172c478a9337657b0db61539 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Tue, 18 Sep 2018 00:29:41 +0800 Subject: [PATCH 045/167] try again --- iguana/dpow/dpow_fsm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iguana/dpow/dpow_fsm.c b/iguana/dpow/dpow_fsm.c index 4964fa1e4..5db46e9e4 100755 --- a/iguana/dpow/dpow_fsm.c +++ b/iguana/dpow/dpow_fsm.c @@ -501,7 +501,7 @@ void dpow_statemachinestart(void *ptr) bp->desttxid = bp->notaries[myind].src.prev_hash; dpow_signedtxgen(myinfo,dp,src,bp,bp->myind,1LL<myind,bp->myind,DPOW_SIGCHANNEL,0,0); }*/ - printf("Use srcutxo.(%s) vout.(%d) destutxo.(%s) vout.(%d)\n",bits256_str(str,bp->notaries[myind].ratifysrcutxo),bp->notaries[myind].ratifysrcvout,bits256_str(str2,bp->notaries[myind].ratifydestutxo),bp->notaries[myind].ratifydestvout); + printf("Use srcutxo.(%s) vout.(%d) destutxo.(%s) vout.(%d)\n",bits256_str(str,ep->src.prev_hash),ep->src.prev_vout,bits256_str(str2,ep->dest.prev_hash),ep->dest.prev_vout); bp->recvmask |= (1LL << myind); bp->notaries[myind].othermask |= (1LL << myind); dp->checkpoint = checkpoint; From 0908bca5c1feb249e6c0ca275bbea27356ad9623 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Tue, 18 Sep 2018 01:00:07 +0800 Subject: [PATCH 046/167] remove nosplit all together :d SPEED! --- iguana/dpow/dpow_fsm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/iguana/dpow/dpow_fsm.c b/iguana/dpow/dpow_fsm.c index 5db46e9e4..c2383db7f 100755 --- a/iguana/dpow/dpow_fsm.c +++ b/iguana/dpow/dpow_fsm.c @@ -467,14 +467,14 @@ void dpow_statemachinestart(void *ptr) } else { - if ( dpow_checkutxo(myinfo,dp,bp,bp->destcoin,&ep->dest.prev_hash,&ep->dest.prev_vout,destaddr,src->symbol) < 0 ) + if ( dpow_haveutxo(myinfo,bp->destcoin,&ep->dest.prev_hash,&ep->dest.prev_vout,destaddr,src->symbol) < 0 ) { printf("dont have %s %s utxo, please send funds\n",dp->dest,destaddr); dp->ratifying -= bp->isratify; free(ptr); return; } - if ( dpow_checkutxo(myinfo,dp,bp,bp->srccoin,&ep->src.prev_hash,&ep->src.prev_vout,srcaddr,"") < 0 ) + if ( dpow_haveutxo(myinfo,bp->srccoin,&ep->src.prev_hash,&ep->src.prev_vout,srcaddr,"") < 0 ) { printf("dont have %s %s utxo, please send funds\n",dp->symbol,srcaddr); dp->ratifying -= bp->isratify; From 5ed5086c94b67764530e2799cec286415c73a43b Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Tue, 18 Sep 2018 02:35:23 +0800 Subject: [PATCH 047/167] will this work -- I bet not --- iguana/dpow/dpow_fsm.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/iguana/dpow/dpow_fsm.c b/iguana/dpow/dpow_fsm.c index c2383db7f..d349d1bc1 100755 --- a/iguana/dpow/dpow_fsm.c +++ b/iguana/dpow/dpow_fsm.c @@ -265,6 +265,7 @@ void dpow_statemachinestart(void *ptr) void **ptrs = ptr; struct supernet_info *myinfo; struct dpow_info *dp; struct dpow_checkpoint checkpoint; int32_t i,j,ht,extralen,destprevvout0,srcprevvout0,src_or_dest,numratified=0,kmdheight,myind = -1; uint8_t extras[10000],pubkeys[64][33]; cJSON *ratified=0,*item; struct iguana_info *src,*dest; char *jsonstr,*handle,*hexstr,str[65],str2[65],srcaddr[64],destaddr[64]; bits256 zero,MoM,merkleroot,srchash,destprevtxid0,srcprevtxid0; struct dpow_block *bp; struct dpow_entry *ep = 0; uint32_t MoMdepth,duration,minsigs,starttime,srctime; + char *destlockunspent *srclockunspent; memset(&zero,0,sizeof(zero)); MoM = zero; srcprevtxid0 = destprevtxid0 = zero; @@ -501,7 +502,21 @@ void dpow_statemachinestart(void *ptr) bp->desttxid = bp->notaries[myind].src.prev_hash; dpow_signedtxgen(myinfo,dp,src,bp,bp->myind,1LL<myind,bp->myind,DPOW_SIGCHANNEL,0,0); }*/ - printf("Use srcutxo.(%s) vout.(%d) destutxo.(%s) vout.(%d)\n",bits256_str(str,ep->src.prev_hash),ep->src.prev_vout,bits256_str(str2,ep->dest.prev_hash),ep->dest.prev_vout); + + //printf("Use srcutxo.(%s) vout.(%d) destutxo.(%s) vout.(%d)\n",bits256_str(str,ep->src.prev_hash),ep->src.prev_vout,bits256_str(str2,ep->dest.prev_hash),ep->dest.prev_vout); + + // lock the dest coun selected utxo + destlockunspent = dpow_lockunspent(myinfo,bp->destcoin,destaddr,ep->dest.prev_hash,ep->dest.prev_vout); + if (strncmp(destlockunspent,"true", 4) == 0 ) + print(">>>>LOCKED DEST UTXO.(%s) vout.(%d)",bits256_str(str2,ep->dest.prev_hash),ep->dest.prev_vout); + free(destlockunspent); + + // lock the src selected utxo + srclockunspent = dpow_lockunspent(myinfo,bp->srccoin,srcaddr,ep->src.prev_hash,ep->src.prev_vout); + if (strncmp(srclockunspent,"true", 4) == 0 ) + print(">>>>LOCKED SRC UTXO.(%s) vout.(%d)",bits256_str(str2,ep->src.prev_hash),ep->src.prev_vout); + free(srclockunspent); + bp->recvmask |= (1LL << myind); bp->notaries[myind].othermask |= (1LL << myind); dp->checkpoint = checkpoint; From 157efa9c638ddd70dc8801ad4775760d300f38e8 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Tue, 18 Sep 2018 02:41:02 +0800 Subject: [PATCH 048/167] yep :D --- iguana/dpow/dpow_fsm.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/iguana/dpow/dpow_fsm.c b/iguana/dpow/dpow_fsm.c index d349d1bc1..aff45f7ec 100755 --- a/iguana/dpow/dpow_fsm.c +++ b/iguana/dpow/dpow_fsm.c @@ -265,7 +265,7 @@ void dpow_statemachinestart(void *ptr) void **ptrs = ptr; struct supernet_info *myinfo; struct dpow_info *dp; struct dpow_checkpoint checkpoint; int32_t i,j,ht,extralen,destprevvout0,srcprevvout0,src_or_dest,numratified=0,kmdheight,myind = -1; uint8_t extras[10000],pubkeys[64][33]; cJSON *ratified=0,*item; struct iguana_info *src,*dest; char *jsonstr,*handle,*hexstr,str[65],str2[65],srcaddr[64],destaddr[64]; bits256 zero,MoM,merkleroot,srchash,destprevtxid0,srcprevtxid0; struct dpow_block *bp; struct dpow_entry *ep = 0; uint32_t MoMdepth,duration,minsigs,starttime,srctime; - char *destlockunspent *srclockunspent; + char *destlockunspent,*srclockunspent; memset(&zero,0,sizeof(zero)); MoM = zero; srcprevtxid0 = destprevtxid0 = zero; @@ -506,15 +506,15 @@ void dpow_statemachinestart(void *ptr) //printf("Use srcutxo.(%s) vout.(%d) destutxo.(%s) vout.(%d)\n",bits256_str(str,ep->src.prev_hash),ep->src.prev_vout,bits256_str(str2,ep->dest.prev_hash),ep->dest.prev_vout); // lock the dest coun selected utxo - destlockunspent = dpow_lockunspent(myinfo,bp->destcoin,destaddr,ep->dest.prev_hash,ep->dest.prev_vout); + destlockunspent = dpow_lockunspent(myinfo,bp->destcoin,destaddr,bits256_str(str2,ep->dest.prev_hash),ep->dest.prev_vout); if (strncmp(destlockunspent,"true", 4) == 0 ) - print(">>>>LOCKED DEST UTXO.(%s) vout.(%d)",bits256_str(str2,ep->dest.prev_hash),ep->dest.prev_vout); + printf(">>>>LOCKED DEST UTXO.(%s) vout.(%d)",bits256_str(str2,ep->dest.prev_hash),ep->dest.prev_vout); free(destlockunspent); // lock the src selected utxo - srclockunspent = dpow_lockunspent(myinfo,bp->srccoin,srcaddr,ep->src.prev_hash,ep->src.prev_vout); + srclockunspent = dpow_lockunspent(myinfo,bp->srccoin,srcaddr,bits256_str(str2,ep->src.prev_hash),ep->src.prev_vout); if (strncmp(srclockunspent,"true", 4) == 0 ) - print(">>>>LOCKED SRC UTXO.(%s) vout.(%d)",bits256_str(str2,ep->src.prev_hash),ep->src.prev_vout); + printf(">>>>LOCKED SRC UTXO.(%s) vout.(%d)",bits256_str(str2,ep->src.prev_hash),ep->src.prev_vout); free(srclockunspent); bp->recvmask |= (1LL << myind); From 57060c7d50ad5a8d59191cefe2ec05d9aa7d00c3 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Tue, 18 Sep 2018 02:42:58 +0800 Subject: [PATCH 049/167] try this --- iguana/dpow/dpow_rpc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iguana/dpow/dpow_rpc.c b/iguana/dpow/dpow_rpc.c index 9f5ae3cf3..80a000ded 100755 --- a/iguana/dpow/dpow_rpc.c +++ b/iguana/dpow/dpow_rpc.c @@ -466,7 +466,7 @@ cJSON *dpow_gettxout(struct supernet_info *myinfo,struct iguana_info *coin,bits2 return(json); } -cJSON *dpow_lockunspent(struct supernet_info *myinfo,struct iguana_info *coin,char *coinaddr,char *txid,int32_t vout) +*dpow_lockunspent(struct supernet_info *myinfo,struct iguana_info *coin,char *coinaddr,char *txid,int32_t vout) { char buf[128],*retstr; cJSON *json = 0; if ( coin->FULLNODE < 0 ) From 50bd2ee7f9ea53f389491d1d5a21adf7663b4070 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Tue, 18 Sep 2018 02:48:05 +0800 Subject: [PATCH 050/167] change it all to a string. --- iguana/dpow/dpow_rpc.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/iguana/dpow/dpow_rpc.c b/iguana/dpow/dpow_rpc.c index 80a000ded..76e919c06 100755 --- a/iguana/dpow/dpow_rpc.c +++ b/iguana/dpow/dpow_rpc.c @@ -468,16 +468,14 @@ cJSON *dpow_gettxout(struct supernet_info *myinfo,struct iguana_info *coin,bits2 *dpow_lockunspent(struct supernet_info *myinfo,struct iguana_info *coin,char *coinaddr,char *txid,int32_t vout) { - char buf[128],*retstr; cJSON *json = 0; + char buf[128],*retstr; if ( coin->FULLNODE < 0 ) { sprintf(buf,"false, [{\"txid\":\"%s\",\"vout\":%d}]", txid, vout); if ( (retstr= bitcoind_passthru(coin->symbol,coin->chain->serverport,coin->chain->userpass,"lockunspent",buf)) != 0 ) { printf("RESULT.(%s)\n",retstr); - json = cJSON_Parse(retstr); - free(retstr); - return(json); + return(retstr); } else printf("%s null retstr from (%s)n",coin->symbol,buf); } return(0); From a6001538fde9dffd970a0668e5c7d1fae5390abe Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Tue, 18 Sep 2018 02:52:59 +0800 Subject: [PATCH 051/167] char --- iguana/dpow/dpow_rpc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iguana/dpow/dpow_rpc.c b/iguana/dpow/dpow_rpc.c index 76e919c06..bae736a65 100755 --- a/iguana/dpow/dpow_rpc.c +++ b/iguana/dpow/dpow_rpc.c @@ -466,7 +466,7 @@ cJSON *dpow_gettxout(struct supernet_info *myinfo,struct iguana_info *coin,bits2 return(json); } -*dpow_lockunspent(struct supernet_info *myinfo,struct iguana_info *coin,char *coinaddr,char *txid,int32_t vout) +char *dpow_lockunspent(struct supernet_info *myinfo,struct iguana_info *coin,char *coinaddr,char *txid,int32_t vout) { char buf[128],*retstr; if ( coin->FULLNODE < 0 ) From 18ad76773b7e69d2e4114a7c9cae166199878ea3 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Tue, 18 Sep 2018 11:15:16 +0800 Subject: [PATCH 052/167] Try to only lock KMD utxo's and unlock them when we are finished --- iguana/dpow/dpow_fsm.c | 49 ++++++++++++++++++++++++++++++++---------- iguana/dpow/dpow_rpc.c | 15 +++++++++++++ 2 files changed, 53 insertions(+), 11 deletions(-) diff --git a/iguana/dpow/dpow_fsm.c b/iguana/dpow/dpow_fsm.c index aff45f7ec..f074e355f 100755 --- a/iguana/dpow/dpow_fsm.c +++ b/iguana/dpow/dpow_fsm.c @@ -505,17 +505,27 @@ void dpow_statemachinestart(void *ptr) //printf("Use srcutxo.(%s) vout.(%d) destutxo.(%s) vout.(%d)\n",bits256_str(str,ep->src.prev_hash),ep->src.prev_vout,bits256_str(str2,ep->dest.prev_hash),ep->dest.prev_vout); - // lock the dest coun selected utxo - destlockunspent = dpow_lockunspent(myinfo,bp->destcoin,destaddr,bits256_str(str2,ep->dest.prev_hash),ep->dest.prev_vout); - if (strncmp(destlockunspent,"true", 4) == 0 ) - printf(">>>>LOCKED DEST UTXO.(%s) vout.(%d)",bits256_str(str2,ep->dest.prev_hash),ep->dest.prev_vout); - free(destlockunspent); + if (strcmp("KMD",dest->symbol) == 0 ) + { + // lock the dest coin selected utxo + destlockunspent = dpow_lockunspent(myinfo,bp->destcoin,destaddr,bits256_str(str2,ep->dest.prev_hash),ep->dest.prev_vout); + if (strncmp(destlockunspent,"true", 4) == 0 ) + { + printf(">>>> LOCKED %s UTXO.(%s) vout.(%d)",dest->symbol,bits256_str(str2,ep->dest.prev_hash),ep->dest.prev_vout); + //free(destlockunspent); + } else printf("<<<< FAILED TO LOCK %s UTXO.(%s) vout.(%d)",dest->symbol,bits256_str(str2,ep->dest.prev_hash),ep->dest.prev_vout); + } - // lock the src selected utxo - srclockunspent = dpow_lockunspent(myinfo,bp->srccoin,srcaddr,bits256_str(str2,ep->src.prev_hash),ep->src.prev_vout); - if (strncmp(srclockunspent,"true", 4) == 0 ) - printf(">>>>LOCKED SRC UTXO.(%s) vout.(%d)",bits256_str(str2,ep->src.prev_hash),ep->src.prev_vout); - free(srclockunspent); + if ( strcmp("BTC",dest->symbol) == 0 ) + { + // lock the src coin selected utxo + srclockunspent = dpow_lockunspent(myinfo,bp->srccoin,srcaddr,bits256_str(str2,ep->src.prev_hash),ep->src.prev_vout); + if (strncmp(srclockunspent,"true", 4) == 0 ) + { + printf(">>>> LOCKED %s UTXO.(%s) vout.(%d)",src->symbol,bits256_str(str2,ep->src.prev_hash),ep->src.prev_vout); + //free(srclockunspent); + } else printf("<<<< FAILED TO LOCK %s UTXO.(%s) vout.(%d)",src->symbol,bits256_str(str2,ep->src.prev_hash),ep->src.prev_vout); + } bp->recvmask |= (1LL << myind); bp->notaries[myind].othermask |= (1LL << myind); @@ -610,7 +620,24 @@ void dpow_statemachinestart(void *ptr) printf("[%d] END isratify.%d:%d bestk.%d %llx sigs.%llx state.%x machine ht.%d completed state.%x %s.%s %s.%s recvmask.%llx paxwdcrc.%x %p %p\n",Numallocated,bp->isratify,dp->ratifying,bp->bestk,(long long)bp->bestmask,(long long)(bp->bestk>=0?bp->destsigsmasks[bp->bestk]:0),bp->state,bp->height,bp->state,dp->dest,bits256_str(str,bp->desttxid),dp->symbol,bits256_str(str2,bp->srctxid),(long long)bp->recvmask,bp->paxwdcrc,src,dest); dp->lastrecvmask = bp->recvmask; dp->ratifying -= bp->isratify; - // call unlock unspent here + + // unlock the dest utxo if it was locked. + if (strncmp(destlockunspent,"true",4) == 0) + { + destlockunspent = dpow_unlockunspent(myinfo,bp->destcoin,destaddr,bits256_str(str2,ep->dest.prev_hash),ep->dest.prev_vout); + if (strncmp(destlockunspent,"true", 4) == 0 ) + printf(">>>>UNLOCKED %s UTXO.(%s) vout.(%d)",dest->symbol,bits256_str(str2,ep->dest.prev_hash),ep->dest.prev_vout); + } + + // unlock the src selected utxo, if it was locked + if (strncmp(srclockunspent,"true",4) == 0) + { + srclockunspent = dpow_unlockunspent(myinfo,bp->srccoin,srcaddr,bits256_str(str2,ep->src.prev_hash),ep->src.prev_vout); + if (strncmp(srclockunspent,"true", 4) == 0 ) + printf(">>>>UNLOCKED %s UTXO.(%s) vout.(%d)",src->symbol,bits256_str(str2,ep->src.prev_hash),ep->src.prev_vout); + } + free(destlockunspent); + free(srclockunspent); // dp->blocks[bp->height] = 0; bp->state = 0xffffffff; free(ptr); diff --git a/iguana/dpow/dpow_rpc.c b/iguana/dpow/dpow_rpc.c index bae736a65..fd106b4f8 100755 --- a/iguana/dpow/dpow_rpc.c +++ b/iguana/dpow/dpow_rpc.c @@ -481,6 +481,21 @@ char *dpow_lockunspent(struct supernet_info *myinfo,struct iguana_info *coin,cha return(0); } +char *dpow_unlockunspent(struct supernet_info *myinfo,struct iguana_info *coin,char *coinaddr,char *txid,int32_t vout) +{ + char buf[128],*retstr; + if ( coin->FULLNODE < 0 ) + { + sprintf(buf,"true, [{\"txid\":\"%s\",\"vout\":%d}]", txid, vout); + if ( (retstr= bitcoind_passthru(coin->symbol,coin->chain->serverport,coin->chain->userpass,"lockunspent",buf)) != 0 ) + { + printf("RESULT.(%s)\n",retstr); + return(retstr); + } else printf("%s null retstr from (%s)n",coin->symbol,buf); + } + return(0); +} + char *dpow_decoderawtransaction(struct supernet_info *myinfo,struct iguana_info *coin,char *rawtx) { char *retstr,*paramstr; cJSON *array; From 91b465648c918b24baf196e72b58ec7c8110e2ec Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Tue, 18 Sep 2018 11:17:06 +0800 Subject: [PATCH 053/167] fix print format --- iguana/dpow/dpow_fsm.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/iguana/dpow/dpow_fsm.c b/iguana/dpow/dpow_fsm.c index f074e355f..c8a556b29 100755 --- a/iguana/dpow/dpow_fsm.c +++ b/iguana/dpow/dpow_fsm.c @@ -511,9 +511,9 @@ void dpow_statemachinestart(void *ptr) destlockunspent = dpow_lockunspent(myinfo,bp->destcoin,destaddr,bits256_str(str2,ep->dest.prev_hash),ep->dest.prev_vout); if (strncmp(destlockunspent,"true", 4) == 0 ) { - printf(">>>> LOCKED %s UTXO.(%s) vout.(%d)",dest->symbol,bits256_str(str2,ep->dest.prev_hash),ep->dest.prev_vout); + printf(">>>> LOCKED %s UTXO.(%s) vout.(%d)\n",dest->symbol,bits256_str(str2,ep->dest.prev_hash),ep->dest.prev_vout); //free(destlockunspent); - } else printf("<<<< FAILED TO LOCK %s UTXO.(%s) vout.(%d)",dest->symbol,bits256_str(str2,ep->dest.prev_hash),ep->dest.prev_vout); + } else printf("<<<< FAILED TO LOCK %s UTXO.(%s) vout.(%d)\n",dest->symbol,bits256_str(str2,ep->dest.prev_hash),ep->dest.prev_vout); } if ( strcmp("BTC",dest->symbol) == 0 ) @@ -522,9 +522,9 @@ void dpow_statemachinestart(void *ptr) srclockunspent = dpow_lockunspent(myinfo,bp->srccoin,srcaddr,bits256_str(str2,ep->src.prev_hash),ep->src.prev_vout); if (strncmp(srclockunspent,"true", 4) == 0 ) { - printf(">>>> LOCKED %s UTXO.(%s) vout.(%d)",src->symbol,bits256_str(str2,ep->src.prev_hash),ep->src.prev_vout); + printf(">>>> LOCKED %s UTXO.(%s) vout.(%d\n",src->symbol,bits256_str(str2,ep->src.prev_hash),ep->src.prev_vout); //free(srclockunspent); - } else printf("<<<< FAILED TO LOCK %s UTXO.(%s) vout.(%d)",src->symbol,bits256_str(str2,ep->src.prev_hash),ep->src.prev_vout); + } else printf("<<<< FAILED TO LOCK %s UTXO.(%s) vout.(%d)\n",src->symbol,bits256_str(str2,ep->src.prev_hash),ep->src.prev_vout); } bp->recvmask |= (1LL << myind); @@ -626,7 +626,7 @@ void dpow_statemachinestart(void *ptr) { destlockunspent = dpow_unlockunspent(myinfo,bp->destcoin,destaddr,bits256_str(str2,ep->dest.prev_hash),ep->dest.prev_vout); if (strncmp(destlockunspent,"true", 4) == 0 ) - printf(">>>>UNLOCKED %s UTXO.(%s) vout.(%d)",dest->symbol,bits256_str(str2,ep->dest.prev_hash),ep->dest.prev_vout); + printf(">>>>UNLOCKED %s UTXO.(%s) vout.(%d)\n",dest->symbol,bits256_str(str2,ep->dest.prev_hash),ep->dest.prev_vout); } // unlock the src selected utxo, if it was locked @@ -634,7 +634,7 @@ void dpow_statemachinestart(void *ptr) { srclockunspent = dpow_unlockunspent(myinfo,bp->srccoin,srcaddr,bits256_str(str2,ep->src.prev_hash),ep->src.prev_vout); if (strncmp(srclockunspent,"true", 4) == 0 ) - printf(">>>>UNLOCKED %s UTXO.(%s) vout.(%d)",src->symbol,bits256_str(str2,ep->src.prev_hash),ep->src.prev_vout); + printf(">>>>UNLOCKED %s UTXO.(%s) vout.(%d)\n",src->symbol,bits256_str(str2,ep->src.prev_hash),ep->src.prev_vout); } free(destlockunspent); free(srclockunspent); From 9334e97438c4291dafe2b185d1187ff5af7a46b9 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Tue, 18 Sep 2018 11:22:28 +0800 Subject: [PATCH 054/167] fix invaild pointer --- iguana/dpow/dpow_fsm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/iguana/dpow/dpow_fsm.c b/iguana/dpow/dpow_fsm.c index c8a556b29..2183ff3d4 100755 --- a/iguana/dpow/dpow_fsm.c +++ b/iguana/dpow/dpow_fsm.c @@ -627,6 +627,7 @@ void dpow_statemachinestart(void *ptr) destlockunspent = dpow_unlockunspent(myinfo,bp->destcoin,destaddr,bits256_str(str2,ep->dest.prev_hash),ep->dest.prev_vout); if (strncmp(destlockunspent,"true", 4) == 0 ) printf(">>>>UNLOCKED %s UTXO.(%s) vout.(%d)\n",dest->symbol,bits256_str(str2,ep->dest.prev_hash),ep->dest.prev_vout); + free(destlockunspent); } // unlock the src selected utxo, if it was locked @@ -635,9 +636,8 @@ void dpow_statemachinestart(void *ptr) srclockunspent = dpow_unlockunspent(myinfo,bp->srccoin,srcaddr,bits256_str(str2,ep->src.prev_hash),ep->src.prev_vout); if (strncmp(srclockunspent,"true", 4) == 0 ) printf(">>>>UNLOCKED %s UTXO.(%s) vout.(%d)\n",src->symbol,bits256_str(str2,ep->src.prev_hash),ep->src.prev_vout); + free(srclockunspent); } - free(destlockunspent); - free(srclockunspent); // dp->blocks[bp->height] = 0; bp->state = 0xffffffff; free(ptr); From 01b3b3e86e85d6a28721835c10802653f5205742 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Tue, 18 Sep 2018 16:31:22 +0800 Subject: [PATCH 055/167] fix possible memleak. Thanks Decker! --- iguana/dpow/dpow_fsm.c | 46 ++++++++++++++++++------------------------ 1 file changed, 20 insertions(+), 26 deletions(-) diff --git a/iguana/dpow/dpow_fsm.c b/iguana/dpow/dpow_fsm.c index 2183ff3d4..e8a519d86 100755 --- a/iguana/dpow/dpow_fsm.c +++ b/iguana/dpow/dpow_fsm.c @@ -265,7 +265,7 @@ void dpow_statemachinestart(void *ptr) void **ptrs = ptr; struct supernet_info *myinfo; struct dpow_info *dp; struct dpow_checkpoint checkpoint; int32_t i,j,ht,extralen,destprevvout0,srcprevvout0,src_or_dest,numratified=0,kmdheight,myind = -1; uint8_t extras[10000],pubkeys[64][33]; cJSON *ratified=0,*item; struct iguana_info *src,*dest; char *jsonstr,*handle,*hexstr,str[65],str2[65],srcaddr[64],destaddr[64]; bits256 zero,MoM,merkleroot,srchash,destprevtxid0,srcprevtxid0; struct dpow_block *bp; struct dpow_entry *ep = 0; uint32_t MoMdepth,duration,minsigs,starttime,srctime; - char *destlockunspent,*srclockunspent; + char *destlockunspent,*srclockunspent,*destunlockunspent,*srcunlockunspent; memset(&zero,0,sizeof(zero)); MoM = zero; srcprevtxid0 = destprevtxid0 = zero; @@ -507,26 +507,25 @@ void dpow_statemachinestart(void *ptr) if (strcmp("KMD",dest->symbol) == 0 ) { - // lock the dest coin selected utxo + // lock the dest utxo if destination coin is KMD.s destlockunspent = dpow_lockunspent(myinfo,bp->destcoin,destaddr,bits256_str(str2,ep->dest.prev_hash),ep->dest.prev_vout); if (strncmp(destlockunspent,"true", 4) == 0 ) - { printf(">>>> LOCKED %s UTXO.(%s) vout.(%d)\n",dest->symbol,bits256_str(str2,ep->dest.prev_hash),ep->dest.prev_vout); - //free(destlockunspent); - } else printf("<<<< FAILED TO LOCK %s UTXO.(%s) vout.(%d)\n",dest->symbol,bits256_str(str2,ep->dest.prev_hash),ep->dest.prev_vout); + else + printf("<<<< FAILED TO LOCK %s UTXO.(%s) vout.(%d)\n",dest->symbol,bits256_str(str2,ep->dest.prev_hash),ep->dest.prev_vout); } if ( strcmp("BTC",dest->symbol) == 0 ) { - // lock the src coin selected utxo + // lock the src coin selected utxo if the source coin is KMD. srclockunspent = dpow_lockunspent(myinfo,bp->srccoin,srcaddr,bits256_str(str2,ep->src.prev_hash),ep->src.prev_vout); if (strncmp(srclockunspent,"true", 4) == 0 ) - { printf(">>>> LOCKED %s UTXO.(%s) vout.(%d\n",src->symbol,bits256_str(str2,ep->src.prev_hash),ep->src.prev_vout); - //free(srclockunspent); - } else printf("<<<< FAILED TO LOCK %s UTXO.(%s) vout.(%d)\n",src->symbol,bits256_str(str2,ep->src.prev_hash),ep->src.prev_vout); + else + printf("<<<< FAILED TO LOCK %s UTXO.(%s) vout.(%d)\n",src->symbol,bits256_str(str2,ep->src.prev_hash),ep->src.prev_vout); } - + free(destlockunspent); + free(srclockunspent); bp->recvmask |= (1LL << myind); bp->notaries[myind].othermask |= (1LL << myind); dp->checkpoint = checkpoint; @@ -621,23 +620,18 @@ void dpow_statemachinestart(void *ptr) dp->lastrecvmask = bp->recvmask; dp->ratifying -= bp->isratify; - // unlock the dest utxo if it was locked. - if (strncmp(destlockunspent,"true",4) == 0) - { - destlockunspent = dpow_unlockunspent(myinfo,bp->destcoin,destaddr,bits256_str(str2,ep->dest.prev_hash),ep->dest.prev_vout); - if (strncmp(destlockunspent,"true", 4) == 0 ) - printf(">>>>UNLOCKED %s UTXO.(%s) vout.(%d)\n",dest->symbol,bits256_str(str2,ep->dest.prev_hash),ep->dest.prev_vout); - free(destlockunspent); - } + // unlock the dest utxo regardless if it was locked or not it does not matter. + destunlockunspent = dpow_unlockunspent(myinfo,bp->destcoin,destaddr,bits256_str(str2,ep->dest.prev_hash),ep->dest.prev_vout); + if (strncmp(destunlockunspent,"true", 4) == 0 ) + printf(">>>>UNLOCKED %s UTXO.(%s) vout.(%d)\n",dest->symbol,bits256_str(str2,ep->dest.prev_hash),ep->dest.prev_vout); + free(destunlockunspent); + + // unlock the src selected utxo, if it was locked or not it does not matter. + srcunlockunspent = dpow_unlockunspent(myinfo,bp->srccoin,srcaddr,bits256_str(str2,ep->src.prev_hash),ep->src.prev_vout); + if (strncmp(srcunlockunspent,"true", 4) == 0 ) + printf(">>>>UNLOCKED %s UTXO.(%s) vout.(%d)\n",src->symbol,bits256_str(str2,ep->src.prev_hash),ep->src.prev_vout); + free(srcunlockunspent); - // unlock the src selected utxo, if it was locked - if (strncmp(srclockunspent,"true",4) == 0) - { - srclockunspent = dpow_unlockunspent(myinfo,bp->srccoin,srcaddr,bits256_str(str2,ep->src.prev_hash),ep->src.prev_vout); - if (strncmp(srclockunspent,"true", 4) == 0 ) - printf(">>>>UNLOCKED %s UTXO.(%s) vout.(%d)\n",src->symbol,bits256_str(str2,ep->src.prev_hash),ep->src.prev_vout); - free(srclockunspent); - } // dp->blocks[bp->height] = 0; bp->state = 0xffffffff; free(ptr); From 5c817a30e6bf081b586993845c6fd1af04d7df65 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Tue, 18 Sep 2018 16:50:58 +0800 Subject: [PATCH 056/167] fix pointer --- iguana/dpow/dpow_fsm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/iguana/dpow/dpow_fsm.c b/iguana/dpow/dpow_fsm.c index e8a519d86..a334bb62d 100755 --- a/iguana/dpow/dpow_fsm.c +++ b/iguana/dpow/dpow_fsm.c @@ -513,6 +513,7 @@ void dpow_statemachinestart(void *ptr) printf(">>>> LOCKED %s UTXO.(%s) vout.(%d)\n",dest->symbol,bits256_str(str2,ep->dest.prev_hash),ep->dest.prev_vout); else printf("<<<< FAILED TO LOCK %s UTXO.(%s) vout.(%d)\n",dest->symbol,bits256_str(str2,ep->dest.prev_hash),ep->dest.prev_vout); + free(destlockunspent); } if ( strcmp("BTC",dest->symbol) == 0 ) @@ -523,9 +524,8 @@ void dpow_statemachinestart(void *ptr) printf(">>>> LOCKED %s UTXO.(%s) vout.(%d\n",src->symbol,bits256_str(str2,ep->src.prev_hash),ep->src.prev_vout); else printf("<<<< FAILED TO LOCK %s UTXO.(%s) vout.(%d)\n",src->symbol,bits256_str(str2,ep->src.prev_hash),ep->src.prev_vout); + free(srclockunspent); } - free(destlockunspent); - free(srclockunspent); bp->recvmask |= (1LL << myind); bp->notaries[myind].othermask |= (1LL << myind); dp->checkpoint = checkpoint; From aa4f168facb6761762ffb374c706ba02d04785ca Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Tue, 18 Sep 2018 17:07:30 +0800 Subject: [PATCH 057/167] remove pointless print --- iguana/dpow/dpow_rpc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/iguana/dpow/dpow_rpc.c b/iguana/dpow/dpow_rpc.c index fd106b4f8..d7dc35014 100755 --- a/iguana/dpow/dpow_rpc.c +++ b/iguana/dpow/dpow_rpc.c @@ -474,7 +474,7 @@ char *dpow_lockunspent(struct supernet_info *myinfo,struct iguana_info *coin,cha sprintf(buf,"false, [{\"txid\":\"%s\",\"vout\":%d}]", txid, vout); if ( (retstr= bitcoind_passthru(coin->symbol,coin->chain->serverport,coin->chain->userpass,"lockunspent",buf)) != 0 ) { - printf("RESULT.(%s)\n",retstr); + //printf("RESULT.(%s)\n",retstr); return(retstr); } else printf("%s null retstr from (%s)n",coin->symbol,buf); } @@ -489,7 +489,7 @@ char *dpow_unlockunspent(struct supernet_info *myinfo,struct iguana_info *coin,c sprintf(buf,"true, [{\"txid\":\"%s\",\"vout\":%d}]", txid, vout); if ( (retstr= bitcoind_passthru(coin->symbol,coin->chain->serverport,coin->chain->userpass,"lockunspent",buf)) != 0 ) { - printf("RESULT.(%s)\n",retstr); + //printf("RESULT.(%s)\n",retstr); return(retstr); } else printf("%s null retstr from (%s)n",coin->symbol,buf); } From 34d7b057fe431d00851348e685de2f6b994604ff Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Tue, 18 Sep 2018 18:48:27 +0800 Subject: [PATCH 058/167] only lock and unlock KMD utxos. --- iguana/dpow/dpow_fsm.c | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/iguana/dpow/dpow_fsm.c b/iguana/dpow/dpow_fsm.c index a334bb62d..eefcddc0d 100755 --- a/iguana/dpow/dpow_fsm.c +++ b/iguana/dpow/dpow_fsm.c @@ -619,18 +619,24 @@ void dpow_statemachinestart(void *ptr) printf("[%d] END isratify.%d:%d bestk.%d %llx sigs.%llx state.%x machine ht.%d completed state.%x %s.%s %s.%s recvmask.%llx paxwdcrc.%x %p %p\n",Numallocated,bp->isratify,dp->ratifying,bp->bestk,(long long)bp->bestmask,(long long)(bp->bestk>=0?bp->destsigsmasks[bp->bestk]:0),bp->state,bp->height,bp->state,dp->dest,bits256_str(str,bp->desttxid),dp->symbol,bits256_str(str2,bp->srctxid),(long long)bp->recvmask,bp->paxwdcrc,src,dest); dp->lastrecvmask = bp->recvmask; dp->ratifying -= bp->isratify; + + // unlock the dest utxo on KMD. + if (strcmp("KMD",dest->symbol) == 0 ) + { + destunlockunspent = dpow_unlockunspent(myinfo,bp->destcoin,destaddr,bits256_str(str2,ep->dest.prev_hash),ep->dest.prev_vout); + if (strncmp(destunlockunspent,"true", 4) == 0 ) + printf(">>>>UNLOCKED %s UTXO.(%s) vout.(%d)\n",dest->symbol,bits256_str(str2,ep->dest.prev_hash),ep->dest.prev_vout); + free(destunlockunspent); + } - // unlock the dest utxo regardless if it was locked or not it does not matter. - destunlockunspent = dpow_unlockunspent(myinfo,bp->destcoin,destaddr,bits256_str(str2,ep->dest.prev_hash),ep->dest.prev_vout); - if (strncmp(destunlockunspent,"true", 4) == 0 ) - printf(">>>>UNLOCKED %s UTXO.(%s) vout.(%d)\n",dest->symbol,bits256_str(str2,ep->dest.prev_hash),ep->dest.prev_vout); - free(destunlockunspent); - - // unlock the src selected utxo, if it was locked or not it does not matter. - srcunlockunspent = dpow_unlockunspent(myinfo,bp->srccoin,srcaddr,bits256_str(str2,ep->src.prev_hash),ep->src.prev_vout); - if (strncmp(srcunlockunspent,"true", 4) == 0 ) - printf(">>>>UNLOCKED %s UTXO.(%s) vout.(%d)\n",src->symbol,bits256_str(str2,ep->src.prev_hash),ep->src.prev_vout); - free(srcunlockunspent); + // unlock the src selected utxo on KMD, as those are the only ones we LOCK, and CHIPS does not like the lockunspent call. + if ( strcmp("BTC",dest->symbol) == 0 ) + { + srcunlockunspent = dpow_unlockunspent(myinfo,bp->srccoin,srcaddr,bits256_str(str2,ep->src.prev_hash),ep->src.prev_vout); + if (strncmp(srcunlockunspent,"true", 4) == 0 ) + printf(">>>>UNLOCKED %s UTXO.(%s) vout.(%d)\n",src->symbol,bits256_str(str2,ep->src.prev_hash),ep->src.prev_vout); + free(srcunlockunspent); + } // dp->blocks[bp->height] = 0; bp->state = 0xffffffff; From 5cec066a2605e334eb6f9a4e937b38b6fca4f0cf Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Tue, 9 Oct 2018 12:53:15 +0800 Subject: [PATCH 059/167] make changes to normal branch to fix crash --- iguana/dpow/dpow_fsm.c | 18 +++++++++--------- iguana/dpow/dpow_rpc.c | 4 ++-- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/iguana/dpow/dpow_fsm.c b/iguana/dpow/dpow_fsm.c index eefcddc0d..12b97d765 100755 --- a/iguana/dpow/dpow_fsm.c +++ b/iguana/dpow/dpow_fsm.c @@ -505,22 +505,22 @@ void dpow_statemachinestart(void *ptr) //printf("Use srcutxo.(%s) vout.(%d) destutxo.(%s) vout.(%d)\n",bits256_str(str,ep->src.prev_hash),ep->src.prev_vout,bits256_str(str2,ep->dest.prev_hash),ep->dest.prev_vout); - if (strcmp("KMD",dest->symbol) == 0 ) + if ( (strcmp("KMD",dest->symbol) == 0 ) && (ep->dest.prev_vout != -1) ) { // lock the dest utxo if destination coin is KMD.s destlockunspent = dpow_lockunspent(myinfo,bp->destcoin,destaddr,bits256_str(str2,ep->dest.prev_hash),ep->dest.prev_vout); - if (strncmp(destlockunspent,"true", 4) == 0 ) + if (strcmp(destlockunspent,"true") == 0 ) printf(">>>> LOCKED %s UTXO.(%s) vout.(%d)\n",dest->symbol,bits256_str(str2,ep->dest.prev_hash),ep->dest.prev_vout); else printf("<<<< FAILED TO LOCK %s UTXO.(%s) vout.(%d)\n",dest->symbol,bits256_str(str2,ep->dest.prev_hash),ep->dest.prev_vout); free(destlockunspent); } - if ( strcmp("BTC",dest->symbol) == 0 ) + if ( ( strcmp("KMD",src->symbol) == 0 ) && (ep->src.prev_vout != -1) ) { // lock the src coin selected utxo if the source coin is KMD. srclockunspent = dpow_lockunspent(myinfo,bp->srccoin,srcaddr,bits256_str(str2,ep->src.prev_hash),ep->src.prev_vout); - if (strncmp(srclockunspent,"true", 4) == 0 ) + if (strcmp(srclockunspent,"true") == 0 ) printf(">>>> LOCKED %s UTXO.(%s) vout.(%d\n",src->symbol,bits256_str(str2,ep->src.prev_hash),ep->src.prev_vout); else printf("<<<< FAILED TO LOCK %s UTXO.(%s) vout.(%d)\n",src->symbol,bits256_str(str2,ep->src.prev_hash),ep->src.prev_vout); @@ -619,21 +619,21 @@ void dpow_statemachinestart(void *ptr) printf("[%d] END isratify.%d:%d bestk.%d %llx sigs.%llx state.%x machine ht.%d completed state.%x %s.%s %s.%s recvmask.%llx paxwdcrc.%x %p %p\n",Numallocated,bp->isratify,dp->ratifying,bp->bestk,(long long)bp->bestmask,(long long)(bp->bestk>=0?bp->destsigsmasks[bp->bestk]:0),bp->state,bp->height,bp->state,dp->dest,bits256_str(str,bp->desttxid),dp->symbol,bits256_str(str2,bp->srctxid),(long long)bp->recvmask,bp->paxwdcrc,src,dest); dp->lastrecvmask = bp->recvmask; dp->ratifying -= bp->isratify; - + // unlock the dest utxo on KMD. - if (strcmp("KMD",dest->symbol) == 0 ) + if ( (strcmp("KMD",dest->symbol) == 0 ) && (ep->dest.prev_vout != -1) ) { destunlockunspent = dpow_unlockunspent(myinfo,bp->destcoin,destaddr,bits256_str(str2,ep->dest.prev_hash),ep->dest.prev_vout); - if (strncmp(destunlockunspent,"true", 4) == 0 ) + if (strcmp(destunlockunspent,"true") == 0 ) printf(">>>>UNLOCKED %s UTXO.(%s) vout.(%d)\n",dest->symbol,bits256_str(str2,ep->dest.prev_hash),ep->dest.prev_vout); free(destunlockunspent); } // unlock the src selected utxo on KMD, as those are the only ones we LOCK, and CHIPS does not like the lockunspent call. - if ( strcmp("BTC",dest->symbol) == 0 ) + if ( ( strcmp("KMD",src->symbol) == 0 ) && (ep->src.prev_vout != -1) ) { srcunlockunspent = dpow_unlockunspent(myinfo,bp->srccoin,srcaddr,bits256_str(str2,ep->src.prev_hash),ep->src.prev_vout); - if (strncmp(srcunlockunspent,"true", 4) == 0 ) + if (strcmp(srcunlockunspent,"true") == 0 ) printf(">>>>UNLOCKED %s UTXO.(%s) vout.(%d)\n",src->symbol,bits256_str(str2,ep->src.prev_hash),ep->src.prev_vout); free(srcunlockunspent); } diff --git a/iguana/dpow/dpow_rpc.c b/iguana/dpow/dpow_rpc.c index d7dc35014..6cdcf7e66 100755 --- a/iguana/dpow/dpow_rpc.c +++ b/iguana/dpow/dpow_rpc.c @@ -478,7 +478,7 @@ char *dpow_lockunspent(struct supernet_info *myinfo,struct iguana_info *coin,cha return(retstr); } else printf("%s null retstr from (%s)n",coin->symbol,buf); } - return(0); + return("false"); } char *dpow_unlockunspent(struct supernet_info *myinfo,struct iguana_info *coin,char *coinaddr,char *txid,int32_t vout) @@ -493,7 +493,7 @@ char *dpow_unlockunspent(struct supernet_info *myinfo,struct iguana_info *coin,c return(retstr); } else printf("%s null retstr from (%s)n",coin->symbol,buf); } - return(0); + return("false"); } char *dpow_decoderawtransaction(struct supernet_info *myinfo,struct iguana_info *coin,char *rawtx) From 26a9a47ccda5ddc9c32dd6f52f496b74fdf1f1e1 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Tue, 9 Oct 2018 13:03:49 +0800 Subject: [PATCH 060/167] try --- iguana/dpow/dpow_rpc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/iguana/dpow/dpow_rpc.c b/iguana/dpow/dpow_rpc.c index 6cdcf7e66..d7dc35014 100755 --- a/iguana/dpow/dpow_rpc.c +++ b/iguana/dpow/dpow_rpc.c @@ -478,7 +478,7 @@ char *dpow_lockunspent(struct supernet_info *myinfo,struct iguana_info *coin,cha return(retstr); } else printf("%s null retstr from (%s)n",coin->symbol,buf); } - return("false"); + return(0); } char *dpow_unlockunspent(struct supernet_info *myinfo,struct iguana_info *coin,char *coinaddr,char *txid,int32_t vout) @@ -493,7 +493,7 @@ char *dpow_unlockunspent(struct supernet_info *myinfo,struct iguana_info *coin,c return(retstr); } else printf("%s null retstr from (%s)n",coin->symbol,buf); } - return("false"); + return(0); } char *dpow_decoderawtransaction(struct supernet_info *myinfo,struct iguana_info *coin,char *rawtx) From 2728db5020333b9afc1e82d2e3411ab3e3535e6b Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Tue, 9 Oct 2018 13:35:03 +0800 Subject: [PATCH 061/167] some prints --- crypto777/bitcoind_RPC.c | 9 +++++---- iguana/dpow/dpow_rpc.c | 6 ++++-- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/crypto777/bitcoind_RPC.c b/crypto777/bitcoind_RPC.c index 78c874cbe..d99bea54e 100755 --- a/crypto777/bitcoind_RPC.c +++ b/crypto777/bitcoind_RPC.c @@ -183,7 +183,7 @@ try_again: if ( curl_handle == 0 ) curl_handle = curl_easy_init(); headers = curl_slist_append(0,"Expect:"); - + curl_easy_setopt(curl_handle,CURLOPT_USERAGENT,"mozilla/4.0");//"Mozilla/4.0 (compatible; )"); curl_easy_setopt(curl_handle,CURLOPT_HTTPHEADER, headers); curl_easy_setopt(curl_handle,CURLOPT_URL, url); @@ -275,12 +275,13 @@ try_again: printf( "curl_easy_perform() failed: %s %s.(%s %s), retries: %d\n",curl_easy_strerror(res),debugstr,url,command,numretries); //printf("Maximum number of retries exceeded!\n"); free(retstr); + printf("retstr freeed\n", ); return(0); } free(retstr); sleep((1<symbol,buf); + } // else printf("%s null retstr from (%s)n",coin->symbol,buf); } + printf("bitcoind passthfu failed on lock\n", ); return(0); } @@ -491,8 +492,9 @@ char *dpow_unlockunspent(struct supernet_info *myinfo,struct iguana_info *coin,c { //printf("RESULT.(%s)\n",retstr); return(retstr); - } else printf("%s null retstr from (%s)n",coin->symbol,buf); + } //else printf("%s null retstr from (%s)n",coin->symbol,buf); } + printf("bitcoind passthfu failed on unlock\n", ); return(0); } From abc2633b47a0ff668a718b0b91bbbf90c15d4968 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Tue, 9 Oct 2018 13:36:12 +0800 Subject: [PATCH 062/167] a , --- crypto777/bitcoind_RPC.c | 2 +- iguana/dpow/dpow_rpc.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/crypto777/bitcoind_RPC.c b/crypto777/bitcoind_RPC.c index d99bea54e..7ae876fa2 100755 --- a/crypto777/bitcoind_RPC.c +++ b/crypto777/bitcoind_RPC.c @@ -275,7 +275,7 @@ try_again: printf( "curl_easy_perform() failed: %s %s.(%s %s), retries: %d\n",curl_easy_strerror(res),debugstr,url,command,numretries); //printf("Maximum number of retries exceeded!\n"); free(retstr); - printf("retstr freeed\n", ); + printf("retstr freeed\n"); return(0); } free(retstr); diff --git a/iguana/dpow/dpow_rpc.c b/iguana/dpow/dpow_rpc.c index 0e03b8c81..a7e239990 100755 --- a/iguana/dpow/dpow_rpc.c +++ b/iguana/dpow/dpow_rpc.c @@ -478,7 +478,7 @@ char *dpow_lockunspent(struct supernet_info *myinfo,struct iguana_info *coin,cha return(retstr); } // else printf("%s null retstr from (%s)n",coin->symbol,buf); } - printf("bitcoind passthfu failed on lock\n", ); + printf("bitcoind passthfu failed on lock\n"); return(0); } @@ -494,7 +494,7 @@ char *dpow_unlockunspent(struct supernet_info *myinfo,struct iguana_info *coin,c return(retstr); } //else printf("%s null retstr from (%s)n",coin->symbol,buf); } - printf("bitcoind passthfu failed on unlock\n", ); + printf("bitcoind passthfu failed on unlock\n"); return(0); } From 9f7fe03d84e13586151136309ea8e74cae95c21a Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Tue, 9 Oct 2018 13:44:54 +0800 Subject: [PATCH 063/167] change prints --- crypto777/bitcoind_RPC.c | 1 - iguana/dpow/dpow_fsm.c | 1 + iguana/dpow/dpow_rpc.c | 1 - 3 files changed, 1 insertion(+), 2 deletions(-) diff --git a/crypto777/bitcoind_RPC.c b/crypto777/bitcoind_RPC.c index 7ae876fa2..a83ac9f27 100755 --- a/crypto777/bitcoind_RPC.c +++ b/crypto777/bitcoind_RPC.c @@ -275,7 +275,6 @@ try_again: printf( "curl_easy_perform() failed: %s %s.(%s %s), retries: %d\n",curl_easy_strerror(res),debugstr,url,command,numretries); //printf("Maximum number of retries exceeded!\n"); free(retstr); - printf("retstr freeed\n"); return(0); } free(retstr); diff --git a/iguana/dpow/dpow_fsm.c b/iguana/dpow/dpow_fsm.c index 12b97d765..6792879cf 100755 --- a/iguana/dpow/dpow_fsm.c +++ b/iguana/dpow/dpow_fsm.c @@ -624,6 +624,7 @@ void dpow_statemachinestart(void *ptr) if ( (strcmp("KMD",dest->symbol) == 0 ) && (ep->dest.prev_vout != -1) ) { destunlockunspent = dpow_unlockunspent(myinfo,bp->destcoin,destaddr,bits256_str(str2,ep->dest.prev_hash),ep->dest.prev_vout); + printf("destlockunspent: %s\n", destunlockunspent); if (strcmp(destunlockunspent,"true") == 0 ) printf(">>>>UNLOCKED %s UTXO.(%s) vout.(%d)\n",dest->symbol,bits256_str(str2,ep->dest.prev_hash),ep->dest.prev_vout); free(destunlockunspent); diff --git a/iguana/dpow/dpow_rpc.c b/iguana/dpow/dpow_rpc.c index a7e239990..c51e88ca5 100755 --- a/iguana/dpow/dpow_rpc.c +++ b/iguana/dpow/dpow_rpc.c @@ -478,7 +478,6 @@ char *dpow_lockunspent(struct supernet_info *myinfo,struct iguana_info *coin,cha return(retstr); } // else printf("%s null retstr from (%s)n",coin->symbol,buf); } - printf("bitcoind passthfu failed on lock\n"); return(0); } From b6e8a26caf6526deb96872f14ffc651a0070d5ea Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Tue, 9 Oct 2018 14:23:25 +0800 Subject: [PATCH 064/167] might work --- iguana/dpow/dpow_fsm.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/iguana/dpow/dpow_fsm.c b/iguana/dpow/dpow_fsm.c index 6792879cf..b8c91b2df 100755 --- a/iguana/dpow/dpow_fsm.c +++ b/iguana/dpow/dpow_fsm.c @@ -623,20 +623,21 @@ void dpow_statemachinestart(void *ptr) // unlock the dest utxo on KMD. if ( (strcmp("KMD",dest->symbol) == 0 ) && (ep->dest.prev_vout != -1) ) { - destunlockunspent = dpow_unlockunspent(myinfo,bp->destcoin,destaddr,bits256_str(str2,ep->dest.prev_hash),ep->dest.prev_vout); - printf("destlockunspent: %s\n", destunlockunspent); - if (strcmp(destunlockunspent,"true") == 0 ) - printf(">>>>UNLOCKED %s UTXO.(%s) vout.(%d)\n",dest->symbol,bits256_str(str2,ep->dest.prev_hash),ep->dest.prev_vout); - free(destunlockunspent); + if ( destunlockunspent = dpow_unlockunspent(myinfo,bp->destcoin,destaddr,bits256_str(str2,ep->dest.prev_hash),ep->dest.prev_vout) != 0 ) { + if (strcmp(destunlockunspent,"true") == 0 ) + printf(">>>>UNLOCKED %s UTXO.(%s) vout.(%d)\n",dest->symbol,bits256_str(str2,ep->dest.prev_hash),ep->dest.prev_vout); + free(destunlockunspent); + } } // unlock the src selected utxo on KMD, as those are the only ones we LOCK, and CHIPS does not like the lockunspent call. if ( ( strcmp("KMD",src->symbol) == 0 ) && (ep->src.prev_vout != -1) ) { - srcunlockunspent = dpow_unlockunspent(myinfo,bp->srccoin,srcaddr,bits256_str(str2,ep->src.prev_hash),ep->src.prev_vout); - if (strcmp(srcunlockunspent,"true") == 0 ) - printf(">>>>UNLOCKED %s UTXO.(%s) vout.(%d)\n",src->symbol,bits256_str(str2,ep->src.prev_hash),ep->src.prev_vout); - free(srcunlockunspent); + if ( srcunlockunspent = dpow_unlockunspent(myinfo,bp->srccoin,srcaddr,bits256_str(str2,ep->src.prev_hash),ep->src.prev_vout) != 0) { + if (strcmp(srcunlockunspent,"true") == 0 ) + printf(">>>>UNLOCKED %s UTXO.(%s) vout.(%d)\n",src->symbol,bits256_str(str2,ep->src.prev_hash),ep->src.prev_vout); + free(srcunlockunspent); + } } // dp->blocks[bp->height] = 0; From 3871f42932875254850f896e1223ab0bf83abcb9 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Tue, 9 Oct 2018 14:30:12 +0800 Subject: [PATCH 065/167] it didnt --- iguana/dpow/dpow_fsm.c | 14 ++++---------- iguana/dpow/dpow_rpc.c | 6 +++--- 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/iguana/dpow/dpow_fsm.c b/iguana/dpow/dpow_fsm.c index b8c91b2df..47fa7d6a2 100755 --- a/iguana/dpow/dpow_fsm.c +++ b/iguana/dpow/dpow_fsm.c @@ -623,21 +623,15 @@ void dpow_statemachinestart(void *ptr) // unlock the dest utxo on KMD. if ( (strcmp("KMD",dest->symbol) == 0 ) && (ep->dest.prev_vout != -1) ) { - if ( destunlockunspent = dpow_unlockunspent(myinfo,bp->destcoin,destaddr,bits256_str(str2,ep->dest.prev_hash),ep->dest.prev_vout) != 0 ) { - if (strcmp(destunlockunspent,"true") == 0 ) - printf(">>>>UNLOCKED %s UTXO.(%s) vout.(%d)\n",dest->symbol,bits256_str(str2,ep->dest.prev_hash),ep->dest.prev_vout); - free(destunlockunspent); - } + if ( dpow_unlockunspent(myinfo,bp->destcoin,destaddr,bits256_str(str2,ep->dest.prev_hash),ep->dest.prev_vout) != 0 ) + printf(">>>> UNLOCKED %s UTXO.(%s) vout.(%d)\n",dest->symbol,bits256_str(str2,ep->dest.prev_hash),ep->dest.prev_vout); } // unlock the src selected utxo on KMD, as those are the only ones we LOCK, and CHIPS does not like the lockunspent call. if ( ( strcmp("KMD",src->symbol) == 0 ) && (ep->src.prev_vout != -1) ) { - if ( srcunlockunspent = dpow_unlockunspent(myinfo,bp->srccoin,srcaddr,bits256_str(str2,ep->src.prev_hash),ep->src.prev_vout) != 0) { - if (strcmp(srcunlockunspent,"true") == 0 ) - printf(">>>>UNLOCKED %s UTXO.(%s) vout.(%d)\n",src->symbol,bits256_str(str2,ep->src.prev_hash),ep->src.prev_vout); - free(srcunlockunspent); - } + if ( dpow_unlockunspent(myinfo,bp->srccoin,srcaddr,bits256_str(str2,ep->src.prev_hash),ep->src.prev_vout) != 0) + printf(">>>> UNLOCKED %s UTXO.(%s) vout.(%d)\n",src->symbol,bits256_str(str2,ep->src.prev_hash),ep->src.prev_vout); } // dp->blocks[bp->height] = 0; diff --git a/iguana/dpow/dpow_rpc.c b/iguana/dpow/dpow_rpc.c index c51e88ca5..927712aa7 100755 --- a/iguana/dpow/dpow_rpc.c +++ b/iguana/dpow/dpow_rpc.c @@ -481,7 +481,7 @@ char *dpow_lockunspent(struct supernet_info *myinfo,struct iguana_info *coin,cha return(0); } -char *dpow_unlockunspent(struct supernet_info *myinfo,struct iguana_info *coin,char *coinaddr,char *txid,int32_t vout) +int dpow_unlockunspent(struct supernet_info *myinfo,struct iguana_info *coin,char *coinaddr,char *txid,int32_t vout) { char buf[128],*retstr; if ( coin->FULLNODE < 0 ) @@ -490,10 +490,10 @@ char *dpow_unlockunspent(struct supernet_info *myinfo,struct iguana_info *coin,c if ( (retstr= bitcoind_passthru(coin->symbol,coin->chain->serverport,coin->chain->userpass,"lockunspent",buf)) != 0 ) { //printf("RESULT.(%s)\n",retstr); - return(retstr); + free(retstr) + return(1); } //else printf("%s null retstr from (%s)n",coin->symbol,buf); } - printf("bitcoind passthfu failed on unlock\n"); return(0); } From d7b98b699ca8d02f542c0a5a772ad3457dc48f7f Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Tue, 9 Oct 2018 14:31:11 +0800 Subject: [PATCH 066/167] ; --- iguana/dpow/dpow_rpc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iguana/dpow/dpow_rpc.c b/iguana/dpow/dpow_rpc.c index 927712aa7..3dc45c7f1 100755 --- a/iguana/dpow/dpow_rpc.c +++ b/iguana/dpow/dpow_rpc.c @@ -490,7 +490,7 @@ int dpow_unlockunspent(struct supernet_info *myinfo,struct iguana_info *coin,cha if ( (retstr= bitcoind_passthru(coin->symbol,coin->chain->serverport,coin->chain->userpass,"lockunspent",buf)) != 0 ) { //printf("RESULT.(%s)\n",retstr); - free(retstr) + free(retstr); return(1); } //else printf("%s null retstr from (%s)n",coin->symbol,buf); } From 3b1ac738bdeb90bd20b18e00ea3dcd91b7e0775c Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Tue, 9 Oct 2018 14:45:46 +0800 Subject: [PATCH 067/167] Fixed finally --- iguana/dpow/dpow_fsm.c | 13 ++++++------- iguana/dpow/dpow_rpc.c | 5 +++-- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/iguana/dpow/dpow_fsm.c b/iguana/dpow/dpow_fsm.c index 47fa7d6a2..3153a5213 100755 --- a/iguana/dpow/dpow_fsm.c +++ b/iguana/dpow/dpow_fsm.c @@ -507,25 +507,24 @@ void dpow_statemachinestart(void *ptr) if ( (strcmp("KMD",dest->symbol) == 0 ) && (ep->dest.prev_vout != -1) ) { - // lock the dest utxo if destination coin is KMD.s - destlockunspent = dpow_lockunspent(myinfo,bp->destcoin,destaddr,bits256_str(str2,ep->dest.prev_hash),ep->dest.prev_vout); - if (strcmp(destlockunspent,"true") == 0 ) + // lock the dest utxo if destination coin is KMD. + if (dpow_lockunspent(myinfo,bp->destcoin,destaddr,bits256_str(str2,ep->dest.prev_hash),ep->dest.prev_vout) != 0) { printf(">>>> LOCKED %s UTXO.(%s) vout.(%d)\n",dest->symbol,bits256_str(str2,ep->dest.prev_hash),ep->dest.prev_vout); else printf("<<<< FAILED TO LOCK %s UTXO.(%s) vout.(%d)\n",dest->symbol,bits256_str(str2,ep->dest.prev_hash),ep->dest.prev_vout); - free(destlockunspent); + } } if ( ( strcmp("KMD",src->symbol) == 0 ) && (ep->src.prev_vout != -1) ) { // lock the src coin selected utxo if the source coin is KMD. - srclockunspent = dpow_lockunspent(myinfo,bp->srccoin,srcaddr,bits256_str(str2,ep->src.prev_hash),ep->src.prev_vout); - if (strcmp(srclockunspent,"true") == 0 ) + if (dpow_lockunspent(myinfo,bp->srccoin,srcaddr,bits256_str(str2,ep->src.prev_hash),ep->src.prev_vout) != 0) { printf(">>>> LOCKED %s UTXO.(%s) vout.(%d\n",src->symbol,bits256_str(str2,ep->src.prev_hash),ep->src.prev_vout); else printf("<<<< FAILED TO LOCK %s UTXO.(%s) vout.(%d)\n",src->symbol,bits256_str(str2,ep->src.prev_hash),ep->src.prev_vout); - free(srclockunspent); + } } + bp->recvmask |= (1LL << myind); bp->notaries[myind].othermask |= (1LL << myind); dp->checkpoint = checkpoint; diff --git a/iguana/dpow/dpow_rpc.c b/iguana/dpow/dpow_rpc.c index 3dc45c7f1..a76b010ab 100755 --- a/iguana/dpow/dpow_rpc.c +++ b/iguana/dpow/dpow_rpc.c @@ -466,7 +466,7 @@ cJSON *dpow_gettxout(struct supernet_info *myinfo,struct iguana_info *coin,bits2 return(json); } -char *dpow_lockunspent(struct supernet_info *myinfo,struct iguana_info *coin,char *coinaddr,char *txid,int32_t vout) +int dpow_lockunspent(struct supernet_info *myinfo,struct iguana_info *coin,char *coinaddr,char *txid,int32_t vout) { char buf[128],*retstr; if ( coin->FULLNODE < 0 ) @@ -475,7 +475,8 @@ char *dpow_lockunspent(struct supernet_info *myinfo,struct iguana_info *coin,cha if ( (retstr= bitcoind_passthru(coin->symbol,coin->chain->serverport,coin->chain->userpass,"lockunspent",buf)) != 0 ) { //printf("RESULT.(%s)\n",retstr); - return(retstr); + free(retstr); + return(1); } // else printf("%s null retstr from (%s)n",coin->symbol,buf); } return(0); From 0d60ab23ae78ab8041d6cde05b84e4a79cf81ff5 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Tue, 9 Oct 2018 14:48:30 +0800 Subject: [PATCH 068/167] oops --- iguana/dpow/dpow_fsm.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/iguana/dpow/dpow_fsm.c b/iguana/dpow/dpow_fsm.c index 3153a5213..66daf2db9 100755 --- a/iguana/dpow/dpow_fsm.c +++ b/iguana/dpow/dpow_fsm.c @@ -508,21 +508,19 @@ void dpow_statemachinestart(void *ptr) if ( (strcmp("KMD",dest->symbol) == 0 ) && (ep->dest.prev_vout != -1) ) { // lock the dest utxo if destination coin is KMD. - if (dpow_lockunspent(myinfo,bp->destcoin,destaddr,bits256_str(str2,ep->dest.prev_hash),ep->dest.prev_vout) != 0) { + if (dpow_lockunspent(myinfo,bp->destcoin,destaddr,bits256_str(str2,ep->dest.prev_hash),ep->dest.prev_vout) != 0) printf(">>>> LOCKED %s UTXO.(%s) vout.(%d)\n",dest->symbol,bits256_str(str2,ep->dest.prev_hash),ep->dest.prev_vout); else printf("<<<< FAILED TO LOCK %s UTXO.(%s) vout.(%d)\n",dest->symbol,bits256_str(str2,ep->dest.prev_hash),ep->dest.prev_vout); - } } if ( ( strcmp("KMD",src->symbol) == 0 ) && (ep->src.prev_vout != -1) ) { // lock the src coin selected utxo if the source coin is KMD. - if (dpow_lockunspent(myinfo,bp->srccoin,srcaddr,bits256_str(str2,ep->src.prev_hash),ep->src.prev_vout) != 0) { + if (dpow_lockunspent(myinfo,bp->srccoin,srcaddr,bits256_str(str2,ep->src.prev_hash),ep->src.prev_vout) != 0) printf(">>>> LOCKED %s UTXO.(%s) vout.(%d\n",src->symbol,bits256_str(str2,ep->src.prev_hash),ep->src.prev_vout); else printf("<<<< FAILED TO LOCK %s UTXO.(%s) vout.(%d)\n",src->symbol,bits256_str(str2,ep->src.prev_hash),ep->src.prev_vout); - } } bp->recvmask |= (1LL << myind); From 24c8a8db36eb423ae24364b064865643f5968b54 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Tue, 9 Oct 2018 15:45:46 +0800 Subject: [PATCH 069/167] hmm --- iguana/dpow/dpow_fsm.c | 1 - 1 file changed, 1 deletion(-) diff --git a/iguana/dpow/dpow_fsm.c b/iguana/dpow/dpow_fsm.c index 66daf2db9..6cc7b3074 100755 --- a/iguana/dpow/dpow_fsm.c +++ b/iguana/dpow/dpow_fsm.c @@ -265,7 +265,6 @@ void dpow_statemachinestart(void *ptr) void **ptrs = ptr; struct supernet_info *myinfo; struct dpow_info *dp; struct dpow_checkpoint checkpoint; int32_t i,j,ht,extralen,destprevvout0,srcprevvout0,src_or_dest,numratified=0,kmdheight,myind = -1; uint8_t extras[10000],pubkeys[64][33]; cJSON *ratified=0,*item; struct iguana_info *src,*dest; char *jsonstr,*handle,*hexstr,str[65],str2[65],srcaddr[64],destaddr[64]; bits256 zero,MoM,merkleroot,srchash,destprevtxid0,srcprevtxid0; struct dpow_block *bp; struct dpow_entry *ep = 0; uint32_t MoMdepth,duration,minsigs,starttime,srctime; - char *destlockunspent,*srclockunspent,*destunlockunspent,*srcunlockunspent; memset(&zero,0,sizeof(zero)); MoM = zero; srcprevtxid0 = destprevtxid0 = zero; From 56f30a4b56ca233dc12f82c19963761169229e1b Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Wed, 10 Oct 2018 16:13:47 +0800 Subject: [PATCH 070/167] fix double lockunspent function from merge some how --- iguana/dpow/dpow_rpc.c | 33 --------------------------------- 1 file changed, 33 deletions(-) diff --git a/iguana/dpow/dpow_rpc.c b/iguana/dpow/dpow_rpc.c index aeb8b48e1..c1c982622 100755 --- a/iguana/dpow/dpow_rpc.c +++ b/iguana/dpow/dpow_rpc.c @@ -371,39 +371,6 @@ bits256 dpow_getblockhash(struct supernet_info *myinfo,struct iguana_info *coin, return(blockhash); } -int dpow_lockunspent(struct supernet_info *myinfo,struct iguana_info *coin,char *coinaddr,char *txid,int32_t vout) -{ - char buf[128],*retstr; - if ( coin->FULLNODE < 0 ) - { - sprintf(buf,"false, [{\"txid\":\"%s\",\"vout\":%d}]", txid, vout); - if ( (retstr= bitcoind_passthru(coin->symbol,coin->chain->serverport,coin->chain->userpass,"lockunspent",buf)) != 0 ) - { - //printf("RESULT.(%s)\n",retstr); - free(retstr); - return(1); - } // else printf("%s null retstr from (%s)n",coin->symbol,buf); - } - return(0); -} - -int dpow_unlockunspent(struct supernet_info *myinfo,struct iguana_info *coin,char *coinaddr,char *txid,int32_t vout) -{ - char buf[128],*retstr; - if ( coin->FULLNODE < 0 ) - { - sprintf(buf,"true, [{\"txid\":\"%s\",\"vout\":%d}]", txid, vout); - if ( (retstr= bitcoind_passthru(coin->symbol,coin->chain->serverport,coin->chain->userpass,"lockunspent",buf)) != 0 ) - { - //printf("RESULT.(%s)\n",retstr); - free(retstr); - return(1); - } //else printf("%s null retstr from (%s)n",coin->symbol,buf); - } - return(0); -} - - cJSON *dpow_getblock(struct supernet_info *myinfo,struct iguana_info *coin,bits256 blockhash) { char buf[128],str[65],*retstr=0; cJSON *json = 0; From 11b017903894b20c5a3ff9f014b3cf8990cd4d6c Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sat, 3 Nov 2018 10:59:28 +0800 Subject: [PATCH 071/167] Add is_STAKED function, set staked chains to suppress = 3. --- iguana/dpow/dpow_rpc.c | 2 +- iguana/iguana_notary.c | 21 +++++++++++++++++---- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/iguana/dpow/dpow_rpc.c b/iguana/dpow/dpow_rpc.c index c1c982622..9c7b5818a 100755 --- a/iguana/dpow/dpow_rpc.c +++ b/iguana/dpow/dpow_rpc.c @@ -289,7 +289,7 @@ int32_t dpow_paxpending(struct supernet_info *myinfo,uint8_t *hex,int32_t hexsiz MoMdepth = (MoMdepth & 0xffff) | ((uint32_t)CCid<<16); n += iguana_rwnum(1,&hex[n],sizeof(MoMdepth),(uint32_t *)&MoMdepth); //( ) - if ( ( (strncmp(bp->srccoin->symbol, "STKD", 4) == 0) || (strncmp(bp->srccoin->symbol, "STAKED", 6) == 0) ) && src_or_dest == 0 && strcmp(bp->destcoin->symbol,"KMD") == 0 ) + if ( ( is_STAKED() != 0 ) && src_or_dest == 0 && strcmp(bp->destcoin->symbol,"KMD") == 0 ) { kmdcoin = bp->destcoin; if ( (infojson= dpow_getinfo(myinfo,kmdcoin)) != 0 ) diff --git a/iguana/iguana_notary.c b/iguana/iguana_notary.c index 6dfbb1453..934f3b038 100755 --- a/iguana/iguana_notary.c +++ b/iguana/iguana_notary.c @@ -58,6 +58,18 @@ void dpow_checkpointset(struct supernet_info *myinfo,struct dpow_checkpoint *che checkpoint->blockhash.height = height; } +int is_STAKED(const char *chain_name) { + int STAKED = 0; + if ( (strcmp(chain_name, "STAKED") == 0) || (strncmp(chain_name, "STAKED", 6) == 0) ) + STAKED = 1; + else if ( (strcmp(chain_name, "STKD") == 0) || (strncmp(chain_name, "STKD", 4) == 0) ) + STAKED = 2; + else if ( (strcmp(chain_name, "CFEK") == 0) || (strncmp(chain_name, "CFEK", 4) == 0) ) + STAKED = 3; + //fprintf(stderr, "This chains is: %s which is: %d\n", chain_name,STAKED); + return(STAKED); +}; + void dpow_srcupdate(struct supernet_info *myinfo,struct dpow_info *dp,int32_t height,bits256 hash,uint32_t timestamp,uint32_t blocktime) { //struct komodo_ccdataMoMoM mdata; cJSON *blockjson; uint64_t signedmask; struct iguana_info *coin; @@ -67,11 +79,12 @@ void dpow_srcupdate(struct supernet_info *myinfo,struct dpow_info *dp,int32_t he dpow_fifoupdate(myinfo,dp->srcfifo,dp->last); if ( strcmp(dp->dest,"KMD") == 0 ) { - if ( dp->DESTHEIGHT < dp->prevDESTHEIGHT+DPOW_CHECKPOINTFREQ ) + int supressfreq = DPOW_CHECKPOINTFREQ; + if ( is_STAKED() != 0 ) { + supressfreq = 3; + } + if ( dp->DESTHEIGHT < dp->prevDESTHEIGHT+supressfreq ) { - if ( (strncmp(dp->symbol, "STKD", 4) == 0) || (strncmp(dp->symbol, "STAKED", 6) == 0) ) - suppress = 0; - else suppress = 1; //fprintf(stderr,"suppress %s -> KMD freq KMD blocks.%d\n",dp->symbol,checkpointfreq); } From dddbef8848f752026968b716eeaee2381c6e0961 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sat, 3 Nov 2018 11:06:48 +0800 Subject: [PATCH 072/167] coin name! --- iguana/dpow/dpow_rpc.c | 2 +- iguana/iguana_notary.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/iguana/dpow/dpow_rpc.c b/iguana/dpow/dpow_rpc.c index 9c7b5818a..59d63eebf 100755 --- a/iguana/dpow/dpow_rpc.c +++ b/iguana/dpow/dpow_rpc.c @@ -289,7 +289,7 @@ int32_t dpow_paxpending(struct supernet_info *myinfo,uint8_t *hex,int32_t hexsiz MoMdepth = (MoMdepth & 0xffff) | ((uint32_t)CCid<<16); n += iguana_rwnum(1,&hex[n],sizeof(MoMdepth),(uint32_t *)&MoMdepth); //( ) - if ( ( is_STAKED() != 0 ) && src_or_dest == 0 && strcmp(bp->destcoin->symbol,"KMD") == 0 ) + if ( ( is_STAKED(bp->srccoin->symbol) ) && src_or_dest == 0 && strcmp(bp->destcoin->symbol,"KMD") == 0 ) { kmdcoin = bp->destcoin; if ( (infojson= dpow_getinfo(myinfo,kmdcoin)) != 0 ) diff --git a/iguana/iguana_notary.c b/iguana/iguana_notary.c index 934f3b038..9dff97d12 100755 --- a/iguana/iguana_notary.c +++ b/iguana/iguana_notary.c @@ -80,7 +80,7 @@ void dpow_srcupdate(struct supernet_info *myinfo,struct dpow_info *dp,int32_t he if ( strcmp(dp->dest,"KMD") == 0 ) { int supressfreq = DPOW_CHECKPOINTFREQ; - if ( is_STAKED() != 0 ) { + if ( is_STAKED(dp->symbol) != 0 ) { supressfreq = 3; } if ( dp->DESTHEIGHT < dp->prevDESTHEIGHT+supressfreq ) From b52214fc0a76524ddd4ce020f7feba599872077d Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sat, 3 Nov 2018 11:08:58 +0800 Subject: [PATCH 073/167] = --- iguana/dpow/dpow_rpc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iguana/dpow/dpow_rpc.c b/iguana/dpow/dpow_rpc.c index 59d63eebf..f4352c5da 100755 --- a/iguana/dpow/dpow_rpc.c +++ b/iguana/dpow/dpow_rpc.c @@ -289,7 +289,7 @@ int32_t dpow_paxpending(struct supernet_info *myinfo,uint8_t *hex,int32_t hexsiz MoMdepth = (MoMdepth & 0xffff) | ((uint32_t)CCid<<16); n += iguana_rwnum(1,&hex[n],sizeof(MoMdepth),(uint32_t *)&MoMdepth); //( ) - if ( ( is_STAKED(bp->srccoin->symbol) ) && src_or_dest == 0 && strcmp(bp->destcoin->symbol,"KMD") == 0 ) + if ( ( is_STAKED(bp->srccoin->symbol) != 0 ) && src_or_dest == 0 && strcmp(bp->destcoin->symbol,"KMD") == 0 ) { kmdcoin = bp->destcoin; if ( (infojson= dpow_getinfo(myinfo,kmdcoin)) != 0 ) From b4c0f99b1d40e6dabb835d6dbc093429dc3028d8 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sat, 3 Nov 2018 11:11:41 +0800 Subject: [PATCH 074/167] fix --- iguana/dpow/dpow_rpc.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/iguana/dpow/dpow_rpc.c b/iguana/dpow/dpow_rpc.c index f4352c5da..ad6d33ed1 100755 --- a/iguana/dpow/dpow_rpc.c +++ b/iguana/dpow/dpow_rpc.c @@ -279,6 +279,8 @@ cJSON *dpow_MoMoMdata(struct iguana_info *coin,char *symbol,int32_t kmdheight,ui return(retjson); } +int is_STAKED(const char *chain_name); + int32_t dpow_paxpending(struct supernet_info *myinfo,uint8_t *hex,int32_t hexsize,uint32_t *paxwdcrcp,bits256 MoM,uint32_t MoMdepth,uint16_t CCid,int32_t src_or_dest,struct dpow_block *bp) { struct iguana_info *coin,*kmdcoin=0; char *retstr,*hexstr; cJSON *retjson,*infojson; int32_t kmdheight=0,hexlen=0,n=0; uint32_t paxwdcrc; From 5d1012a7dcb50d3416f89d2e06973e87f80c7b2d Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 23 Nov 2018 18:50:38 +0800 Subject: [PATCH 075/167] updte to LABS/LAB --- iguana/iguana_notary.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/iguana/iguana_notary.c b/iguana/iguana_notary.c index 9dff97d12..bd791251c 100755 --- a/iguana/iguana_notary.c +++ b/iguana/iguana_notary.c @@ -60,9 +60,9 @@ void dpow_checkpointset(struct supernet_info *myinfo,struct dpow_checkpoint *che int is_STAKED(const char *chain_name) { int STAKED = 0; - if ( (strcmp(chain_name, "STAKED") == 0) || (strncmp(chain_name, "STAKED", 6) == 0) ) + if ( (strcmp(chain_name, "LABS") == 0) || (strncmp(chain_name, "LABS", 4) == 0) ) STAKED = 1; - else if ( (strcmp(chain_name, "STKD") == 0) || (strncmp(chain_name, "STKD", 4) == 0) ) + else if ( (strcmp(chain_name, "LAB") == 0) || (strncmp(chain_name, "LAB", 3) == 0) ) STAKED = 2; else if ( (strcmp(chain_name, "CFEK") == 0) || (strncmp(chain_name, "CFEK", 4) == 0) ) STAKED = 3; From ee913c03bcd61681334acf0b1cd352ab5fc39fa3 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Wed, 20 Feb 2019 20:27:59 +0800 Subject: [PATCH 076/167] test not adding all seen ips,m for testing tor integration effects. --- iguana/dpow/dpow_network.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/iguana/dpow/dpow_network.c b/iguana/dpow/dpow_network.c index 2abf37350..5fe73620d 100755 --- a/iguana/dpow/dpow_network.c +++ b/iguana/dpow/dpow_network.c @@ -1378,7 +1378,7 @@ int32_t dpow_addnotary(struct supernet_info *myinfo,struct dpow_info *dp,char *i //if ( strcmp(ipaddr,"88.99.251.101") == 0 || strcmp(ipaddr,"82.202.193.100") == 0 ) // return(-1); - #ifdef CHECKNODEIP +#ifdef CHECKNODEIP // -B- [+] Decker --- // every new ip in BUS topology network goes to dead or white list forever, until iguana restart ip_pattern = (uint32_t)calc_ipbits(ipaddr); @@ -1405,7 +1405,7 @@ int32_t dpow_addnotary(struct supernet_info *myinfo,struct dpow_info *dp,char *i } else if (dead_or_alive[in_list_flag] == -1) return -1; // -E- [+] Decker --- - #endif +#endif portable_mutex_lock(&myinfo->notarymutex); if ( myinfo->dpowsock >= 0 )//&& myinfo->dexsock >= 0 ) @@ -2312,7 +2312,9 @@ int32_t dpow_nanomsg_update(struct supernet_info *myinfo) printf("received nnpacket for (%s)\n",np->symbol); else { - dpow_ipbitsadd(myinfo,dp,np->ipbits,np->numipbits,sizeof(np->ipbits)/sizeof(*np->ipbits),np->senderind,np->myipbits); + // try to remove this adding fo IPs totally. instead we will need to add all IPs directly with add notary call. + //dpow_ipbitsadd(myinfo,dp,np->ipbits,np->numipbits,sizeof(np->ipbits)/sizeof(*np->ipbits),np->senderind,np->myipbits); + if ( (bp= dpow_heightfind(myinfo,dp,np->height)) != 0 && bp->state != 0xffffffff && bp->myind >= 0 ) { //char str[65]; printf("%s RECV ht.%d ch.%08x (%d) crc32.%08x:%08x datalen.%d:%d firstz.%d i.%d senderind.%d myind.%d\n",bits256_str(str,np->srchash),np->height,np->channel,size,np->crc32,crc32,np->datalen,(int32_t)(size - sizeof(*np)),firstz,i,np->senderind,bp->myind); From ae91fa15568504775f8fc95de933cde6d0921730 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Wed, 20 Feb 2019 21:08:48 +0800 Subject: [PATCH 077/167] try skip poll --- iguana/dpow/dpow_network.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/iguana/dpow/dpow_network.c b/iguana/dpow/dpow_network.c index 5fe73620d..ceed6254e 100755 --- a/iguana/dpow/dpow_network.c +++ b/iguana/dpow/dpow_network.c @@ -2205,17 +2205,17 @@ void dpow_send(struct supernet_info *myinfo,struct dpow_info *dp,struct dpow_blo memcpy(np->packet,data,datalen); sentbytes = -1; // deadlocks! portable_mutex_lock(&myinfo->dpowmutex); - maxiters = 100; + maxiters = 2; for (i=0; idpowsock; pfd.events = NN_POLLOUT; - if ( nn_poll(&pfd,1,10) > 0 ) - { + //if ( nn_poll(&pfd,1,10) > 0 ) + //{ sentbytes = signed_nn_send(myinfo,myinfo->ctx,myinfo->persistent_priv,myinfo->dpowsock,np,size); break; - } + //} usleep(1000); } if ( i == maxiters ) From 2d522edb7d7415699dc8baa98072d9afd140b830 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Wed, 20 Feb 2019 21:12:39 +0800 Subject: [PATCH 078/167] undo skip poll, socked isnt binding --- iguana/dpow/dpow_network.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/iguana/dpow/dpow_network.c b/iguana/dpow/dpow_network.c index ceed6254e..5fe73620d 100755 --- a/iguana/dpow/dpow_network.c +++ b/iguana/dpow/dpow_network.c @@ -2205,17 +2205,17 @@ void dpow_send(struct supernet_info *myinfo,struct dpow_info *dp,struct dpow_blo memcpy(np->packet,data,datalen); sentbytes = -1; // deadlocks! portable_mutex_lock(&myinfo->dpowmutex); - maxiters = 2; + maxiters = 100; for (i=0; idpowsock; pfd.events = NN_POLLOUT; - //if ( nn_poll(&pfd,1,10) > 0 ) - //{ + if ( nn_poll(&pfd,1,10) > 0 ) + { sentbytes = signed_nn_send(myinfo,myinfo->ctx,myinfo->persistent_priv,myinfo->dpowsock,np,size); break; - //} + } usleep(1000); } if ( i == maxiters ) From 55408c4b05df72277b73baf1d381938bc426e05f Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Thu, 21 Feb 2019 21:34:47 +0800 Subject: [PATCH 079/167] revert skip add seen/shared IPs --- iguana/dpow/dpow_network.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/iguana/dpow/dpow_network.c b/iguana/dpow/dpow_network.c index 5fe73620d..dde067435 100755 --- a/iguana/dpow/dpow_network.c +++ b/iguana/dpow/dpow_network.c @@ -2311,10 +2311,8 @@ int32_t dpow_nanomsg_update(struct supernet_info *myinfo) if ( i == myinfo->numdpows ) printf("received nnpacket for (%s)\n",np->symbol); else - { - // try to remove this adding fo IPs totally. instead we will need to add all IPs directly with add notary call. - //dpow_ipbitsadd(myinfo,dp,np->ipbits,np->numipbits,sizeof(np->ipbits)/sizeof(*np->ipbits),np->senderind,np->myipbits); - + { + dpow_ipbitsadd(myinfo,dp,np->ipbits,np->numipbits,sizeof(np->ipbits)/sizeof(*np->ipbits),np->senderind,np->myipbits); if ( (bp= dpow_heightfind(myinfo,dp,np->height)) != 0 && bp->state != 0xffffffff && bp->myind >= 0 ) { //char str[65]; printf("%s RECV ht.%d ch.%08x (%d) crc32.%08x:%08x datalen.%d:%d firstz.%d i.%d senderind.%d myind.%d\n",bits256_str(str,np->srchash),np->height,np->channel,size,np->crc32,crc32,np->datalen,(int32_t)(size - sizeof(*np)),firstz,i,np->senderind,bp->myind); From 62fa7a206fd6452483b79f392a3de979cf75eadc Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 22 Feb 2019 07:32:52 +0800 Subject: [PATCH 080/167] prints for node 0 --- iguana/dpow/dpow_network.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/iguana/dpow/dpow_network.c b/iguana/dpow/dpow_network.c index dde067435..e19789ffe 100755 --- a/iguana/dpow/dpow_network.c +++ b/iguana/dpow/dpow_network.c @@ -1665,11 +1665,11 @@ void dpow_bestconsensus(struct dpow_info *dp,struct dpow_block *bp) bp->notaries[bp->myind].bestk = bp->bestk = bestks[besti]; if ( bp->myind == 0 ) printf("matches.%d bestmatches.%d recv.%llx (%d %llx)\n",matches,bestmatches,(long long)bp->recvmask,bp->bestk,(long long)bp->bestmask); - if ( 1 && bp->myind == 0 && strcmp("KMD",dp->symbol) == 0 ) + if ( 1 && bp->myind == 0 && strcmp("LABSTH",dp->symbol) == 0 ) { for (i=0; inumnotaries; i++) printf("%d:%d%s ",wts[i],owts[i],wts[i]*owts[i]>median?"*":""); - printf("median.%d %s.%d set matches.%d best.%d to (%d %llx) recv.%llx topmask.%llx\n",sortbuf[bp->numnotaries/2],dp->symbol,bp->height,bp->matches,bp->bestmatches,bp->bestk,(long long)bp->bestmask,(long long)recvmask,(long long)topmask); + printf("median.%d %s.%d set matches.%d best.%d to (%d %llx) recv.%llx topmask.%llx minsigs.%d\n",sortbuf[bp->numnotaries/2],dp->symbol,bp->height,bp->matches,bp->bestmatches,bp->bestk,(long long)bp->bestmask,(long long)recvmask,(long long)topmask,bp->minsigs); for (i=0; inumnotaries; i++) if ( wts[i] == 0 || owts[i] == 0 ) printf("%s.%d:%d ",Notaries_elected[i][0],wts[i],owts[i]); From f50d77291a160372d06293b2e5a2f19160055721 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 22 Feb 2019 07:57:15 +0800 Subject: [PATCH 081/167] prints --- iguana/dpow/dpow_network.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/iguana/dpow/dpow_network.c b/iguana/dpow/dpow_network.c index e19789ffe..8fe8b65a2 100755 --- a/iguana/dpow/dpow_network.c +++ b/iguana/dpow/dpow_network.c @@ -1663,9 +1663,9 @@ void dpow_bestconsensus(struct dpow_info *dp,struct dpow_block *bp) bp->bestmatches = bestmatches; bp->notaries[bp->myind].bestmask = bp->bestmask = masks[besti]; bp->notaries[bp->myind].bestk = bp->bestk = bestks[besti]; - if ( bp->myind == 0 ) + if ( 0 && bp->myind == 0 ) printf("matches.%d bestmatches.%d recv.%llx (%d %llx)\n",matches,bestmatches,(long long)bp->recvmask,bp->bestk,(long long)bp->bestmask); - if ( 1 && bp->myind == 0 && strcmp("LABSTH",dp->symbol) == 0 ) + if ( 0 && bp->myind == 0 && strcmp("LABS",dp->symbol) == 0 ) { for (i=0; inumnotaries; i++) printf("%d:%d%s ",wts[i],owts[i],wts[i]*owts[i]>median?"*":""); @@ -2063,7 +2063,7 @@ void dpow_notarize_update(struct supernet_info *myinfo,struct dpow_info *dp,stru dpow_send(myinfo,dp,bp,srchash,bp->hashmsg,0,bp->height,(void *)"ping",0); bp->lastnanosend = now; } - if ( 1 && strcmp("KMD",dp->symbol) == 0 && bp->myind == 0 ) + if ( 1 && strcmp("LABSTH",dp->symbol) == 0 && bp->myind == 0 ) printf("%s recv.%llx best.(%d %llx) m.%d p.%d:%d b.%d state.%d minsigs.%d pend.%d\n",dp->symbol,(long long)bp->recvmask,bp->bestk,(long long)bp->bestmask,matches,paxmatches,paxbestmatches,bestmatches,bp->state,bp->minsigs,bp->pendingbestk); if ( bestmatches == bp->minsigs && paxbestmatches == bp->minsigs && bp->bestk >= 0 && bp->bestmask != 0 ) { @@ -2138,7 +2138,7 @@ void dpow_nanoutxoget(struct supernet_info *myinfo,struct dpow_info *dp,struct d } } } - if ( 1 && bp->myind == 0 && dispflag != 0 ) + if ( 0 && bp->myind == 0 && dispflag != 0 ) { printf("%s.%d RECV.%-2d %llx (%2d %llx) %llx/%llx matches.%-2d best.%-2d %s\n",dp->symbol,bp->height,senderind,(long long)np->recvmask,(int8_t)np->bestk,(long long)np->bestmask,(long long)np->srcutxo.txid,(long long)np->destutxo.txid,matches,bestmatches,Notaries_elected[senderind][0]); } From b43e003d875793055bd0c7cdad49feeb75f76c55 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 22 Feb 2019 08:10:48 +0800 Subject: [PATCH 082/167] disable --- iguana/dpow/dpow_network.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/iguana/dpow/dpow_network.c b/iguana/dpow/dpow_network.c index 8fe8b65a2..e77a9866b 100755 --- a/iguana/dpow/dpow_network.c +++ b/iguana/dpow/dpow_network.c @@ -2063,7 +2063,7 @@ void dpow_notarize_update(struct supernet_info *myinfo,struct dpow_info *dp,stru dpow_send(myinfo,dp,bp,srchash,bp->hashmsg,0,bp->height,(void *)"ping",0); bp->lastnanosend = now; } - if ( 1 && strcmp("LABSTH",dp->symbol) == 0 && bp->myind == 0 ) + if ( 0N && strcmp("LABSTH",dp->symbol) == 0 && bp->myind == 0 ) printf("%s recv.%llx best.(%d %llx) m.%d p.%d:%d b.%d state.%d minsigs.%d pend.%d\n",dp->symbol,(long long)bp->recvmask,bp->bestk,(long long)bp->bestmask,matches,paxmatches,paxbestmatches,bestmatches,bp->state,bp->minsigs,bp->pendingbestk); if ( bestmatches == bp->minsigs && paxbestmatches == bp->minsigs && bp->bestk >= 0 && bp->bestmask != 0 ) { @@ -2222,7 +2222,7 @@ void dpow_send(struct supernet_info *myinfo,struct dpow_info *dp,struct dpow_blo printf("maxiters expired for signed_nn_send dpowsock.%d\n",myinfo->dpowsock); //portable_mutex_unlock(&myinfo->dpowmutex); free(np); - if ( 1 && bp->myind == 0 ) + if ( 0 && bp->myind == 0 ) printf("%d NANOSEND.%d %s.%d channel.%08x (%d) pax.%08x datalen.%d (%d %llx) (%d %llx) recv.%llx\n",i,sentbytes,dp->symbol,np->height,np->channel,size,np->notarize.paxwdcrc,datalen,(int8_t)np->notarize.bestk,(long long)np->notarize.bestmask,bp->notaries[bp->myind].bestk,(long long)bp->notaries[bp->myind].bestmask,(long long)bp->recvmask); } From 4ed182c14114c6645119279df55694263e3205a1 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 22 Feb 2019 08:12:05 +0800 Subject: [PATCH 083/167] ? --- iguana/dpow/dpow_network.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iguana/dpow/dpow_network.c b/iguana/dpow/dpow_network.c index e77a9866b..00e96644c 100755 --- a/iguana/dpow/dpow_network.c +++ b/iguana/dpow/dpow_network.c @@ -2063,7 +2063,7 @@ void dpow_notarize_update(struct supernet_info *myinfo,struct dpow_info *dp,stru dpow_send(myinfo,dp,bp,srchash,bp->hashmsg,0,bp->height,(void *)"ping",0); bp->lastnanosend = now; } - if ( 0N && strcmp("LABSTH",dp->symbol) == 0 && bp->myind == 0 ) + if ( 0 && strcmp("LABSTH",dp->symbol) == 0 && bp->myind == 0 ) printf("%s recv.%llx best.(%d %llx) m.%d p.%d:%d b.%d state.%d minsigs.%d pend.%d\n",dp->symbol,(long long)bp->recvmask,bp->bestk,(long long)bp->bestmask,matches,paxmatches,paxbestmatches,bestmatches,bp->state,bp->minsigs,bp->pendingbestk); if ( bestmatches == bp->minsigs && paxbestmatches == bp->minsigs && bp->bestk >= 0 && bp->bestmask != 0 ) { From d7f4f993064336a120e6d0697d30f5a72d6c7492 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Thu, 28 Feb 2019 18:21:15 +0800 Subject: [PATCH 084/167] fix is_STAKED --- iguana/iguana_notary.c | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/iguana/iguana_notary.c b/iguana/iguana_notary.c index a75c41315..5087ac05a 100755 --- a/iguana/iguana_notary.c +++ b/iguana/iguana_notary.c @@ -58,16 +58,18 @@ void dpow_checkpointset(struct supernet_info *myinfo,struct dpow_checkpoint *che checkpoint->blockhash.height = height; } -int is_STAKED(const char *chain_name) { - int STAKED = 0; - if ( (strcmp(chain_name, "LABS") == 0) || (strncmp(chain_name, "LABS", 4) == 0) ) - STAKED = 1; - else if ( (strcmp(chain_name, "LAB") == 0) || (strncmp(chain_name, "LAB", 3) == 0) ) - STAKED = 2; - else if ( (strcmp(chain_name, "CFEK") == 0) || (strncmp(chain_name, "CFEK", 4) == 0) ) - STAKED = 3; - //fprintf(stderr, "This chains is: %s which is: %d\n", chain_name,STAKED); - return(STAKED); +int8_t is_STAKED(const char *chain_name) +{ + int8_t STAKED; + if ( chain_name[0] == 0 ) + return(0); + if ( (strcmp(chain_name, "LABS") == 0) || (strncmp(chain_name, "LABS", 4) == 0) ) + STAKED = 1; // These chains are allowed coin emissions. + else if ( (strcmp(chain_name, "CFEK") == 0) || (strncmp(chain_name, "CFEK", 4) == 0) ) + STAKED = 2; // These chains have no speical rules at all. + else if ( (strcmp(chain_name, "TEST") == 0) || (strncmp(chain_name, "TEST", 4) == 0) ) + STAKED = 3; // These chains are for testing consensus to create a chain etc. Not meant to be actually used for anything important. + return(STAKED); }; void dpow_srcupdate(struct supernet_info *myinfo,struct dpow_info *dp,int32_t height,bits256 hash,uint32_t timestamp,uint32_t blocktime) @@ -80,9 +82,8 @@ void dpow_srcupdate(struct supernet_info *myinfo,struct dpow_info *dp,int32_t he if ( strcmp(dp->dest,"KMD") == 0 ) { int supressfreq = DPOW_CHECKPOINTFREQ; - if ( is_STAKED(dp->symbol) != 0 ) { + if ( is_STAKED(dp->symbol) != 0 ) supressfreq = 3; - } if ( dp->DESTHEIGHT < dp->prevDESTHEIGHT+supressfreq ) { suppress = 1; From f419768f28ad8a0cc9b7852ee78a5b0e1f34cefb Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sat, 2 Mar 2019 00:50:12 +0800 Subject: [PATCH 085/167] add bailout if MoMoM not determinate. --- iguana/dpow/dpow_fsm.c | 3 +++ iguana/dpow/dpow_rpc.c | 6 ++++++ iguana/dpow/dpow_tx.c | 19 +++++++++++-------- 3 files changed, 20 insertions(+), 8 deletions(-) diff --git a/iguana/dpow/dpow_fsm.c b/iguana/dpow/dpow_fsm.c index ff4fa6d6b..6d5abf36f 100755 --- a/iguana/dpow/dpow_fsm.c +++ b/iguana/dpow/dpow_fsm.c @@ -563,6 +563,9 @@ void dpow_statemachinestart(void *ptr) src_or_dest = 0; else src_or_dest = 1; extralen = dpow_paxpending(myinfo,extras,sizeof(extras),&bp->paxwdcrc,bp->MoM,bp->MoMdepth,bp->CCid,src_or_dest,bp); + // if MoMoM is not avalible yet, then stop this round and try again later. + if ( extralen == -1 ) + break; bp->notaries[bp->myind].paxwdcrc = bp->paxwdcrc; } if ( dp->checkpoint.blockhash.height > checkpoint.blockhash.height ) //(checkpoint.blockhash.height % 100) != 0 && diff --git a/iguana/dpow/dpow_rpc.c b/iguana/dpow/dpow_rpc.c index da11a5770..7671d8ff1 100755 --- a/iguana/dpow/dpow_rpc.c +++ b/iguana/dpow/dpow_rpc.c @@ -312,6 +312,12 @@ int32_t dpow_paxpending(struct supernet_info *myinfo,uint8_t *hex,int32_t hexsiz } if ( (retjson= dpow_MoMoMdata(kmdcoin,bp->srccoin->symbol,kmdheight,bp->CCid)) != 0 ) { + if ( jstr(retjson,"error")) != 0 ) + { + // bail out MoMoM is indeterminate + free_json(retjson); + return(-1); + } if ( (hexstr= jstr(retjson,"data")) != 0 && (hexlen= (int32_t)strlen(hexstr)) > 0 && n+hexlen/2 <= hexsize ) { hexlen >>= 1; diff --git a/iguana/dpow/dpow_tx.c b/iguana/dpow/dpow_tx.c index 33ad64b92..17f236c74 100755 --- a/iguana/dpow/dpow_tx.c +++ b/iguana/dpow/dpow_tx.c @@ -639,7 +639,17 @@ void dpow_sigscheck(struct supernet_info *myinfo,struct dpow_info *dp,struct dpo { bp->desttxid = txid; dpow_signedtxgen(myinfo,dp,bp->srccoin,bp,bestk,bestmask,myind,DPOW_SIGCHANNEL,0,numratified != 0); - } else bp->srctxid = txid; + } else + { + bp->srctxid = txid; +#ifdef LOGTX + FILE * fptr; + fptr = fopen("/home/node/complete_notarizations", "a+"); + // SRC SRC_TXID DEST DEST_TXID HEIGHT + fprintf(fptr, "%s %s %s\n", bp->srccoin->symbol,bp->srctxid,bp->destcoin->symbol,bp->desttxid,bp->height); + fclose(fptr); +#endif + } len = (int32_t)strlen(bp->signedtx) >> 1; decode_hex(txdata+32,len,bp->signedtx); for (j=0; jstate = 0xffffffff; printf("dpow_sigscheck: [src.%s] mismatched txid.%s vs %s\n",bp->srccoin->symbol,bits256_str(str,txid),retstr); -#ifdef LOGTX - FILE * fptr; - fptr = fopen("/home/node/failed_notarizations", "a+"); - unsigned long dwy_timestamp = time(NULL); - fprintf(fptr, "%lu %s %s %d %s\n", dwy_timestamp, bp->srccoin->symbol,bp->destcoin->symbol,src_or_dest,bp->signedtx); - fclose(fptr); -#endif } free(retstr); retstr = 0; From 864f8a55eb1bdceebd833d121abd75e2a541b4a2 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sat, 2 Mar 2019 01:20:21 +0800 Subject: [PATCH 086/167] oops --- iguana/dpow/dpow_rpc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iguana/dpow/dpow_rpc.c b/iguana/dpow/dpow_rpc.c index 7671d8ff1..b05756d06 100755 --- a/iguana/dpow/dpow_rpc.c +++ b/iguana/dpow/dpow_rpc.c @@ -312,7 +312,7 @@ int32_t dpow_paxpending(struct supernet_info *myinfo,uint8_t *hex,int32_t hexsiz } if ( (retjson= dpow_MoMoMdata(kmdcoin,bp->srccoin->symbol,kmdheight,bp->CCid)) != 0 ) { - if ( jstr(retjson,"error")) != 0 ) + if ( jstr(retjson,"error") != 0 ) { // bail out MoMoM is indeterminate free_json(retjson); From 02d620effccae118250529bb7f8ff5458587b918 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sat, 2 Mar 2019 02:16:59 +0800 Subject: [PATCH 087/167] use notarized height on KMD instead of raw height --- iguana/dpow/dpow_rpc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/iguana/dpow/dpow_rpc.c b/iguana/dpow/dpow_rpc.c index b05756d06..5af20160f 100755 --- a/iguana/dpow/dpow_rpc.c +++ b/iguana/dpow/dpow_rpc.c @@ -307,10 +307,10 @@ int32_t dpow_paxpending(struct supernet_info *myinfo,uint8_t *hex,int32_t hexsiz kmdcoin = bp->destcoin; if ( (infojson= dpow_getinfo(myinfo,kmdcoin)) != 0 ) { - kmdheight = jint(infojson,"blocks"); + kmdheight = jint(infojson,"notarized"); free_json(infojson); } - if ( (retjson= dpow_MoMoMdata(kmdcoin,bp->srccoin->symbol,kmdheight,bp->CCid)) != 0 ) + if ( (retjson= dpow_MoMoMdata(kmdcoin,bp->srccoin->symbol,kmdheight-11,bp->CCid)) != 0 ) { if ( jstr(retjson,"error") != 0 ) { From bd08193af59a8b678e2e709edaf4e9e987db4b97 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sat, 2 Mar 2019 02:17:49 +0800 Subject: [PATCH 088/167] oops --- iguana/dpow/dpow_rpc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iguana/dpow/dpow_rpc.c b/iguana/dpow/dpow_rpc.c index 5af20160f..abe81b975 100755 --- a/iguana/dpow/dpow_rpc.c +++ b/iguana/dpow/dpow_rpc.c @@ -310,7 +310,7 @@ int32_t dpow_paxpending(struct supernet_info *myinfo,uint8_t *hex,int32_t hexsiz kmdheight = jint(infojson,"notarized"); free_json(infojson); } - if ( (retjson= dpow_MoMoMdata(kmdcoin,bp->srccoin->symbol,kmdheight-11,bp->CCid)) != 0 ) + if ( (retjson= dpow_MoMoMdata(kmdcoin,bp->srccoin->symbol,kmdheight,bp->CCid)) != 0 ) { if ( jstr(retjson,"error") != 0 ) { From b5bce2acc6c8461bc3909726cb43e35488e4a507 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sat, 2 Mar 2019 16:40:36 +0800 Subject: [PATCH 089/167] Change to simply use KMDheight-5 instead of notarized height. --- iguana/dpow/dpow_rpc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/iguana/dpow/dpow_rpc.c b/iguana/dpow/dpow_rpc.c index abe81b975..d243edb13 100755 --- a/iguana/dpow/dpow_rpc.c +++ b/iguana/dpow/dpow_rpc.c @@ -307,10 +307,10 @@ int32_t dpow_paxpending(struct supernet_info *myinfo,uint8_t *hex,int32_t hexsiz kmdcoin = bp->destcoin; if ( (infojson= dpow_getinfo(myinfo,kmdcoin)) != 0 ) { - kmdheight = jint(infojson,"notarized"); + kmdheight = jint(infojson,"blocks"); free_json(infojson); } - if ( (retjson= dpow_MoMoMdata(kmdcoin,bp->srccoin->symbol,kmdheight,bp->CCid)) != 0 ) + if ( (retjson= dpow_MoMoMdata(kmdcoin,bp->srccoin->symbol,kmdheight-5,bp->CCid)) != 0 ) { if ( jstr(retjson,"error") != 0 ) { From 1d5d34b77a90a4dafe11a4e793cd1775823ca69f Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Mon, 4 Mar 2019 14:01:59 +0800 Subject: [PATCH 090/167] revert flat -5, still doesnt work. --- iguana/dpow/dpow_rpc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/iguana/dpow/dpow_rpc.c b/iguana/dpow/dpow_rpc.c index d243edb13..ffda5ff5c 100755 --- a/iguana/dpow/dpow_rpc.c +++ b/iguana/dpow/dpow_rpc.c @@ -302,7 +302,7 @@ int32_t dpow_paxpending(struct supernet_info *myinfo,uint8_t *hex,int32_t hexsiz n += iguana_rwbignum(1,&hex[n],sizeof(MoM),MoM.bytes); MoMdepth = (MoMdepth & 0xffff) | ((uint32_t)CCid<<16); n += iguana_rwnum(1,&hex[n],sizeof(MoMdepth),(uint32_t *)&MoMdepth); - if ( dpow_CCid(myinfo,bp->srccoin) != 0 && src_or_dest == 0 && strcmp(bp->destcoin->symbol,"KMD") == 0 ) //strncmp(bp->srccoin->symbol,"TXSCL",5) == 0 && + if ( dpow_CCid(myinfo,bp->srccoin) > 1 && src_or_dest == 0 && strcmp(bp->destcoin->symbol,"KMD") == 0 ) //strncmp(bp->srccoin->symbol,"TXSCL",5) == 0 && { kmdcoin = bp->destcoin; if ( (infojson= dpow_getinfo(myinfo,kmdcoin)) != 0 ) @@ -310,7 +310,7 @@ int32_t dpow_paxpending(struct supernet_info *myinfo,uint8_t *hex,int32_t hexsiz kmdheight = jint(infojson,"blocks"); free_json(infojson); } - if ( (retjson= dpow_MoMoMdata(kmdcoin,bp->srccoin->symbol,kmdheight-5,bp->CCid)) != 0 ) + if ( (retjson= dpow_MoMoMdata(kmdcoin,bp->srccoin->symbol,kmdheight,bp->CCid)) != 0 ) { if ( jstr(retjson,"error") != 0 ) { From 8df6fbe9db6767f24e5f531d9b4c56acf8d035d6 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Mon, 4 Mar 2019 17:38:59 +0800 Subject: [PATCH 091/167] try check of ppMoM in source. --- iguana/dpow/dpow_rpc.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/iguana/dpow/dpow_rpc.c b/iguana/dpow/dpow_rpc.c index ffda5ff5c..23035665f 100755 --- a/iguana/dpow/dpow_rpc.c +++ b/iguana/dpow/dpow_rpc.c @@ -295,7 +295,7 @@ cJSON *dpow_MoMoMdata(struct iguana_info *coin,char *symbol,int32_t kmdheight,ui int32_t dpow_paxpending(struct supernet_info *myinfo,uint8_t *hex,int32_t hexsize,uint32_t *paxwdcrcp,bits256 MoM,uint32_t MoMdepth,uint16_t CCid,int32_t src_or_dest,struct dpow_block *bp) { - struct iguana_info *coin,*kmdcoin=0; char *retstr,*hexstr; cJSON *retjson,*infojson; int32_t kmdheight=0,hexlen=0,n=0; uint32_t paxwdcrc; + struct iguana_info *coin,*kmdcoin=0; char *retstr,*hexstr; cJSON *retjson,*infojson, *srcinfojson; int32_t kmdheight=0,hexlen=0,n=0,ppMoMheight=0; uint32_t paxwdcrc; paxwdcrc = 0; if ( dpow_smallopreturn(bp->srccoin->symbol) == 0 || src_or_dest != 0 ) { @@ -305,16 +305,19 @@ int32_t dpow_paxpending(struct supernet_info *myinfo,uint8_t *hex,int32_t hexsiz if ( dpow_CCid(myinfo,bp->srccoin) > 1 && src_or_dest == 0 && strcmp(bp->destcoin->symbol,"KMD") == 0 ) //strncmp(bp->srccoin->symbol,"TXSCL",5) == 0 && { kmdcoin = bp->destcoin; + coin = bp->srccoin; if ( (infojson= dpow_getinfo(myinfo,kmdcoin)) != 0 ) { + if ( (srcinfojson= dpow_getinfo(myinfo,coin)) != 0 && jint(srcinfojson,"ppMoMheight") != 0 )) + ppMoMheight = jint(infojson,"ppMoMheight"); kmdheight = jint(infojson,"blocks"); free_json(infojson); } if ( (retjson= dpow_MoMoMdata(kmdcoin,bp->srccoin->symbol,kmdheight,bp->CCid)) != 0 ) { - if ( jstr(retjson,"error") != 0 ) + if ( ppMoMheight != 0 && jstr(retjson,"error") != 0 ) { - // bail out MoMoM is indeterminate + // MoMoM returned NULL when after 2 MoM exist on the chain. free_json(retjson); return(-1); } From 2e562de054092b1d0f204113a9deab0c0277ea72 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Mon, 4 Mar 2019 17:42:05 +0800 Subject: [PATCH 092/167] fix + print --- iguana/dpow/dpow_rpc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/iguana/dpow/dpow_rpc.c b/iguana/dpow/dpow_rpc.c index 23035665f..c238f5677 100755 --- a/iguana/dpow/dpow_rpc.c +++ b/iguana/dpow/dpow_rpc.c @@ -308,13 +308,14 @@ int32_t dpow_paxpending(struct supernet_info *myinfo,uint8_t *hex,int32_t hexsiz coin = bp->srccoin; if ( (infojson= dpow_getinfo(myinfo,kmdcoin)) != 0 ) { - if ( (srcinfojson= dpow_getinfo(myinfo,coin)) != 0 && jint(srcinfojson,"ppMoMheight") != 0 )) + if ( (srcinfojson= dpow_getinfo(myinfo,coin)) != 0 && jint(srcinfojson,"ppMoMheight") != 0 ) ppMoMheight = jint(infojson,"ppMoMheight"); kmdheight = jint(infojson,"blocks"); free_json(infojson); } if ( (retjson= dpow_MoMoMdata(kmdcoin,bp->srccoin->symbol,kmdheight,bp->CCid)) != 0 ) { + printf("ppMoMheight%i\n", ppMoMheight); if ( ppMoMheight != 0 && jstr(retjson,"error") != 0 ) { // MoMoM returned NULL when after 2 MoM exist on the chain. From 2fdd8a97d09b5a202fd4a85224f511330e1e11b8 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Mon, 4 Mar 2019 17:45:37 +0800 Subject: [PATCH 093/167] fix memleak --- iguana/dpow/dpow_rpc.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/iguana/dpow/dpow_rpc.c b/iguana/dpow/dpow_rpc.c index c238f5677..2b8cb488d 100755 --- a/iguana/dpow/dpow_rpc.c +++ b/iguana/dpow/dpow_rpc.c @@ -308,8 +308,12 @@ int32_t dpow_paxpending(struct supernet_info *myinfo,uint8_t *hex,int32_t hexsiz coin = bp->srccoin; if ( (infojson= dpow_getinfo(myinfo,kmdcoin)) != 0 ) { - if ( (srcinfojson= dpow_getinfo(myinfo,coin)) != 0 && jint(srcinfojson,"ppMoMheight") != 0 ) - ppMoMheight = jint(infojson,"ppMoMheight"); + if ( (srcinfojson= dpow_getinfo(myinfo,coin)) != 0 ) + { + if ( jint(srcinfojson,"ppMoMheight") != 0 ) + ppMoMheight = jint(infojson,"ppMoMheight"); + free_json(srcinfojson); + } kmdheight = jint(infojson,"blocks"); free_json(infojson); } From 8e4db7671979f2b6cc116052109edf07c60f4d7f Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Mon, 4 Mar 2019 18:05:06 +0800 Subject: [PATCH 094/167] format --- iguana/dpow/dpow_rpc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iguana/dpow/dpow_rpc.c b/iguana/dpow/dpow_rpc.c index 2b8cb488d..826643d92 100755 --- a/iguana/dpow/dpow_rpc.c +++ b/iguana/dpow/dpow_rpc.c @@ -319,7 +319,7 @@ int32_t dpow_paxpending(struct supernet_info *myinfo,uint8_t *hex,int32_t hexsiz } if ( (retjson= dpow_MoMoMdata(kmdcoin,bp->srccoin->symbol,kmdheight,bp->CCid)) != 0 ) { - printf("ppMoMheight%i\n", ppMoMheight); + printf("ppMoMheight.%i\n", ppMoMheight); if ( ppMoMheight != 0 && jstr(retjson,"error") != 0 ) { // MoMoM returned NULL when after 2 MoM exist on the chain. From b4c9aa777799eaaf1559f691418f42db92c94557 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Mon, 4 Mar 2019 18:36:16 +0800 Subject: [PATCH 095/167] fix --- iguana/dpow/dpow_rpc.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/iguana/dpow/dpow_rpc.c b/iguana/dpow/dpow_rpc.c index 826643d92..839775dfc 100755 --- a/iguana/dpow/dpow_rpc.c +++ b/iguana/dpow/dpow_rpc.c @@ -295,31 +295,31 @@ cJSON *dpow_MoMoMdata(struct iguana_info *coin,char *symbol,int32_t kmdheight,ui int32_t dpow_paxpending(struct supernet_info *myinfo,uint8_t *hex,int32_t hexsize,uint32_t *paxwdcrcp,bits256 MoM,uint32_t MoMdepth,uint16_t CCid,int32_t src_or_dest,struct dpow_block *bp) { - struct iguana_info *coin,*kmdcoin=0; char *retstr,*hexstr; cJSON *retjson,*infojson, *srcinfojson; int32_t kmdheight=0,hexlen=0,n=0,ppMoMheight=0; uint32_t paxwdcrc; - paxwdcrc = 0; + struct iguana_info *coin,*kmdcoin=0; char *retstr,*hexstr; cJSON *retjson,*infojson, *srcinfojson; int32_t kmdheight=0,hexlen=0,n=0,ppMoMheight=0; uint32_t paxwdcrc=0,CCid=0; if ( dpow_smallopreturn(bp->srccoin->symbol) == 0 || src_or_dest != 0 ) { n += iguana_rwbignum(1,&hex[n],sizeof(MoM),MoM.bytes); MoMdepth = (MoMdepth & 0xffff) | ((uint32_t)CCid<<16); n += iguana_rwnum(1,&hex[n],sizeof(MoMdepth),(uint32_t *)&MoMdepth); - if ( dpow_CCid(myinfo,bp->srccoin) > 1 && src_or_dest == 0 && strcmp(bp->destcoin->symbol,"KMD") == 0 ) //strncmp(bp->srccoin->symbol,"TXSCL",5) == 0 && + if ( (srcinfojson= dpow_getinfo(myinfo,bp->srccoin)) != 0 ) + { + CCid = juint(srcinfojson,"CCid"); + if ( CCid > 1 && jint(srcinfojson,"ppMoMheight") != 0 ) + ppMoMheight = jint(srcinfojson,"ppMoMheight"); + free_json(srcinfojson); + printf("ppMoMheight.%i CCid.%i\n", ppMoMheight, CCid); + } + if ( CCid > 1 && src_or_dest == 0 && strcmp(bp->destcoin->symbol,"KMD") == 0 ) //strncmp(bp->srccoin->symbol,"TXSCL",5) == 0 && { kmdcoin = bp->destcoin; coin = bp->srccoin; if ( (infojson= dpow_getinfo(myinfo,kmdcoin)) != 0 ) { - if ( (srcinfojson= dpow_getinfo(myinfo,coin)) != 0 ) - { - if ( jint(srcinfojson,"ppMoMheight") != 0 ) - ppMoMheight = jint(infojson,"ppMoMheight"); - free_json(srcinfojson); - } kmdheight = jint(infojson,"blocks"); free_json(infojson); } if ( (retjson= dpow_MoMoMdata(kmdcoin,bp->srccoin->symbol,kmdheight,bp->CCid)) != 0 ) { - printf("ppMoMheight.%i\n", ppMoMheight); if ( ppMoMheight != 0 && jstr(retjson,"error") != 0 ) { // MoMoM returned NULL when after 2 MoM exist on the chain. From 33b0022401e6fe9d523b6e4936f221ef028968df Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Mon, 4 Mar 2019 18:39:45 +0800 Subject: [PATCH 096/167] fix? --- iguana/dpow/dpow_rpc.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/iguana/dpow/dpow_rpc.c b/iguana/dpow/dpow_rpc.c index 839775dfc..551832f10 100755 --- a/iguana/dpow/dpow_rpc.c +++ b/iguana/dpow/dpow_rpc.c @@ -295,7 +295,7 @@ cJSON *dpow_MoMoMdata(struct iguana_info *coin,char *symbol,int32_t kmdheight,ui int32_t dpow_paxpending(struct supernet_info *myinfo,uint8_t *hex,int32_t hexsize,uint32_t *paxwdcrcp,bits256 MoM,uint32_t MoMdepth,uint16_t CCid,int32_t src_or_dest,struct dpow_block *bp) { - struct iguana_info *coin,*kmdcoin=0; char *retstr,*hexstr; cJSON *retjson,*infojson, *srcinfojson; int32_t kmdheight=0,hexlen=0,n=0,ppMoMheight=0; uint32_t paxwdcrc=0,CCid=0; + struct iguana_info *coin,*kmdcoin=0; char *retstr,*hexstr; cJSON *retjson,*infojson, *srcinfojson; int32_t kmdheight=0,hexlen=0,n=0,ppMoMheight=0; uint32_t paxwdcrc=0,CCid1=0; if ( dpow_smallopreturn(bp->srccoin->symbol) == 0 || src_or_dest != 0 ) { n += iguana_rwbignum(1,&hex[n],sizeof(MoM),MoM.bytes); @@ -303,16 +303,15 @@ int32_t dpow_paxpending(struct supernet_info *myinfo,uint8_t *hex,int32_t hexsiz n += iguana_rwnum(1,&hex[n],sizeof(MoMdepth),(uint32_t *)&MoMdepth); if ( (srcinfojson= dpow_getinfo(myinfo,bp->srccoin)) != 0 ) { - CCid = juint(srcinfojson,"CCid"); - if ( CCid > 1 && jint(srcinfojson,"ppMoMheight") != 0 ) + CCid1 = juint(srcinfojson,"CCid"); + if ( CCid1 > 1 && jint(srcinfojson,"ppMoMheight") != 0 ) ppMoMheight = jint(srcinfojson,"ppMoMheight"); free_json(srcinfojson); printf("ppMoMheight.%i CCid.%i\n", ppMoMheight, CCid); } - if ( CCid > 1 && src_or_dest == 0 && strcmp(bp->destcoin->symbol,"KMD") == 0 ) //strncmp(bp->srccoin->symbol,"TXSCL",5) == 0 && + if ( CCid1 > 1 && src_or_dest == 0 && strcmp(bp->destcoin->symbol,"KMD") == 0 ) //strncmp(bp->srccoin->symbol,"TXSCL",5) == 0 && { kmdcoin = bp->destcoin; - coin = bp->srccoin; if ( (infojson= dpow_getinfo(myinfo,kmdcoin)) != 0 ) { kmdheight = jint(infojson,"blocks"); From 62ba20b35ef35f5c1641260be4e514a0291688ea Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Mon, 4 Mar 2019 18:44:19 +0800 Subject: [PATCH 097/167] try fix --- iguana/dpow/dpow_rpc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/iguana/dpow/dpow_rpc.c b/iguana/dpow/dpow_rpc.c index 551832f10..996556294 100755 --- a/iguana/dpow/dpow_rpc.c +++ b/iguana/dpow/dpow_rpc.c @@ -304,8 +304,8 @@ int32_t dpow_paxpending(struct supernet_info *myinfo,uint8_t *hex,int32_t hexsiz if ( (srcinfojson= dpow_getinfo(myinfo,bp->srccoin)) != 0 ) { CCid1 = juint(srcinfojson,"CCid"); - if ( CCid1 > 1 && jint(srcinfojson,"ppMoMheight") != 0 ) - ppMoMheight = jint(srcinfojson,"ppMoMheight"); + if ( CCid1 > 1 ) + ppMoMheight = juint(srcinfojson,"ppMoMheight"); free_json(srcinfojson); printf("ppMoMheight.%i CCid.%i\n", ppMoMheight, CCid); } From b275805c74d9d66c7c3c3a3c23c87f94b42a26df Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Mon, 4 Mar 2019 18:50:47 +0800 Subject: [PATCH 098/167] what --- iguana/dpow/dpow_rpc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/iguana/dpow/dpow_rpc.c b/iguana/dpow/dpow_rpc.c index 996556294..012c9ca4b 100755 --- a/iguana/dpow/dpow_rpc.c +++ b/iguana/dpow/dpow_rpc.c @@ -305,9 +305,9 @@ int32_t dpow_paxpending(struct supernet_info *myinfo,uint8_t *hex,int32_t hexsiz { CCid1 = juint(srcinfojson,"CCid"); if ( CCid1 > 1 ) - ppMoMheight = juint(srcinfojson,"ppMoMheight"); + ppMoMheight = jint(srcinfojson,"ppMoMheight"); free_json(srcinfojson); - printf("ppMoMheight.%i CCid.%i\n", ppMoMheight, CCid); + printf("ppMoMheight.%i CCid1.%i\n", ppMoMheight, CCid1); } if ( CCid1 > 1 && src_or_dest == 0 && strcmp(bp->destcoin->symbol,"KMD") == 0 ) //strncmp(bp->srccoin->symbol,"TXSCL",5) == 0 && { From c522c7204f4723245f6e75ee52d9fb7f463044b5 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Mon, 4 Mar 2019 18:58:54 +0800 Subject: [PATCH 099/167] hmm wtf why is there 3 CCids being used here lol --- iguana/dpow/dpow_rpc.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/iguana/dpow/dpow_rpc.c b/iguana/dpow/dpow_rpc.c index 012c9ca4b..d0cdd6a4d 100755 --- a/iguana/dpow/dpow_rpc.c +++ b/iguana/dpow/dpow_rpc.c @@ -295,7 +295,7 @@ cJSON *dpow_MoMoMdata(struct iguana_info *coin,char *symbol,int32_t kmdheight,ui int32_t dpow_paxpending(struct supernet_info *myinfo,uint8_t *hex,int32_t hexsize,uint32_t *paxwdcrcp,bits256 MoM,uint32_t MoMdepth,uint16_t CCid,int32_t src_or_dest,struct dpow_block *bp) { - struct iguana_info *coin,*kmdcoin=0; char *retstr,*hexstr; cJSON *retjson,*infojson, *srcinfojson; int32_t kmdheight=0,hexlen=0,n=0,ppMoMheight=0; uint32_t paxwdcrc=0,CCid1=0; + struct iguana_info *coin,*kmdcoin=0; char *retstr,*hexstr; cJSON *retjson,*infojson, *srcinfojson; int32_t kmdheight=0,hexlen=0,n=0,ppMoMheight=0; uint32_t paxwdcrc=0; if ( dpow_smallopreturn(bp->srccoin->symbol) == 0 || src_or_dest != 0 ) { n += iguana_rwbignum(1,&hex[n],sizeof(MoM),MoM.bytes); @@ -303,13 +303,13 @@ int32_t dpow_paxpending(struct supernet_info *myinfo,uint8_t *hex,int32_t hexsiz n += iguana_rwnum(1,&hex[n],sizeof(MoMdepth),(uint32_t *)&MoMdepth); if ( (srcinfojson= dpow_getinfo(myinfo,bp->srccoin)) != 0 ) { - CCid1 = juint(srcinfojson,"CCid"); - if ( CCid1 > 1 ) + CCid = juint(srcinfojson,"CCid"); + if ( CCid > 1 ) ppMoMheight = jint(srcinfojson,"ppMoMheight"); free_json(srcinfojson); - printf("ppMoMheight.%i CCid1.%i\n", ppMoMheight, CCid1); + printf("ppMoMheight.%i CCid.%i\n", ppMoMheight, CCid); } - if ( CCid1 > 1 && src_or_dest == 0 && strcmp(bp->destcoin->symbol,"KMD") == 0 ) //strncmp(bp->srccoin->symbol,"TXSCL",5) == 0 && + if ( CCid > 1 && src_or_dest == 0 && strcmp(bp->destcoin->symbol,"KMD") == 0 ) //strncmp(bp->srccoin->symbol,"TXSCL",5) == 0 && { kmdcoin = bp->destcoin; if ( (infojson= dpow_getinfo(myinfo,kmdcoin)) != 0 ) From 6b82ab4bc8e9fd41966a2c29d7eeea89090dbbea Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Mon, 4 Mar 2019 19:28:24 +0800 Subject: [PATCH 100/167] remove spam print. is now working. --- iguana/dpow/dpow_rpc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iguana/dpow/dpow_rpc.c b/iguana/dpow/dpow_rpc.c index d0cdd6a4d..0f23e7b84 100755 --- a/iguana/dpow/dpow_rpc.c +++ b/iguana/dpow/dpow_rpc.c @@ -307,7 +307,7 @@ int32_t dpow_paxpending(struct supernet_info *myinfo,uint8_t *hex,int32_t hexsiz if ( CCid > 1 ) ppMoMheight = jint(srcinfojson,"ppMoMheight"); free_json(srcinfojson); - printf("ppMoMheight.%i CCid.%i\n", ppMoMheight, CCid); + //printf("ppMoMheight.%i CCid.%i\n", ppMoMheight, CCid); } if ( CCid > 1 && src_or_dest == 0 && strcmp(bp->destcoin->symbol,"KMD") == 0 ) //strncmp(bp->srccoin->symbol,"TXSCL",5) == 0 && { From ca15eea20c38f60c6165afa35c40acc408ce6950 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Wed, 6 Mar 2019 14:59:27 +0800 Subject: [PATCH 101/167] test --- iguana/dpow/dpow_fsm.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/iguana/dpow/dpow_fsm.c b/iguana/dpow/dpow_fsm.c index 6d5abf36f..1174e0cb3 100755 --- a/iguana/dpow/dpow_fsm.c +++ b/iguana/dpow/dpow_fsm.c @@ -564,6 +564,7 @@ void dpow_statemachinestart(void *ptr) else src_or_dest = 1; extralen = dpow_paxpending(myinfo,extras,sizeof(extras),&bp->paxwdcrc,bp->MoM,bp->MoMdepth,bp->CCid,src_or_dest,bp); // if MoMoM is not avalible yet, then stop this round and try again later. + // This might no longer be needed... It can stop notarizations dead if they have not happened for 1440 blocks. if ( extralen == -1 ) break; bp->notaries[bp->myind].paxwdcrc = bp->paxwdcrc; @@ -613,6 +614,29 @@ void dpow_statemachinestart(void *ptr) dp->lastrecvmask = bp->recvmask; dp->ratifying -= bp->isratify; + // If the round was sucessful and both notarizations were created successfully we will make sure they are in the chain. + // We need to wait for notarized confirm here. If the notarization is reorged for any reason we need to rebroadcast it, + // becasue the mempool is stupid after sapling update! + if ( bp->desttxid != 0 ) + fprintf(stderr, "desttxid.%s\n", bits256_str(str,bp->desttxid)); + else + fprintf(stderr, "dest tx was never sent!\n"); + if ( bp->srctxid != 0 ) + fprintf(stderr, "srctxid.%s\n", bits256_str(str,bp->srctxid)); + else + fprintf(stderr, "src tx was never sent!\n"); + while ( 0 ) + { + // dpow_gettransaction will return confirms, unless its not confirmed. + // check here for confirms exists in return JSON, if no confirms, keep rebroadcasting every 60s + // if confirms > 2 exit loop. + + // as a safety, if rawconfirmations > 100 exit this loop. + + // wait for approx one block before checking again. + sleep(60); + } + // unlock the dest utxo on KMD. if ( (strcmp("KMD",dest->symbol) == 0 ) && (ep->dest.prev_vout != -1) ) { From ebe5c310f188694066683072e9a27199c29da0d7 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Wed, 6 Mar 2019 15:01:26 +0800 Subject: [PATCH 102/167] fix --- iguana/dpow/dpow_fsm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/iguana/dpow/dpow_fsm.c b/iguana/dpow/dpow_fsm.c index 1174e0cb3..201d04d35 100755 --- a/iguana/dpow/dpow_fsm.c +++ b/iguana/dpow/dpow_fsm.c @@ -617,11 +617,11 @@ void dpow_statemachinestart(void *ptr) // If the round was sucessful and both notarizations were created successfully we will make sure they are in the chain. // We need to wait for notarized confirm here. If the notarization is reorged for any reason we need to rebroadcast it, // becasue the mempool is stupid after sapling update! - if ( bp->desttxid != 0 ) + if ( bp->desttxid != zero ) fprintf(stderr, "desttxid.%s\n", bits256_str(str,bp->desttxid)); else fprintf(stderr, "dest tx was never sent!\n"); - if ( bp->srctxid != 0 ) + if ( bp->srctxid != zero ) fprintf(stderr, "srctxid.%s\n", bits256_str(str,bp->srctxid)); else fprintf(stderr, "src tx was never sent!\n"); From d9be48d2b0b2ad762f4dfe3c605fa66b35c5df09 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Wed, 6 Mar 2019 15:05:49 +0800 Subject: [PATCH 103/167] fix --- iguana/dpow/dpow_fsm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/iguana/dpow/dpow_fsm.c b/iguana/dpow/dpow_fsm.c index 201d04d35..ac75e9478 100755 --- a/iguana/dpow/dpow_fsm.c +++ b/iguana/dpow/dpow_fsm.c @@ -617,11 +617,11 @@ void dpow_statemachinestart(void *ptr) // If the round was sucessful and both notarizations were created successfully we will make sure they are in the chain. // We need to wait for notarized confirm here. If the notarization is reorged for any reason we need to rebroadcast it, // becasue the mempool is stupid after sapling update! - if ( bp->desttxid != zero ) + if ( bits256_cmp(bp->desttxid,zero) == 0 ) fprintf(stderr, "desttxid.%s\n", bits256_str(str,bp->desttxid)); else fprintf(stderr, "dest tx was never sent!\n"); - if ( bp->srctxid != zero ) + if ( bits256_cmp(bp->srctxid,zero) == 0 ) fprintf(stderr, "srctxid.%s\n", bits256_str(str,bp->srctxid)); else fprintf(stderr, "src tx was never sent!\n"); From 3d0e9c1efd824164088159681fd45981c6776bb1 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Wed, 6 Mar 2019 15:16:33 +0800 Subject: [PATCH 104/167] test --- iguana/dpow/dpow_fsm.c | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/iguana/dpow/dpow_fsm.c b/iguana/dpow/dpow_fsm.c index ac75e9478..11eaece9a 100755 --- a/iguana/dpow/dpow_fsm.c +++ b/iguana/dpow/dpow_fsm.c @@ -614,19 +614,25 @@ void dpow_statemachinestart(void *ptr) dp->lastrecvmask = bp->recvmask; dp->ratifying -= bp->isratify; - // If the round was sucessful and both notarizations were created successfully we will make sure they are in the chain. // We need to wait for notarized confirm here. If the notarization is reorged for any reason we need to rebroadcast it, - // becasue the mempool is stupid after sapling update! - if ( bits256_cmp(bp->desttxid,zero) == 0 ) - fprintf(stderr, "desttxid.%s\n", bits256_str(str,bp->desttxid)); - else - fprintf(stderr, "dest tx was never sent!\n"); - if ( bits256_cmp(bp->srctxid,zero) == 0 ) - fprintf(stderr, "srctxid.%s\n", bits256_str(str,bp->srctxid)); - else - fprintf(stderr, "src tx was never sent!\n"); - while ( 0 ) + // becasue the mempool is stupid after the sapling update! + while ( 1 ) { + // If the round was sucessful and both notarizations were created successfully we will make sure they are in the chain. + if ( bits256_cmp(bp->desttxid,zero) == 0 ) + { + fprintf(stderr, "dest tx was never sent!\n"); + break; + } + else + fprintf(stderr, "desttxid.%s\n", bits256_str(str,bp->desttxid)); + if ( bits256_cmp(bp->srctxid,zero) == 0 ) + { + fprintf(stderr, "src tx was never sent!\n"); + break; + } + else + fprintf(stderr, "srctxid.%s\n", bits256_str(str,bp->srctxid)); // dpow_gettransaction will return confirms, unless its not confirmed. // check here for confirms exists in return JSON, if no confirms, keep rebroadcasting every 60s // if confirms > 2 exit loop. @@ -635,6 +641,7 @@ void dpow_statemachinestart(void *ptr) // wait for approx one block before checking again. sleep(60); + break; // remove this later! } // unlock the dest utxo on KMD. From 35cb09de9c549398bfb3d0f28872f96d62006809 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Wed, 6 Mar 2019 16:02:49 +0800 Subject: [PATCH 105/167] test --- iguana/dpow/dpow_fsm.c | 43 +++++++++++++++++++++++++++++------------- iguana/dpow/dpow_rpc.c | 17 +++++++++++++++++ 2 files changed, 47 insertions(+), 13 deletions(-) diff --git a/iguana/dpow/dpow_fsm.c b/iguana/dpow/dpow_fsm.c index 11eaece9a..98524ed62 100755 --- a/iguana/dpow/dpow_fsm.c +++ b/iguana/dpow/dpow_fsm.c @@ -616,32 +616,49 @@ void dpow_statemachinestart(void *ptr) // We need to wait for notarized confirm here. If the notarization is reorged for any reason we need to rebroadcast it, // becasue the mempool is stupid after the sapling update! + int8_t dest_confs = 0, src_confs = 0; + bool destnotarized = false, srcnotarized = false; while ( 1 ) { // If the round was sucessful and both notarizations were created successfully we will make sure they are in the chain. if ( bits256_cmp(bp->desttxid,zero) == 0 ) - { - fprintf(stderr, "dest tx was never sent!\n"); break; - } - else - fprintf(stderr, "desttxid.%s\n", bits256_str(str,bp->desttxid)); if ( bits256_cmp(bp->srctxid,zero) == 0 ) - { - fprintf(stderr, "src tx was never sent!\n"); break; - } - else - fprintf(stderr, "srctxid.%s\n", bits256_str(str,bp->srctxid)); - // dpow_gettransaction will return confirms, unless its not confirmed. - // check here for confirms exists in return JSON, if no confirms, keep rebroadcasting every 60s + + // get the confirms for desttxid + if ( !destnotarized && (dest_confs= dpow_txconfirms(myinfo, bp->destcoin, bp->desttxid)) != -1 ) + { + if ( dest_confs > 2 ) + { + // tx is notarized. or it has 100+ raw confirms. + fprintf(stderr, "[%s] txid.%s is notarized or has 100 confirms \n",bp->dest, bits256_str(str,bp->desttxid)); + destnotarized = true; + } + else if ( dest_confs = 0 ) + { + // not confirmed, rebroadcast it. + fprintf(stderr, "[%s] txid.%s is not confirmed at all rebroadcasting.... \n",bp->dest, bits256_str(str,bp->desttxid)); + } + } else fprintf(stderr, "[%s] txid.%s returned error for txconfirms",bp->dest, bits256_str(str,bp->desttxid)); + + // get the confirms for srctxid + /*if ( (src_confs= dpow_txconfirms(myinfo, bp->srccoin, bp->srctxid)) != -1 ) + { + if ( dest_confs > 2 ) + { + // tx is notarized. or it has 100+ raw confirms. + fprintf(stderr, "[%s] txid.%s is notarized or has 100 confirms \n",bp->symbol, bits256_str(str,bp->srctxid)); + } + } */ + // check here for confirms exists in return JSON, if no confirms, keep rebroadcasting. // if confirms > 2 exit loop. // as a safety, if rawconfirmations > 100 exit this loop. // wait for approx one block before checking again. sleep(60); - break; // remove this later! + if ( destnotarized == true ) break; } // unlock the dest utxo on KMD. diff --git a/iguana/dpow/dpow_rpc.c b/iguana/dpow/dpow_rpc.c index 0f23e7b84..4ca46839e 100755 --- a/iguana/dpow/dpow_rpc.c +++ b/iguana/dpow/dpow_rpc.c @@ -541,6 +541,23 @@ char *dpow_decoderawtransaction(struct supernet_info *myinfo,struct iguana_info return(retstr); } +int32_t dpow_txconfirms(struct supernet_info *myinfo,struct iguana_info *coin,bits256 txid) +{ + cJSON *txobj; int32_t confirms = 0; + if ( (txobj= dpow_gettransaction(myinfo, coin, txid)) != 0 ) + { + if ( (confirms= juint(txobj, "confirmations")) != 0 ) + { + return(confirms); + } + else if ( confirms == 1 && juint(txobj, "rawconfirmations") > 100 ) + return(100); + else + return(0); + } + return(-1); +} + cJSON *dpow_gettransaction(struct supernet_info *myinfo,struct iguana_info *coin,bits256 txid) { char buf[128],str[65],*retstr=0; cJSON *json = 0; From 143ad40db68196600b0c81558f219a445176b38f Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Wed, 6 Mar 2019 16:05:27 +0800 Subject: [PATCH 106/167] fix --- iguana/dpow/dpow_fsm.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/iguana/dpow/dpow_fsm.c b/iguana/dpow/dpow_fsm.c index 98524ed62..b160a75a0 100755 --- a/iguana/dpow/dpow_fsm.c +++ b/iguana/dpow/dpow_fsm.c @@ -616,8 +616,7 @@ void dpow_statemachinestart(void *ptr) // We need to wait for notarized confirm here. If the notarization is reorged for any reason we need to rebroadcast it, // becasue the mempool is stupid after the sapling update! - int8_t dest_confs = 0, src_confs = 0; - bool destnotarized = false, srcnotarized = false; + int8_t dest_confs = 0, src_confs = 0, destnotarized = 0, srcnotarized = 0; while ( 1 ) { // If the round was sucessful and both notarizations were created successfully we will make sure they are in the chain. @@ -627,15 +626,15 @@ void dpow_statemachinestart(void *ptr) break; // get the confirms for desttxid - if ( !destnotarized && (dest_confs= dpow_txconfirms(myinfo, bp->destcoin, bp->desttxid)) != -1 ) + if ( destnotarized == 0 && (dest_confs= dpow_txconfirms(myinfo, bp->destcoin, bp->desttxid)) != -1 ) { if ( dest_confs > 2 ) { // tx is notarized. or it has 100+ raw confirms. fprintf(stderr, "[%s] txid.%s is notarized or has 100 confirms \n",bp->dest, bits256_str(str,bp->desttxid)); - destnotarized = true; + destnotarized = 1; } - else if ( dest_confs = 0 ) + else if ( dest_confs == 0 ) { // not confirmed, rebroadcast it. fprintf(stderr, "[%s] txid.%s is not confirmed at all rebroadcasting.... \n",bp->dest, bits256_str(str,bp->desttxid)); @@ -658,7 +657,7 @@ void dpow_statemachinestart(void *ptr) // wait for approx one block before checking again. sleep(60); - if ( destnotarized == true ) break; + if ( destnotarized != 0 ) break; } // unlock the dest utxo on KMD. From 7bb9f7389c94d6569842015692bd22af120eed30 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Wed, 6 Mar 2019 16:07:26 +0800 Subject: [PATCH 107/167] fix --- iguana/dpow/dpow_fsm.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/iguana/dpow/dpow_fsm.c b/iguana/dpow/dpow_fsm.c index b160a75a0..96578678c 100755 --- a/iguana/dpow/dpow_fsm.c +++ b/iguana/dpow/dpow_fsm.c @@ -631,15 +631,15 @@ void dpow_statemachinestart(void *ptr) if ( dest_confs > 2 ) { // tx is notarized. or it has 100+ raw confirms. - fprintf(stderr, "[%s] txid.%s is notarized or has 100 confirms \n",bp->dest, bits256_str(str,bp->desttxid)); + fprintf(stderr, "[%s] txid.%s is notarized or has 100 confirms \n",dp->dest, bits256_str(str,bp->desttxid)); destnotarized = 1; } else if ( dest_confs == 0 ) { // not confirmed, rebroadcast it. - fprintf(stderr, "[%s] txid.%s is not confirmed at all rebroadcasting.... \n",bp->dest, bits256_str(str,bp->desttxid)); + fprintf(stderr, "[%s] txid.%s is not confirmed at all rebroadcasting.... \n",dp->dest, bits256_str(str,bp->desttxid)); } - } else fprintf(stderr, "[%s] txid.%s returned error for txconfirms",bp->dest, bits256_str(str,bp->desttxid)); + } else fprintf(stderr, "[%s] txid.%s returned error for txconfirms",dp->dest, bits256_str(str,bp->desttxid)); // get the confirms for srctxid /*if ( (src_confs= dpow_txconfirms(myinfo, bp->srccoin, bp->srctxid)) != -1 ) From dbb45906183bcba0c5b5d2afb663637dd99d86af Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Wed, 6 Mar 2019 16:44:26 +0800 Subject: [PATCH 108/167] test --- iguana/dpow/dpow_fsm.c | 20 +++++++++++--------- iguana/dpow/dpow_rpc.c | 18 ++++++++++-------- 2 files changed, 21 insertions(+), 17 deletions(-) diff --git a/iguana/dpow/dpow_fsm.c b/iguana/dpow/dpow_fsm.c index 96578678c..d199667cd 100755 --- a/iguana/dpow/dpow_fsm.c +++ b/iguana/dpow/dpow_fsm.c @@ -615,18 +615,19 @@ void dpow_statemachinestart(void *ptr) dp->ratifying -= bp->isratify; // We need to wait for notarized confirm here. If the notarization is reorged for any reason we need to rebroadcast it, - // becasue the mempool is stupid after the sapling update! + // because the mempool is stupid after the sapling update, or Alright might be playing silly games. int8_t dest_confs = 0, src_confs = 0, destnotarized = 0, srcnotarized = 0; + char desttx[32768],srctx[32768]; char *retstr=0; while ( 1 ) { // If the round was sucessful and both notarizations were created successfully we will make sure they are in the chain. if ( bits256_cmp(bp->desttxid,zero) == 0 ) break; - if ( bits256_cmp(bp->srctxid,zero) == 0 ) + if ( bits256_cmp(bp->srctxid,zero) == 0 ) break; // get the confirms for desttxid - if ( destnotarized == 0 && (dest_confs= dpow_txconfirms(myinfo, bp->destcoin, bp->desttxid)) != -1 ) + if ( destnotarized == 0 && (dest_confs= dpow_txconfirms(myinfo, bp->destcoin, bp->desttxid, &desttx)) != -1 ) { if ( dest_confs > 2 ) { @@ -637,7 +638,12 @@ void dpow_statemachinestart(void *ptr) else if ( dest_confs == 0 ) { // not confirmed, rebroadcast it. - fprintf(stderr, "[%s] txid.%s is not confirmed at all rebroadcasting.... \n",dp->dest, bits256_str(str,bp->desttxid)); + fprintf(stderr, "[%s] txid.%s is not confirmed rebroadcasting.... \n tx.%s",dp->dest, bits256_str(str,bp->desttxid), desttx); + if ( desttx[0] != 0 ) + { + if ( dpow_sendrawtransaction(myinfo, bp->destcoin, desttx) == 0 ) + fprintf(stderr, "rebroadcast failed!\n"); + } } } else fprintf(stderr, "[%s] txid.%s returned error for txconfirms",dp->dest, bits256_str(str,bp->desttxid)); @@ -650,13 +656,9 @@ void dpow_statemachinestart(void *ptr) fprintf(stderr, "[%s] txid.%s is notarized or has 100 confirms \n",bp->symbol, bits256_str(str,bp->srctxid)); } } */ - // check here for confirms exists in return JSON, if no confirms, keep rebroadcasting. - // if confirms > 2 exit loop. - - // as a safety, if rawconfirmations > 100 exit this loop. // wait for approx one block before checking again. - sleep(60); + sleep(30); if ( destnotarized != 0 ) break; } diff --git a/iguana/dpow/dpow_rpc.c b/iguana/dpow/dpow_rpc.c index 4ca46839e..a763344dc 100755 --- a/iguana/dpow/dpow_rpc.c +++ b/iguana/dpow/dpow_rpc.c @@ -541,24 +541,26 @@ char *dpow_decoderawtransaction(struct supernet_info *myinfo,struct iguana_info return(retstr); } -int32_t dpow_txconfirms(struct supernet_info *myinfo,struct iguana_info *coin,bits256 txid) +int32_t dpow_txconfirms(struct supernet_info *myinfo,struct iguana_info *coin,bits256 txid, char *rawtx) { - cJSON *txobj; int32_t confirms = 0; + cJSON *txobj; int32_t confirms = 0, ret = 0; if ( (txobj= dpow_gettransaction(myinfo, coin, txid)) != 0 ) { + rawtx= jstr(txobj, "hex")); if ( (confirms= juint(txobj, "confirmations")) != 0 ) { - return(confirms); + ret = confirms; } else if ( confirms == 1 && juint(txobj, "rawconfirmations") > 100 ) - return(100); + ret = 100; else - return(0); - } - return(-1); + ret = 0; + } else ret = -1; + free_json(txobj); + return(ret); } -cJSON *dpow_gettransaction(struct supernet_info *myinfo,struct iguana_info *coin,bits256 txid) +cJSON *dpow_gettransaction(struct supernet_info *myinfo,struct iguana_info *coin,bits256 txid, ) { char buf[128],str[65],*retstr=0; cJSON *json = 0; if ( coin->FULLNODE < 0 ) From c29abc84ddcd66b52dc9ed22f52afb277772386c Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Wed, 6 Mar 2019 16:46:26 +0800 Subject: [PATCH 109/167] fix --- iguana/dpow/dpow_rpc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iguana/dpow/dpow_rpc.c b/iguana/dpow/dpow_rpc.c index a763344dc..d5b9433a7 100755 --- a/iguana/dpow/dpow_rpc.c +++ b/iguana/dpow/dpow_rpc.c @@ -560,7 +560,7 @@ int32_t dpow_txconfirms(struct supernet_info *myinfo,struct iguana_info *coin,bi return(ret); } -cJSON *dpow_gettransaction(struct supernet_info *myinfo,struct iguana_info *coin,bits256 txid, ) +cJSON *dpow_gettransaction(struct supernet_info *myinfo,struct iguana_info *coin,bits256 txid) { char buf[128],str[65],*retstr=0; cJSON *json = 0; if ( coin->FULLNODE < 0 ) From f84e0350b76dc92e2cde71a21a57d0606ff4da39 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Wed, 6 Mar 2019 16:46:57 +0800 Subject: [PATCH 110/167] fix --- iguana/dpow/dpow_rpc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iguana/dpow/dpow_rpc.c b/iguana/dpow/dpow_rpc.c index d5b9433a7..011b18738 100755 --- a/iguana/dpow/dpow_rpc.c +++ b/iguana/dpow/dpow_rpc.c @@ -546,7 +546,7 @@ int32_t dpow_txconfirms(struct supernet_info *myinfo,struct iguana_info *coin,bi cJSON *txobj; int32_t confirms = 0, ret = 0; if ( (txobj= dpow_gettransaction(myinfo, coin, txid)) != 0 ) { - rawtx= jstr(txobj, "hex")); + rawtx= jstr(txobj, "hex"); if ( (confirms= juint(txobj, "confirmations")) != 0 ) { ret = confirms; From 5ae2d739c1007eefd365e442f6436bfec0cb1bcd Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Wed, 6 Mar 2019 16:51:16 +0800 Subject: [PATCH 111/167] try --- iguana/dpow/dpow_fsm.c | 4 ++-- iguana/dpow/dpow_rpc.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/iguana/dpow/dpow_fsm.c b/iguana/dpow/dpow_fsm.c index d199667cd..c4e424af0 100755 --- a/iguana/dpow/dpow_fsm.c +++ b/iguana/dpow/dpow_fsm.c @@ -617,7 +617,7 @@ void dpow_statemachinestart(void *ptr) // We need to wait for notarized confirm here. If the notarization is reorged for any reason we need to rebroadcast it, // because the mempool is stupid after the sapling update, or Alright might be playing silly games. int8_t dest_confs = 0, src_confs = 0, destnotarized = 0, srcnotarized = 0; - char desttx[32768],srctx[32768]; char *retstr=0; + char desttx[32768],srctx[32768],rettx[32768]; char *retstr=0; while ( 1 ) { // If the round was sucessful and both notarizations were created successfully we will make sure they are in the chain. @@ -627,7 +627,7 @@ void dpow_statemachinestart(void *ptr) break; // get the confirms for desttxid - if ( destnotarized == 0 && (dest_confs= dpow_txconfirms(myinfo, bp->destcoin, bp->desttxid, &desttx)) != -1 ) + if ( destnotarized == 0 && (dest_confs= dpow_txconfirms(myinfo, bp->destcoin, bp->desttxid, rettx)) != -1 ) { if ( dest_confs > 2 ) { diff --git a/iguana/dpow/dpow_rpc.c b/iguana/dpow/dpow_rpc.c index 011b18738..456ac3fc8 100755 --- a/iguana/dpow/dpow_rpc.c +++ b/iguana/dpow/dpow_rpc.c @@ -546,7 +546,7 @@ int32_t dpow_txconfirms(struct supernet_info *myinfo,struct iguana_info *coin,bi cJSON *txobj; int32_t confirms = 0, ret = 0; if ( (txobj= dpow_gettransaction(myinfo, coin, txid)) != 0 ) { - rawtx= jstr(txobj, "hex"); + *rawtx= jstr(txobj, "hex"); if ( (confirms= juint(txobj, "confirmations")) != 0 ) { ret = confirms; From 480fc8916f98649fe3969f8f306fe35a64ff996a Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Wed, 6 Mar 2019 16:51:34 +0800 Subject: [PATCH 112/167] try --- iguana/dpow/dpow_fsm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iguana/dpow/dpow_fsm.c b/iguana/dpow/dpow_fsm.c index c4e424af0..d2e133755 100755 --- a/iguana/dpow/dpow_fsm.c +++ b/iguana/dpow/dpow_fsm.c @@ -638,7 +638,7 @@ void dpow_statemachinestart(void *ptr) else if ( dest_confs == 0 ) { // not confirmed, rebroadcast it. - fprintf(stderr, "[%s] txid.%s is not confirmed rebroadcasting.... \n tx.%s",dp->dest, bits256_str(str,bp->desttxid), desttx); + fprintf(stderr, "[%s] txid.%s is not confirmed rebroadcasting.... \n tx.%s",dp->dest, bits256_str(str,bp->desttxid), rettx); if ( desttx[0] != 0 ) { if ( dpow_sendrawtransaction(myinfo, bp->destcoin, desttx) == 0 ) From 7d0cbddf350ac4855bafb40ff10bcce87601230c Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Wed, 6 Mar 2019 16:52:49 +0800 Subject: [PATCH 113/167] try --- iguana/dpow/dpow_rpc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iguana/dpow/dpow_rpc.c b/iguana/dpow/dpow_rpc.c index 456ac3fc8..011b18738 100755 --- a/iguana/dpow/dpow_rpc.c +++ b/iguana/dpow/dpow_rpc.c @@ -546,7 +546,7 @@ int32_t dpow_txconfirms(struct supernet_info *myinfo,struct iguana_info *coin,bi cJSON *txobj; int32_t confirms = 0, ret = 0; if ( (txobj= dpow_gettransaction(myinfo, coin, txid)) != 0 ) { - *rawtx= jstr(txobj, "hex"); + rawtx= jstr(txobj, "hex"); if ( (confirms= juint(txobj, "confirmations")) != 0 ) { ret = confirms; From a7a95d8233a8650845e37b19dbcbf45b22cf588b Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Wed, 6 Mar 2019 17:30:09 +0800 Subject: [PATCH 114/167] try --- iguana/dpow/dpow_fsm.c | 19 ++++++++----------- iguana/dpow/dpow_rpc.c | 2 +- 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/iguana/dpow/dpow_fsm.c b/iguana/dpow/dpow_fsm.c index d2e133755..0a020bedc 100755 --- a/iguana/dpow/dpow_fsm.c +++ b/iguana/dpow/dpow_fsm.c @@ -629,33 +629,30 @@ void dpow_statemachinestart(void *ptr) // get the confirms for desttxid if ( destnotarized == 0 && (dest_confs= dpow_txconfirms(myinfo, bp->destcoin, bp->desttxid, rettx)) != -1 ) { + if ( desttx[0] == 0 ) + { + strcpy(rettx,desttx); + fprintf(stderr, "desttx.%s\n", desttx); + } if ( dest_confs > 2 ) { // tx is notarized. or it has 100+ raw confirms. - fprintf(stderr, "[%s] txid.%s is notarized or has 100 confirms \n",dp->dest, bits256_str(str,bp->desttxid)); + fprintf(stderr, "[%s] txid.%s is notarized or has 100 confirms\n",dp->dest, bits256_str(str,bp->desttxid)); destnotarized = 1; } else if ( dest_confs == 0 ) { // not confirmed, rebroadcast it. - fprintf(stderr, "[%s] txid.%s is not confirmed rebroadcasting.... \n tx.%s",dp->dest, bits256_str(str,bp->desttxid), rettx); + fprintf(stderr, "[%s] txid.%s is not confirmed rebroadcasting....\n tx.%s",dp->dest, bits256_str(str,bp->desttxid), desttx); if ( desttx[0] != 0 ) { if ( dpow_sendrawtransaction(myinfo, bp->destcoin, desttx) == 0 ) fprintf(stderr, "rebroadcast failed!\n"); } } - } else fprintf(stderr, "[%s] txid.%s returned error for txconfirms",dp->dest, bits256_str(str,bp->desttxid)); + } else fprintf(stderr, "[%s] txid.%s returned error for dpow_txconfirms",dp->dest, bits256_str(str,bp->desttxid)); // get the confirms for srctxid - /*if ( (src_confs= dpow_txconfirms(myinfo, bp->srccoin, bp->srctxid)) != -1 ) - { - if ( dest_confs > 2 ) - { - // tx is notarized. or it has 100+ raw confirms. - fprintf(stderr, "[%s] txid.%s is notarized or has 100 confirms \n",bp->symbol, bits256_str(str,bp->srctxid)); - } - } */ // wait for approx one block before checking again. sleep(30); diff --git a/iguana/dpow/dpow_rpc.c b/iguana/dpow/dpow_rpc.c index 011b18738..274688d6a 100755 --- a/iguana/dpow/dpow_rpc.c +++ b/iguana/dpow/dpow_rpc.c @@ -546,7 +546,7 @@ int32_t dpow_txconfirms(struct supernet_info *myinfo,struct iguana_info *coin,bi cJSON *txobj; int32_t confirms = 0, ret = 0; if ( (txobj= dpow_gettransaction(myinfo, coin, txid)) != 0 ) { - rawtx= jstr(txobj, "hex"); + memcpy(rawtx, jstr(txobj, "hex"), sizeof(jstr(txobj, "hex")+1); if ( (confirms= juint(txobj, "confirmations")) != 0 ) { ret = confirms; From c80bbad987cdee77d70dab1fcea73607355628a4 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Wed, 6 Mar 2019 17:30:40 +0800 Subject: [PATCH 115/167] fix --- iguana/dpow/dpow_fsm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iguana/dpow/dpow_fsm.c b/iguana/dpow/dpow_fsm.c index 0a020bedc..63280871c 100755 --- a/iguana/dpow/dpow_fsm.c +++ b/iguana/dpow/dpow_fsm.c @@ -629,7 +629,7 @@ void dpow_statemachinestart(void *ptr) // get the confirms for desttxid if ( destnotarized == 0 && (dest_confs= dpow_txconfirms(myinfo, bp->destcoin, bp->desttxid, rettx)) != -1 ) { - if ( desttx[0] == 0 ) + if ( desttx[0] == 0 && rettx[0] != 0 ) { strcpy(rettx,desttx); fprintf(stderr, "desttx.%s\n", desttx); From a70c16cbef8f2c9ad1f011b0cf27ed24eb5c38d9 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Wed, 6 Mar 2019 17:32:06 +0800 Subject: [PATCH 116/167] fix --- iguana/dpow/dpow_fsm.c | 1 + iguana/dpow/dpow_rpc.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/iguana/dpow/dpow_fsm.c b/iguana/dpow/dpow_fsm.c index 63280871c..17795c325 100755 --- a/iguana/dpow/dpow_fsm.c +++ b/iguana/dpow/dpow_fsm.c @@ -629,6 +629,7 @@ void dpow_statemachinestart(void *ptr) // get the confirms for desttxid if ( destnotarized == 0 && (dest_confs= dpow_txconfirms(myinfo, bp->destcoin, bp->desttxid, rettx)) != -1 ) { + fprintf(stderr, "rettx.%s\n", rettx); if ( desttx[0] == 0 && rettx[0] != 0 ) { strcpy(rettx,desttx); diff --git a/iguana/dpow/dpow_rpc.c b/iguana/dpow/dpow_rpc.c index 274688d6a..5c2c82731 100755 --- a/iguana/dpow/dpow_rpc.c +++ b/iguana/dpow/dpow_rpc.c @@ -546,7 +546,7 @@ int32_t dpow_txconfirms(struct supernet_info *myinfo,struct iguana_info *coin,bi cJSON *txobj; int32_t confirms = 0, ret = 0; if ( (txobj= dpow_gettransaction(myinfo, coin, txid)) != 0 ) { - memcpy(rawtx, jstr(txobj, "hex"), sizeof(jstr(txobj, "hex")+1); + memcpy(rawtx, jstr(txobj, "hex"), strlen(jstr(txobj, "hex"))+1); if ( (confirms= juint(txobj, "confirmations")) != 0 ) { ret = confirms; From ccda92e4af8e07b05bf817a4b4037b294b759f6f Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Wed, 6 Mar 2019 17:40:49 +0800 Subject: [PATCH 117/167] fix --- iguana/dpow/dpow_fsm.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/iguana/dpow/dpow_fsm.c b/iguana/dpow/dpow_fsm.c index 17795c325..bc7832df1 100755 --- a/iguana/dpow/dpow_fsm.c +++ b/iguana/dpow/dpow_fsm.c @@ -632,13 +632,13 @@ void dpow_statemachinestart(void *ptr) fprintf(stderr, "rettx.%s\n", rettx); if ( desttx[0] == 0 && rettx[0] != 0 ) { - strcpy(rettx,desttx); + memcpy(desttx, rettx, strlen(rettx)+1); fprintf(stderr, "desttx.%s\n", desttx); } if ( dest_confs > 2 ) { - // tx is notarized. or it has 100+ raw confirms. - fprintf(stderr, "[%s] txid.%s is notarized or has 100 confirms\n",dp->dest, bits256_str(str,bp->desttxid)); + // tx is notarized. or it has 100+ raw confirms. Its now final and cannot be lost! + fprintf(stderr, "[%s] txid.%s is notarized or has 100 confirms.%i\n",dp->dest, bits256_str(str,bp->desttxid, dest_confs)); destnotarized = 1; } else if ( dest_confs == 0 ) From d655586e1cff3ab19d9ba4ca10263850542b1c90 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Wed, 6 Mar 2019 17:47:45 +0800 Subject: [PATCH 118/167] try --- iguana/dpow/dpow_fsm.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/iguana/dpow/dpow_fsm.c b/iguana/dpow/dpow_fsm.c index bc7832df1..6017580b4 100755 --- a/iguana/dpow/dpow_fsm.c +++ b/iguana/dpow/dpow_fsm.c @@ -616,7 +616,7 @@ void dpow_statemachinestart(void *ptr) // We need to wait for notarized confirm here. If the notarization is reorged for any reason we need to rebroadcast it, // because the mempool is stupid after the sapling update, or Alright might be playing silly games. - int8_t dest_confs = 0, src_confs = 0, destnotarized = 0, srcnotarized = 0; + int8_t dest_confs = 0, src_confs = 0, destnotarized = 0, srcnotarized = 0, send_dest = 0, send_src = 0; char desttx[32768],srctx[32768],rettx[32768]; char *retstr=0; while ( 1 ) { @@ -629,7 +629,6 @@ void dpow_statemachinestart(void *ptr) // get the confirms for desttxid if ( destnotarized == 0 && (dest_confs= dpow_txconfirms(myinfo, bp->destcoin, bp->desttxid, rettx)) != -1 ) { - fprintf(stderr, "rettx.%s\n", rettx); if ( desttx[0] == 0 && rettx[0] != 0 ) { memcpy(desttx, rettx, strlen(rettx)+1); @@ -646,12 +645,14 @@ void dpow_statemachinestart(void *ptr) // not confirmed, rebroadcast it. fprintf(stderr, "[%s] txid.%s is not confirmed rebroadcasting....\n tx.%s",dp->dest, bits256_str(str,bp->desttxid), desttx); if ( desttx[0] != 0 ) - { - if ( dpow_sendrawtransaction(myinfo, bp->destcoin, desttx) == 0 ) - fprintf(stderr, "rebroadcast failed!\n"); - } + send_dest = 1; } - } else fprintf(stderr, "[%s] txid.%s returned error for dpow_txconfirms",dp->dest, bits256_str(str,bp->desttxid)); + } + else if ( desttx[0] != 0 ) // we have the tranxation hex saved, and the tx is not in the local mempool or a block, so resend it. + send_dest = 1; + if ( send_dest == 1 && dpow_sendrawtransaction(myinfo, bp->destcoin, desttx) == 0 ) + fprintf(stderr, "rebroadcast failed!\n"); + // get the confirms for srctxid From 14301b6b2f9efa27786ec513b77e652e9402e0eb Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Wed, 6 Mar 2019 17:59:17 +0800 Subject: [PATCH 119/167] fix --- iguana/dpow/dpow_fsm.c | 3 +-- iguana/dpow/dpow_rpc.c | 2 -- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/iguana/dpow/dpow_fsm.c b/iguana/dpow/dpow_fsm.c index 6017580b4..75ae189a3 100755 --- a/iguana/dpow/dpow_fsm.c +++ b/iguana/dpow/dpow_fsm.c @@ -637,7 +637,7 @@ void dpow_statemachinestart(void *ptr) if ( dest_confs > 2 ) { // tx is notarized. or it has 100+ raw confirms. Its now final and cannot be lost! - fprintf(stderr, "[%s] txid.%s is notarized or has 100 confirms.%i\n",dp->dest, bits256_str(str,bp->desttxid, dest_confs)); + fprintf(stderr, "[%s] txid.%s is notarized or has 100 confirms.%d\n",dp->dest, bits256_str(str,bp->desttxid, dest_confs)); destnotarized = 1; } else if ( dest_confs == 0 ) @@ -653,7 +653,6 @@ void dpow_statemachinestart(void *ptr) if ( send_dest == 1 && dpow_sendrawtransaction(myinfo, bp->destcoin, desttx) == 0 ) fprintf(stderr, "rebroadcast failed!\n"); - // get the confirms for srctxid // wait for approx one block before checking again. diff --git a/iguana/dpow/dpow_rpc.c b/iguana/dpow/dpow_rpc.c index 5c2c82731..79ebe9962 100755 --- a/iguana/dpow/dpow_rpc.c +++ b/iguana/dpow/dpow_rpc.c @@ -548,9 +548,7 @@ int32_t dpow_txconfirms(struct supernet_info *myinfo,struct iguana_info *coin,bi { memcpy(rawtx, jstr(txobj, "hex"), strlen(jstr(txobj, "hex"))+1); if ( (confirms= juint(txobj, "confirmations")) != 0 ) - { ret = confirms; - } else if ( confirms == 1 && juint(txobj, "rawconfirmations") > 100 ) ret = 100; else From 5bf45055229e7b51a0b6810a20e76e69df08bb50 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Wed, 6 Mar 2019 18:03:37 +0800 Subject: [PATCH 120/167] fix --- iguana/dpow/dpow_fsm.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/iguana/dpow/dpow_fsm.c b/iguana/dpow/dpow_fsm.c index 75ae189a3..1cb3f7f85 100755 --- a/iguana/dpow/dpow_fsm.c +++ b/iguana/dpow/dpow_fsm.c @@ -616,10 +616,11 @@ void dpow_statemachinestart(void *ptr) // We need to wait for notarized confirm here. If the notarization is reorged for any reason we need to rebroadcast it, // because the mempool is stupid after the sapling update, or Alright might be playing silly games. - int8_t dest_confs = 0, src_confs = 0, destnotarized = 0, srcnotarized = 0, send_dest = 0, send_src = 0; + int8_t dest_confs = 0, src_confs = 0, destnotarized = 0, srcnotarized = 0; char desttx[32768],srctx[32768],rettx[32768]; char *retstr=0; while ( 1 ) { + int8_t send_dest = 0, send_src = 0; // If the round was sucessful and both notarizations were created successfully we will make sure they are in the chain. if ( bits256_cmp(bp->desttxid,zero) == 0 ) break; @@ -649,7 +650,10 @@ void dpow_statemachinestart(void *ptr) } } else if ( desttx[0] != 0 ) // we have the tranxation hex saved, and the tx is not in the local mempool or a block, so resend it. + { + fprintf(stderr, "cant find tx.%s rebroadcasting...\n", bits256_str(str,bp->desttxid)); send_dest = 1; + } if ( send_dest == 1 && dpow_sendrawtransaction(myinfo, bp->destcoin, desttx) == 0 ) fprintf(stderr, "rebroadcast failed!\n"); From e9010d7b6b742e83d3c96943f4d527634689c674 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Wed, 6 Mar 2019 18:07:26 +0800 Subject: [PATCH 121/167] add src and fix --- iguana/dpow/dpow_fsm.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/iguana/dpow/dpow_fsm.c b/iguana/dpow/dpow_fsm.c index 1cb3f7f85..4a16fc8b1 100755 --- a/iguana/dpow/dpow_fsm.c +++ b/iguana/dpow/dpow_fsm.c @@ -658,6 +658,34 @@ void dpow_statemachinestart(void *ptr) fprintf(stderr, "rebroadcast failed!\n"); // get the confirms for srctxid + if ( srcnotarized == 0 && (src_confs= dpow_txconfirms(myinfo, bp->srccoin, bp->srctxid, rettx)) != -1 ) + { + if ( srctx[0] == 0 && rettx[0] != 0 ) + { + memcpy(srctx, rettx, strlen(rettx)+1); + fprintf(stderr, "srctx.%s\n", srctx); + } + if ( src_confs > 2 ) + { + // tx is notarized. or it has 100+ raw confirms. Its now final and cannot be lost! + fprintf(stderr, "[%s] txid.%s is notarized or has 100 confirms.%i\n", dp->symbol, bits256_str(str,bp->srctxid), src_confs)); + srcnotarized = 1; + } + else if ( src_confs == 0 ) + { + // not confirmed, rebroadcast it. + fprintf(stderr, "[%s] txid.%s is not confirmed rebroadcasting....\n tx.%s", dp->symbol, bits256_str(str,bp->srctxid), srctx); + if ( srctx[0] != 0 ) + send_src = 1; + } + } + else if ( srctx[0] != 0 ) // we have the tranxation hex saved, and the tx is not in the local mempool or a block, so resend it. + { + fprintf(stderr, "cant find tx.%s rebroadcasting...\n", bits256_str(str,bp->srctxid)); + send_src = 1; + } + if ( send_src == 1 && dpow_sendrawtransaction(myinfo, bp->srccoin, srctx) == 0 ) + fprintf(stderr, "rebroadcast failed!\n"); // wait for approx one block before checking again. sleep(30); From 2fa034e50ad2a8ace4ddf1e55210fc8acdbe68e5 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Wed, 6 Mar 2019 18:09:08 +0800 Subject: [PATCH 122/167] fix --- iguana/dpow/dpow_fsm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/iguana/dpow/dpow_fsm.c b/iguana/dpow/dpow_fsm.c index 4a16fc8b1..b6700d0f6 100755 --- a/iguana/dpow/dpow_fsm.c +++ b/iguana/dpow/dpow_fsm.c @@ -638,7 +638,7 @@ void dpow_statemachinestart(void *ptr) if ( dest_confs > 2 ) { // tx is notarized. or it has 100+ raw confirms. Its now final and cannot be lost! - fprintf(stderr, "[%s] txid.%s is notarized or has 100 confirms.%d\n",dp->dest, bits256_str(str,bp->desttxid, dest_confs)); + fprintf(stderr, "[%s] txid.%s is notarized or has 100 confirms.%d\n",dp->dest, bits256_str(str,bp->desttxid), dest_confs)); destnotarized = 1; } else if ( dest_confs == 0 ) @@ -689,7 +689,7 @@ void dpow_statemachinestart(void *ptr) // wait for approx one block before checking again. sleep(30); - if ( destnotarized != 0 ) break; + if ( destnotarized != 0 && srcnotarized != 0 ) break; } // unlock the dest utxo on KMD. From 3b237babb02ca2d31fd38a3c9b8a08bd69c1f2cc Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Wed, 6 Mar 2019 18:11:10 +0800 Subject: [PATCH 123/167] zero ret tx --- iguana/dpow/dpow_fsm.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/iguana/dpow/dpow_fsm.c b/iguana/dpow/dpow_fsm.c index b6700d0f6..791dd35e5 100755 --- a/iguana/dpow/dpow_fsm.c +++ b/iguana/dpow/dpow_fsm.c @@ -638,7 +638,7 @@ void dpow_statemachinestart(void *ptr) if ( dest_confs > 2 ) { // tx is notarized. or it has 100+ raw confirms. Its now final and cannot be lost! - fprintf(stderr, "[%s] txid.%s is notarized or has 100 confirms.%d\n",dp->dest, bits256_str(str,bp->desttxid), dest_confs)); + fprintf(stderr, "[%s] txid.%s is notarized or has 100 confirms.%d\n",dp->dest, bits256_str(str,bp->desttxid), dest_confs); destnotarized = 1; } else if ( dest_confs == 0 ) @@ -658,6 +658,7 @@ void dpow_statemachinestart(void *ptr) fprintf(stderr, "rebroadcast failed!\n"); // get the confirms for srctxid + memset(rettx,0,sizeof(rettx)); // zero out rettx! if ( srcnotarized == 0 && (src_confs= dpow_txconfirms(myinfo, bp->srccoin, bp->srctxid, rettx)) != -1 ) { if ( srctx[0] == 0 && rettx[0] != 0 ) @@ -668,7 +669,7 @@ void dpow_statemachinestart(void *ptr) if ( src_confs > 2 ) { // tx is notarized. or it has 100+ raw confirms. Its now final and cannot be lost! - fprintf(stderr, "[%s] txid.%s is notarized or has 100 confirms.%i\n", dp->symbol, bits256_str(str,bp->srctxid), src_confs)); + fprintf(stderr, "[%s] txid.%s is notarized or has 100 confirms.%i\n", dp->symbol, bits256_str(str,bp->srctxid), src_confs); srcnotarized = 1; } else if ( src_confs == 0 ) From cd71715e3a0ac16bdeb28ad49568e9049f5b77c1 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Wed, 6 Mar 2019 18:43:01 +0800 Subject: [PATCH 124/167] fix --- iguana/dpow/dpow_fsm.c | 99 ++++++++++++++++++++++-------------------- 1 file changed, 52 insertions(+), 47 deletions(-) diff --git a/iguana/dpow/dpow_fsm.c b/iguana/dpow/dpow_fsm.c index 791dd35e5..a19792419 100755 --- a/iguana/dpow/dpow_fsm.c +++ b/iguana/dpow/dpow_fsm.c @@ -628,69 +628,74 @@ void dpow_statemachinestart(void *ptr) break; // get the confirms for desttxid - if ( destnotarized == 0 && (dest_confs= dpow_txconfirms(myinfo, bp->destcoin, bp->desttxid, rettx)) != -1 ) + if ( destnotarized == 0 ) { - if ( desttx[0] == 0 && rettx[0] != 0 ) + if (dest_confs= dpow_txconfirms(myinfo, bp->destcoin, bp->desttxid, rettx)) != -1 ) { - memcpy(desttx, rettx, strlen(rettx)+1); - fprintf(stderr, "desttx.%s\n", desttx); - } - if ( dest_confs > 2 ) - { - // tx is notarized. or it has 100+ raw confirms. Its now final and cannot be lost! - fprintf(stderr, "[%s] txid.%s is notarized or has 100 confirms.%d\n",dp->dest, bits256_str(str,bp->desttxid), dest_confs); - destnotarized = 1; - } - else if ( dest_confs == 0 ) + if ( desttx[0] == 0 && rettx[0] != 0 ) + { + memcpy(desttx, rettx, strlen(rettx)+1); + } + if ( dest_confs > 2 ) + { + // tx is notarized. or it has 100+ raw confirms. Its now final and cannot be lost! + fprintf(stderr, "[%s] txid.%s is notarized or has 100 confirms.%d\n",dp->dest, bits256_str(str,bp->desttxid), dest_confs); + destnotarized = 1; + } + else if ( dest_confs == 0 ) + { + // not confirmed, rebroadcast it. + fprintf(stderr, "[%s] txid.%s is not confirmed rebroadcasting....\n",dp->dest, bits256_str(str,bp->desttxid)); + if ( desttx[0] != 0 ) + send_dest = 1; + } + } + else if ( desttx[0] != 0 ) // we have the tranxation hex saved, and the tx is not in the local mempool or a block, so resend it. { - // not confirmed, rebroadcast it. - fprintf(stderr, "[%s] txid.%s is not confirmed rebroadcasting....\n tx.%s",dp->dest, bits256_str(str,bp->desttxid), desttx); - if ( desttx[0] != 0 ) - send_dest = 1; + fprintf(stderr, "cant find tx.%s rebroadcasting...\n", bits256_str(str,bp->desttxid)); + send_dest = 1; } - } - else if ( desttx[0] != 0 ) // we have the tranxation hex saved, and the tx is not in the local mempool or a block, so resend it. - { - fprintf(stderr, "cant find tx.%s rebroadcasting...\n", bits256_str(str,bp->desttxid)); - send_dest = 1; + if ( send_dest == 1 && dpow_sendrawtransaction(myinfo, bp->destcoin, desttx) == 0 ) + fprintf(stderr, "rebroadcast failed!\n"); } - if ( send_dest == 1 && dpow_sendrawtransaction(myinfo, bp->destcoin, desttx) == 0 ) - fprintf(stderr, "rebroadcast failed!\n"); // get the confirms for srctxid memset(rettx,0,sizeof(rettx)); // zero out rettx! - if ( srcnotarized == 0 && (src_confs= dpow_txconfirms(myinfo, bp->srccoin, bp->srctxid, rettx)) != -1 ) + if ( srcnotarized == 0 ) { - if ( srctx[0] == 0 && rettx[0] != 0 ) + if ( (src_confs= dpow_txconfirms(myinfo, bp->srccoin, bp->srctxid, rettx)) != -1 ) { - memcpy(srctx, rettx, strlen(rettx)+1); - fprintf(stderr, "srctx.%s\n", srctx); - } - if ( src_confs > 2 ) - { - // tx is notarized. or it has 100+ raw confirms. Its now final and cannot be lost! - fprintf(stderr, "[%s] txid.%s is notarized or has 100 confirms.%i\n", dp->symbol, bits256_str(str,bp->srctxid), src_confs); - srcnotarized = 1; - } - else if ( src_confs == 0 ) + if ( srctx[0] == 0 && rettx[0] != 0 ) + { + memcpy(srctx, rettx, strlen(rettx)+1); + } + if ( src_confs > 2 ) + { + // tx is notarized. or it has 100+ raw confirms. Its now final and cannot be lost! + fprintf(stderr, "[%s] txid.%s is notarized or has 100 confirms.%i\n", dp->symbol, bits256_str(str,bp->srctxid), src_confs); + srcnotarized = 1; + } + else if ( src_confs == 0 ) + { + // not confirmed, rebroadcast it. + fprintf(stderr, "[%s] txid.%s is not confirmed rebroadcasting....\n", dp->symbol, bits256_str(str,bp->srctxid)); + if ( srctx[0] != 0 ) + send_src = 1; + } + } + else if ( srctx[0] != 0 ) // we have the tranxation hex saved, and the tx is not in the local mempool or a block, so resend it. { - // not confirmed, rebroadcast it. - fprintf(stderr, "[%s] txid.%s is not confirmed rebroadcasting....\n tx.%s", dp->symbol, bits256_str(str,bp->srctxid), srctx); - if ( srctx[0] != 0 ) - send_src = 1; + fprintf(stderr, "cant find tx.%s rebroadcasting...\n", bits256_str(str,bp->srctxid)); + send_src = 1; } - } - else if ( srctx[0] != 0 ) // we have the tranxation hex saved, and the tx is not in the local mempool or a block, so resend it. - { - fprintf(stderr, "cant find tx.%s rebroadcasting...\n", bits256_str(str,bp->srctxid)); - send_src = 1; + if ( send_src == 1 && dpow_sendrawtransaction(myinfo, bp->srccoin, srctx) == 0 ) + fprintf(stderr, "rebroadcast failed!\n"); } - if ( send_src == 1 && dpow_sendrawtransaction(myinfo, bp->srccoin, srctx) == 0 ) - fprintf(stderr, "rebroadcast failed!\n"); // wait for approx one block before checking again. sleep(30); - if ( destnotarized != 0 && srcnotarized != 0 ) break; + if ( destnotarized != 0 && srcnotarized != 0 ) + break; } // unlock the dest utxo on KMD. From 5515b0f893af2a2a45f88bb4bfa1a7a4446ab2af Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Wed, 6 Mar 2019 18:45:57 +0800 Subject: [PATCH 125/167] fix --- iguana/dpow/dpow_fsm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iguana/dpow/dpow_fsm.c b/iguana/dpow/dpow_fsm.c index a19792419..2d452c312 100755 --- a/iguana/dpow/dpow_fsm.c +++ b/iguana/dpow/dpow_fsm.c @@ -630,7 +630,7 @@ void dpow_statemachinestart(void *ptr) // get the confirms for desttxid if ( destnotarized == 0 ) { - if (dest_confs= dpow_txconfirms(myinfo, bp->destcoin, bp->desttxid, rettx)) != -1 ) + if ( (dest_confs= dpow_txconfirms(myinfo, bp->destcoin, bp->desttxid, rettx)) != -1 ) { if ( desttx[0] == 0 && rettx[0] != 0 ) { From 2507f8c253c1febc1bf2ae2385f169e8dc33f66e Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Thu, 7 Mar 2019 00:39:56 +0800 Subject: [PATCH 126/167] laziest fix --- iguana/dpow/dpow_fsm.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/iguana/dpow/dpow_fsm.c b/iguana/dpow/dpow_fsm.c index 2d452c312..340117bc1 100755 --- a/iguana/dpow/dpow_fsm.c +++ b/iguana/dpow/dpow_fsm.c @@ -626,8 +626,11 @@ void dpow_statemachinestart(void *ptr) break; if ( bits256_cmp(bp->srctxid,zero) == 0 ) break; + // wait for approx one block before checking, gives some time to confirm, before rebroadcast. + sleep(60); // get the confirms for desttxid + memset(rettx,0,sizeof(rettx)); // zero out rettx! if ( destnotarized == 0 ) { if ( (dest_confs= dpow_txconfirms(myinfo, bp->destcoin, bp->desttxid, rettx)) != -1 ) @@ -692,8 +695,6 @@ void dpow_statemachinestart(void *ptr) fprintf(stderr, "rebroadcast failed!\n"); } - // wait for approx one block before checking again. - sleep(30); if ( destnotarized != 0 && srcnotarized != 0 ) break; } From 3b348e41cb3fda50c98498012e14418ce18e0811 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Thu, 7 Mar 2019 00:43:19 +0800 Subject: [PATCH 127/167] rand resend check --- iguana/dpow/dpow_fsm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iguana/dpow/dpow_fsm.c b/iguana/dpow/dpow_fsm.c index 340117bc1..7313689e3 100755 --- a/iguana/dpow/dpow_fsm.c +++ b/iguana/dpow/dpow_fsm.c @@ -627,7 +627,7 @@ void dpow_statemachinestart(void *ptr) if ( bits256_cmp(bp->srctxid,zero) == 0 ) break; // wait for approx one block before checking, gives some time to confirm, before rebroadcast. - sleep(60); + sleep((rand() % (240 - 30)) + 30); // get the confirms for desttxid memset(rettx,0,sizeof(rettx)); // zero out rettx! From af6998ef1127cd4057dd8efdda5128d2ea54401d Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Thu, 7 Mar 2019 02:19:31 +0800 Subject: [PATCH 128/167] kmd-5 for safety. --- iguana/dpow/dpow_rpc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/iguana/dpow/dpow_rpc.c b/iguana/dpow/dpow_rpc.c index 79ebe9962..26842fe3d 100755 --- a/iguana/dpow/dpow_rpc.c +++ b/iguana/dpow/dpow_rpc.c @@ -317,7 +317,8 @@ int32_t dpow_paxpending(struct supernet_info *myinfo,uint8_t *hex,int32_t hexsiz kmdheight = jint(infojson,"blocks"); free_json(infojson); } - if ( (retjson= dpow_MoMoMdata(kmdcoin,bp->srccoin->symbol,kmdheight,bp->CCid)) != 0 ) + // 5 is easily enough.. KMD is pretty safe + if ( (retjson= dpow_MoMoMdata(kmdcoin,bp->srccoin->symbol,kmdheight-5,bp->CCid)) != 0 ) { if ( ppMoMheight != 0 && jstr(retjson,"error") != 0 ) { From 3ba72da1c85c3c3f1434d42d648934001d32911e Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Thu, 7 Mar 2019 02:59:11 +0800 Subject: [PATCH 129/167] try --- iguana/dpow/dpow_fsm.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/iguana/dpow/dpow_fsm.c b/iguana/dpow/dpow_fsm.c index 7313689e3..b399dfa78 100755 --- a/iguana/dpow/dpow_fsm.c +++ b/iguana/dpow/dpow_fsm.c @@ -653,7 +653,8 @@ void dpow_statemachinestart(void *ptr) send_dest = 1; } } - else if ( desttx[0] != 0 ) // we have the tranxation hex saved, and the tx is not in the local mempool or a block, so resend it. + if ( is_hexstr(retstr,0) == sizeof(txid)*2 ) + else if ( desttx[0] != 0 && is_hexstr(desttx,strlen(desttx)) != 0 ) // we have the tranxation hex saved, and the tx is not in the local mempool or a block, so resend it. { fprintf(stderr, "cant find tx.%s rebroadcasting...\n", bits256_str(str,bp->desttxid)); send_dest = 1; From 9b63acb4f0fd5499958ce2f14be2e7ffb60b6da6 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Thu, 7 Mar 2019 03:00:44 +0800 Subject: [PATCH 130/167] oops --- iguana/dpow/dpow_fsm.c | 1 - 1 file changed, 1 deletion(-) diff --git a/iguana/dpow/dpow_fsm.c b/iguana/dpow/dpow_fsm.c index b399dfa78..2a78e00ce 100755 --- a/iguana/dpow/dpow_fsm.c +++ b/iguana/dpow/dpow_fsm.c @@ -653,7 +653,6 @@ void dpow_statemachinestart(void *ptr) send_dest = 1; } } - if ( is_hexstr(retstr,0) == sizeof(txid)*2 ) else if ( desttx[0] != 0 && is_hexstr(desttx,strlen(desttx)) != 0 ) // we have the tranxation hex saved, and the tx is not in the local mempool or a block, so resend it. { fprintf(stderr, "cant find tx.%s rebroadcasting...\n", bits256_str(str,bp->desttxid)); From 1d1d4aba65aa6edec94a6d4de1bed92e4cfbafe0 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Thu, 7 Mar 2019 13:44:35 +0800 Subject: [PATCH 131/167] test zero out mem --- iguana/dpow/dpow_fsm.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/iguana/dpow/dpow_fsm.c b/iguana/dpow/dpow_fsm.c index 2a78e00ce..d4157a6ca 100755 --- a/iguana/dpow/dpow_fsm.c +++ b/iguana/dpow/dpow_fsm.c @@ -637,6 +637,7 @@ void dpow_statemachinestart(void *ptr) { if ( desttx[0] == 0 && rettx[0] != 0 ) { + memset(desttx,0,sizeof(desttx)); // zero out desttx. memcpy(desttx, rettx, strlen(rettx)+1); } if ( dest_confs > 2 ) @@ -653,7 +654,7 @@ void dpow_statemachinestart(void *ptr) send_dest = 1; } } - else if ( desttx[0] != 0 && is_hexstr(desttx,strlen(desttx)) != 0 ) // we have the tranxation hex saved, and the tx is not in the local mempool or a block, so resend it. + else if ( desttx[0] != 0 ) // we have the tranxation hex saved, and the tx is not in the local mempool or a block, so resend it. { fprintf(stderr, "cant find tx.%s rebroadcasting...\n", bits256_str(str,bp->desttxid)); send_dest = 1; @@ -670,6 +671,7 @@ void dpow_statemachinestart(void *ptr) { if ( srctx[0] == 0 && rettx[0] != 0 ) { + memset(srctx,0,sizeof(srctx)); // zero out srctx. memcpy(srctx, rettx, strlen(rettx)+1); } if ( src_confs > 2 ) From f24733779908ead57d5c84d30077db690b2e6bd6 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Thu, 7 Mar 2019 15:18:58 +0800 Subject: [PATCH 132/167] add extra print, make rebroadcast happen more --- iguana/dpow/dpow_fsm.c | 3 ++- iguana/dpow/dpow_rpc.c | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/iguana/dpow/dpow_fsm.c b/iguana/dpow/dpow_fsm.c index d4157a6ca..fd396dbb9 100755 --- a/iguana/dpow/dpow_fsm.c +++ b/iguana/dpow/dpow_fsm.c @@ -627,7 +627,7 @@ void dpow_statemachinestart(void *ptr) if ( bits256_cmp(bp->srctxid,zero) == 0 ) break; // wait for approx one block before checking, gives some time to confirm, before rebroadcast. - sleep((rand() % (240 - 30)) + 30); + //sleep((rand() % (240 - 30)) + 30); // get the confirms for desttxid memset(rettx,0,sizeof(rettx)); // zero out rettx! @@ -699,6 +699,7 @@ void dpow_statemachinestart(void *ptr) if ( destnotarized != 0 && srcnotarized != 0 ) break; + sleep(30) } // unlock the dest utxo on KMD. diff --git a/iguana/dpow/dpow_rpc.c b/iguana/dpow/dpow_rpc.c index 26842fe3d..b4cc343f8 100755 --- a/iguana/dpow/dpow_rpc.c +++ b/iguana/dpow/dpow_rpc.c @@ -779,7 +779,7 @@ char *dpow_sendrawtransaction(struct supernet_info *myinfo,struct iguana_info *c jaddistr(array,signedtx); paramstr = jprint(array,1); retstr = bitcoind_passthru(coin->symbol,coin->chain->serverport,coin->chain->userpass,"sendrawtransaction",paramstr); - printf(">>>>>>>>>>> %s dpow_sendrawtransaction (%s)\n",coin->symbol,retstr); + printf(">>>>>>>>>>> %s dpow_sendrawtransaction (%s)\n paramstr.%s",coin->symbol,retstr, paramstr); free(paramstr); return(retstr); } From 1fb20684754318ec84692eebb185180805e0dadc Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Thu, 7 Mar 2019 15:22:37 +0800 Subject: [PATCH 133/167] ; --- iguana/dpow/dpow_fsm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iguana/dpow/dpow_fsm.c b/iguana/dpow/dpow_fsm.c index fd396dbb9..a5704c112 100755 --- a/iguana/dpow/dpow_fsm.c +++ b/iguana/dpow/dpow_fsm.c @@ -699,7 +699,7 @@ void dpow_statemachinestart(void *ptr) if ( destnotarized != 0 && srcnotarized != 0 ) break; - sleep(30) + sleep(30); } // unlock the dest utxo on KMD. From 6f4dbfeec93cc46b79500afff665ef6f8443b2ad Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Thu, 7 Mar 2019 15:47:24 +0800 Subject: [PATCH 134/167] mroe debug --- iguana/dpow/dpow_fsm.c | 14 ++++++++++---- iguana/dpow/dpow_rpc.c | 5 ++++- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/iguana/dpow/dpow_fsm.c b/iguana/dpow/dpow_fsm.c index a5704c112..bbf6b895d 100755 --- a/iguana/dpow/dpow_fsm.c +++ b/iguana/dpow/dpow_fsm.c @@ -617,7 +617,7 @@ void dpow_statemachinestart(void *ptr) // We need to wait for notarized confirm here. If the notarization is reorged for any reason we need to rebroadcast it, // because the mempool is stupid after the sapling update, or Alright might be playing silly games. int8_t dest_confs = 0, src_confs = 0, destnotarized = 0, srcnotarized = 0; - char desttx[32768],srctx[32768],rettx[32768]; char *retstr=0; + char desttx[32768],srctx[32768]; char *retstr=0; while ( 1 ) { int8_t send_dest = 0, send_src = 0; @@ -630,7 +630,7 @@ void dpow_statemachinestart(void *ptr) //sleep((rand() % (240 - 30)) + 30); // get the confirms for desttxid - memset(rettx,0,sizeof(rettx)); // zero out rettx! + char rettx[32768] = {0}; if ( destnotarized == 0 ) { if ( (dest_confs= dpow_txconfirms(myinfo, bp->destcoin, bp->desttxid, rettx)) != -1 ) @@ -639,6 +639,7 @@ void dpow_statemachinestart(void *ptr) { memset(desttx,0,sizeof(desttx)); // zero out desttx. memcpy(desttx, rettx, strlen(rettx)+1); + fprintf(stderr, ">>> after copy: desttx.%s\n",desttx); } if ( dest_confs > 2 ) { @@ -659,8 +660,13 @@ void dpow_statemachinestart(void *ptr) fprintf(stderr, "cant find tx.%s rebroadcasting...\n", bits256_str(str,bp->desttxid)); send_dest = 1; } - if ( send_dest == 1 && dpow_sendrawtransaction(myinfo, bp->destcoin, desttx) == 0 ) - fprintf(stderr, "rebroadcast failed!\n"); + if ( send_dest == 1 ) + { + if ( dpow_sendrawtransaction(myinfo, bp->destcoin, desttx) != 0 ) + { + fprintf(stderr, "desttx.%s\n", desttx); + } + } } // get the confirms for srctxid diff --git a/iguana/dpow/dpow_rpc.c b/iguana/dpow/dpow_rpc.c index b4cc343f8..794d957f5 100755 --- a/iguana/dpow/dpow_rpc.c +++ b/iguana/dpow/dpow_rpc.c @@ -779,7 +779,10 @@ char *dpow_sendrawtransaction(struct supernet_info *myinfo,struct iguana_info *c jaddistr(array,signedtx); paramstr = jprint(array,1); retstr = bitcoind_passthru(coin->symbol,coin->chain->serverport,coin->chain->userpass,"sendrawtransaction",paramstr); - printf(">>>>>>>>>>> %s dpow_sendrawtransaction (%s)\n paramstr.%s",coin->symbol,retstr, paramstr); + if ( strcmp("KMD", coin->symbol) == 0 ) + fprintf(stderr,">>>>>>>>>>> %s dpow_sendrawtransaction (%s)\n paramstr.%s\n tx.%s\n",coin->symbol,retstr, paramstr, signedtx); + else + fprintf(stderr,">>>>>>>>>>> %s dpow_sendrawtransaction (%s)\n",coin->symbol,retstr); free(paramstr); return(retstr); } From 7a2c08084864f00a7066f6782c8912c25ef18ff0 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Thu, 7 Mar 2019 16:00:12 +0800 Subject: [PATCH 135/167] try --- iguana/dpow/dpow_fsm.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/iguana/dpow/dpow_fsm.c b/iguana/dpow/dpow_fsm.c index bbf6b895d..80e138af7 100755 --- a/iguana/dpow/dpow_fsm.c +++ b/iguana/dpow/dpow_fsm.c @@ -617,7 +617,7 @@ void dpow_statemachinestart(void *ptr) // We need to wait for notarized confirm here. If the notarization is reorged for any reason we need to rebroadcast it, // because the mempool is stupid after the sapling update, or Alright might be playing silly games. int8_t dest_confs = 0, src_confs = 0, destnotarized = 0, srcnotarized = 0; - char desttx[32768],srctx[32768]; char *retstr=0; + char desttx[32768] = {0},srctx[32768] = {0}; char *retstr=0; while ( 1 ) { int8_t send_dest = 0, send_src = 0; @@ -637,9 +637,7 @@ void dpow_statemachinestart(void *ptr) { if ( desttx[0] == 0 && rettx[0] != 0 ) { - memset(desttx,0,sizeof(desttx)); // zero out desttx. memcpy(desttx, rettx, strlen(rettx)+1); - fprintf(stderr, ">>> after copy: desttx.%s\n",desttx); } if ( dest_confs > 2 ) { @@ -662,6 +660,7 @@ void dpow_statemachinestart(void *ptr) } if ( send_dest == 1 ) { + fprintf(stderr, "<<<<<<<<<<<<<<<<<< before send: desttx.%s\n",desttx); if ( dpow_sendrawtransaction(myinfo, bp->destcoin, desttx) != 0 ) { fprintf(stderr, "desttx.%s\n", desttx); @@ -677,7 +676,6 @@ void dpow_statemachinestart(void *ptr) { if ( srctx[0] == 0 && rettx[0] != 0 ) { - memset(srctx,0,sizeof(srctx)); // zero out srctx. memcpy(srctx, rettx, strlen(rettx)+1); } if ( src_confs > 2 ) From 7ff3d616aa26370f5b71c918408cbf046888bdc7 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Thu, 7 Mar 2019 16:14:46 +0800 Subject: [PATCH 136/167] remove prints --- iguana/dpow/dpow_rpc.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/iguana/dpow/dpow_rpc.c b/iguana/dpow/dpow_rpc.c index 794d957f5..e670622e9 100755 --- a/iguana/dpow/dpow_rpc.c +++ b/iguana/dpow/dpow_rpc.c @@ -779,10 +779,7 @@ char *dpow_sendrawtransaction(struct supernet_info *myinfo,struct iguana_info *c jaddistr(array,signedtx); paramstr = jprint(array,1); retstr = bitcoind_passthru(coin->symbol,coin->chain->serverport,coin->chain->userpass,"sendrawtransaction",paramstr); - if ( strcmp("KMD", coin->symbol) == 0 ) - fprintf(stderr,">>>>>>>>>>> %s dpow_sendrawtransaction (%s)\n paramstr.%s\n tx.%s\n",coin->symbol,retstr, paramstr, signedtx); - else - fprintf(stderr,">>>>>>>>>>> %s dpow_sendrawtransaction (%s)\n",coin->symbol,retstr); + fprintf(stderr,">>>>>>>>>>> %s dpow_sendrawtransaction (%s)\n",coin->symbol,retstr); free(paramstr); return(retstr); } From a4109d9fd8438784025e35935070c8a7e2b496d5 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Thu, 7 Mar 2019 16:26:12 +0800 Subject: [PATCH 137/167] fix --- iguana/dpow/dpow_fsm.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/iguana/dpow/dpow_fsm.c b/iguana/dpow/dpow_fsm.c index 80e138af7..01ec9bc1a 100755 --- a/iguana/dpow/dpow_fsm.c +++ b/iguana/dpow/dpow_fsm.c @@ -658,14 +658,8 @@ void dpow_statemachinestart(void *ptr) fprintf(stderr, "cant find tx.%s rebroadcasting...\n", bits256_str(str,bp->desttxid)); send_dest = 1; } - if ( send_dest == 1 ) - { - fprintf(stderr, "<<<<<<<<<<<<<<<<<< before send: desttx.%s\n",desttx); - if ( dpow_sendrawtransaction(myinfo, bp->destcoin, desttx) != 0 ) - { - fprintf(stderr, "desttx.%s\n", desttx); - } - } + if ( send_dest == 1 && dpow_sendrawtransaction(myinfo, bp->destcoin, desttx) == 0 ) + fprintf(stderr, "rebroadcast failed!\n"); } // get the confirms for srctxid From aa94451bd9785d50dda6016b167b7d70406ac2ca Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Thu, 7 Mar 2019 17:06:32 +0800 Subject: [PATCH 138/167] clean up --- iguana/dpow/dpow_fsm.c | 38 ++++++++++++++++---------------------- 1 file changed, 16 insertions(+), 22 deletions(-) diff --git a/iguana/dpow/dpow_fsm.c b/iguana/dpow/dpow_fsm.c index 01ec9bc1a..3d967f3d3 100755 --- a/iguana/dpow/dpow_fsm.c +++ b/iguana/dpow/dpow_fsm.c @@ -617,31 +617,31 @@ void dpow_statemachinestart(void *ptr) // We need to wait for notarized confirm here. If the notarization is reorged for any reason we need to rebroadcast it, // because the mempool is stupid after the sapling update, or Alright might be playing silly games. int8_t dest_confs = 0, src_confs = 0, destnotarized = 0, srcnotarized = 0; - char desttx[32768] = {0},srctx[32768] = {0}; char *retstr=0; - while ( 1 ) + char desttx[32768] = {0},srctx[32768] = {0}; + while ( destnotarized == 0 && srcnotarized == 0 ) { - int8_t send_dest = 0, send_src = 0; - // If the round was sucessful and both notarizations were created successfully we will make sure they are in the chain. + int8_t send_dest = 0, send_src = 0; char rettx[32768] = {0}; + // If the round was sucessful and both notarization transactions were created successfully we will make sure they are in the chain. if ( bits256_cmp(bp->desttxid,zero) == 0 ) break; if ( bits256_cmp(bp->srctxid,zero) == 0 ) break; - // wait for approx one block before checking, gives some time to confirm, before rebroadcast. - //sleep((rand() % (240 - 30)) + 30); + // random sleep here so all nodes are checking/rebroadcasting at diffrent times. + sleep((rand() % (77 - 33)) + 33); // get the confirms for desttxid - char rettx[32768] = {0}; if ( destnotarized == 0 ) { if ( (dest_confs= dpow_txconfirms(myinfo, bp->destcoin, bp->desttxid, rettx)) != -1 ) { if ( desttx[0] == 0 && rettx[0] != 0 ) { + // save the transaction once we fetch it once, as its possible we wil not be able to always see it. memcpy(desttx, rettx, strlen(rettx)+1); } if ( dest_confs > 2 ) { - // tx is notarized. or it has 100+ raw confirms. Its now final and cannot be lost! + // tx is notarized. or it has 100+ raw confirms. Its now final and cannot be lost, no longer need to check. fprintf(stderr, "[%s] txid.%s is notarized or has 100 confirms.%d\n",dp->dest, bits256_str(str,bp->desttxid), dest_confs); destnotarized = 1; } @@ -655,11 +655,11 @@ void dpow_statemachinestart(void *ptr) } else if ( desttx[0] != 0 ) // we have the tranxation hex saved, and the tx is not in the local mempool or a block, so resend it. { - fprintf(stderr, "cant find tx.%s rebroadcasting...\n", bits256_str(str,bp->desttxid)); + fprintf(stderr, "[%s] Cant find tx.%s rebroadcasting...\n", dp->dest, bits256_str(str,bp->desttxid)); send_dest = 1; } - if ( send_dest == 1 && dpow_sendrawtransaction(myinfo, bp->destcoin, desttx) == 0 ) - fprintf(stderr, "rebroadcast failed!\n"); + if ( send_dest == 1 ) + dpow_sendrawtransaction(myinfo, bp->destcoin, desttx); } // get the confirms for srctxid @@ -674,30 +674,24 @@ void dpow_statemachinestart(void *ptr) } if ( src_confs > 2 ) { - // tx is notarized. or it has 100+ raw confirms. Its now final and cannot be lost! fprintf(stderr, "[%s] txid.%s is notarized or has 100 confirms.%i\n", dp->symbol, bits256_str(str,bp->srctxid), src_confs); srcnotarized = 1; } else if ( src_confs == 0 ) { - // not confirmed, rebroadcast it. fprintf(stderr, "[%s] txid.%s is not confirmed rebroadcasting....\n", dp->symbol, bits256_str(str,bp->srctxid)); if ( srctx[0] != 0 ) send_src = 1; } - } - else if ( srctx[0] != 0 ) // we have the tranxation hex saved, and the tx is not in the local mempool or a block, so resend it. + } + else if ( srctx[0] != 0 ) { - fprintf(stderr, "cant find tx.%s rebroadcasting...\n", bits256_str(str,bp->srctxid)); + fprintf(stderr, "[%s] Cant find tx.%s rebroadcasting...\n", dp->symbol, bits256_str(str,bp->srctxid)); send_src = 1; } - if ( send_src == 1 && dpow_sendrawtransaction(myinfo, bp->srccoin, srctx) == 0 ) - fprintf(stderr, "rebroadcast failed!\n"); + if ( send_src == 1 ) + dpow_sendrawtransaction(myinfo, bp->srccoin, srctx); } - - if ( destnotarized != 0 && srcnotarized != 0 ) - break; - sleep(30); } // unlock the dest utxo on KMD. From 057b3b52217f5416f7fa8fccaf24db5e44c2cfcc Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Thu, 7 Mar 2019 17:59:31 +0800 Subject: [PATCH 139/167] test --- iguana/dpow/dpow_fsm.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/iguana/dpow/dpow_fsm.c b/iguana/dpow/dpow_fsm.c index 3d967f3d3..e352e2a6c 100755 --- a/iguana/dpow/dpow_fsm.c +++ b/iguana/dpow/dpow_fsm.c @@ -642,7 +642,7 @@ void dpow_statemachinestart(void *ptr) if ( dest_confs > 2 ) { // tx is notarized. or it has 100+ raw confirms. Its now final and cannot be lost, no longer need to check. - fprintf(stderr, "[%s] txid.%s is notarized or has 100 confirms.%d\n",dp->dest, bits256_str(str,bp->desttxid), dest_confs); + fprintf(stderr, "[dest.%s] txid.%s is notarized. confirms.%d srcnotarized.%i\n",dp->dest, bits256_str(str,bp->desttxid), dest_confs, srcnotarized); destnotarized = 1; } else if ( dest_confs == 0 ) @@ -657,7 +657,7 @@ void dpow_statemachinestart(void *ptr) { fprintf(stderr, "[%s] Cant find tx.%s rebroadcasting...\n", dp->dest, bits256_str(str,bp->desttxid)); send_dest = 1; - } + } else fprintf(stderr, "[KMD] get raw transaction error\n"); if ( send_dest == 1 ) dpow_sendrawtransaction(myinfo, bp->destcoin, desttx); } @@ -674,7 +674,7 @@ void dpow_statemachinestart(void *ptr) } if ( src_confs > 2 ) { - fprintf(stderr, "[%s] txid.%s is notarized or has 100 confirms.%i\n", dp->symbol, bits256_str(str,bp->srctxid), src_confs); + fprintf(stderr, "[src.%s] txid.%s is notarized. confirms.%i destnotarized.%i\n", dp->symbol, bits256_str(str,bp->srctxid), src_confs, destnotarized); srcnotarized = 1; } else if ( src_confs == 0 ) @@ -688,7 +688,7 @@ void dpow_statemachinestart(void *ptr) { fprintf(stderr, "[%s] Cant find tx.%s rebroadcasting...\n", dp->symbol, bits256_str(str,bp->srctxid)); send_src = 1; - } + } else fprintf(stderr, "[%s] get raw transaction error\n", dp->symbol); if ( send_src == 1 ) dpow_sendrawtransaction(myinfo, bp->srccoin, srctx); } From daa9557243e99103e28d04bbec5345f7726ff519 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Thu, 7 Mar 2019 18:24:08 +0800 Subject: [PATCH 140/167] test --- iguana/dpow/dpow_fsm.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/iguana/dpow/dpow_fsm.c b/iguana/dpow/dpow_fsm.c index e352e2a6c..e10372f83 100755 --- a/iguana/dpow/dpow_fsm.c +++ b/iguana/dpow/dpow_fsm.c @@ -618,7 +618,7 @@ void dpow_statemachinestart(void *ptr) // because the mempool is stupid after the sapling update, or Alright might be playing silly games. int8_t dest_confs = 0, src_confs = 0, destnotarized = 0, srcnotarized = 0; char desttx[32768] = {0},srctx[32768] = {0}; - while ( destnotarized == 0 && srcnotarized == 0 ) + while ( 1 ) { int8_t send_dest = 0, send_src = 0; char rettx[32768] = {0}; // If the round was sucessful and both notarization transactions were created successfully we will make sure they are in the chain. @@ -692,6 +692,8 @@ void dpow_statemachinestart(void *ptr) if ( send_src == 1 ) dpow_sendrawtransaction(myinfo, bp->srccoin, srctx); } + if ( destnotarized != 0 && srcnotarized != 0 ) + break; // both notarized quit loop. } // unlock the dest utxo on KMD. From 3a46ab9f8cdd893b5ee506464cf459aeacc5b6f3 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Thu, 7 Mar 2019 18:25:56 +0800 Subject: [PATCH 141/167] fix --- iguana/dpow/dpow_fsm.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/iguana/dpow/dpow_fsm.c b/iguana/dpow/dpow_fsm.c index e10372f83..e4a4fb5fc 100755 --- a/iguana/dpow/dpow_fsm.c +++ b/iguana/dpow/dpow_fsm.c @@ -618,7 +618,7 @@ void dpow_statemachinestart(void *ptr) // because the mempool is stupid after the sapling update, or Alright might be playing silly games. int8_t dest_confs = 0, src_confs = 0, destnotarized = 0, srcnotarized = 0; char desttx[32768] = {0},srctx[32768] = {0}; - while ( 1 ) + while ( destnotarized == 0 || srcnotarized == 0 ) { int8_t send_dest = 0, send_src = 0; char rettx[32768] = {0}; // If the round was sucessful and both notarization transactions were created successfully we will make sure they are in the chain. @@ -692,8 +692,6 @@ void dpow_statemachinestart(void *ptr) if ( send_src == 1 ) dpow_sendrawtransaction(myinfo, bp->srccoin, srctx); } - if ( destnotarized != 0 && srcnotarized != 0 ) - break; // both notarized quit loop. } // unlock the dest utxo on KMD. From ab6fcdb03a29ec80f5e0fe9c3737f69844832c4d Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Thu, 7 Mar 2019 18:36:54 +0800 Subject: [PATCH 142/167] prevent spamming rebroadcast --- iguana/dpow/dpow_fsm.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/iguana/dpow/dpow_fsm.c b/iguana/dpow/dpow_fsm.c index e4a4fb5fc..5bb2efd38 100755 --- a/iguana/dpow/dpow_fsm.c +++ b/iguana/dpow/dpow_fsm.c @@ -616,16 +616,21 @@ void dpow_statemachinestart(void *ptr) // We need to wait for notarized confirm here. If the notarization is reorged for any reason we need to rebroadcast it, // because the mempool is stupid after the sapling update, or Alright might be playing silly games. - int8_t dest_confs = 0, src_confs = 0, destnotarized = 0, srcnotarized = 0; - char desttx[32768] = {0},srctx[32768] = {0}; + int8_t dest_confs = 0, src_confs = 0, destnotarized = 0, srcnotarized = 0, firstloop = 0; + char desttx[32768] = {0}, srctx[32768] = {0}; while ( destnotarized == 0 || srcnotarized == 0 ) { - int8_t send_dest = 0, send_src = 0; char rettx[32768] = {0}; // If the round was sucessful and both notarization transactions were created successfully we will make sure they are in the chain. if ( bits256_cmp(bp->desttxid,zero) == 0 ) break; if ( bits256_cmp(bp->srctxid,zero) == 0 ) break; + int8_t send_dest = 0, send_src = 0; char rettx[32768] = {0}; + if ( firstloop == 0 ) + { + sleep(60); // wait 60s on the first round, to prevent spamming transactions when not needed. + firstloop = 1; + } // random sleep here so all nodes are checking/rebroadcasting at diffrent times. sleep((rand() % (77 - 33)) + 33); From 007fca33737b76d59afb87883bff08b7f1bf73f3 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Thu, 7 Mar 2019 18:39:45 +0800 Subject: [PATCH 143/167] better --- iguana/dpow/dpow_fsm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iguana/dpow/dpow_fsm.c b/iguana/dpow/dpow_fsm.c index 5bb2efd38..575bfcb14 100755 --- a/iguana/dpow/dpow_fsm.c +++ b/iguana/dpow/dpow_fsm.c @@ -628,7 +628,7 @@ void dpow_statemachinestart(void *ptr) int8_t send_dest = 0, send_src = 0; char rettx[32768] = {0}; if ( firstloop == 0 ) { - sleep(60); // wait 60s on the first round, to prevent spamming transactions when not needed. + sleep((rand() % (120 - 60)) + 60); firstloop = 1; } // random sleep here so all nodes are checking/rebroadcasting at diffrent times. From 4e2e5f73331479febd3be3686ac8903f06f792f5 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Thu, 7 Mar 2019 18:42:00 +0800 Subject: [PATCH 144/167] fix --- iguana/dpow/dpow_fsm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iguana/dpow/dpow_fsm.c b/iguana/dpow/dpow_fsm.c index 575bfcb14..45b84bb25 100755 --- a/iguana/dpow/dpow_fsm.c +++ b/iguana/dpow/dpow_fsm.c @@ -662,7 +662,7 @@ void dpow_statemachinestart(void *ptr) { fprintf(stderr, "[%s] Cant find tx.%s rebroadcasting...\n", dp->dest, bits256_str(str,bp->desttxid)); send_dest = 1; - } else fprintf(stderr, "[KMD] get raw transaction error\n"); + } else fprintf(stderr, "[%s] get raw transaction error\n", dp->dest); if ( send_dest == 1 ) dpow_sendrawtransaction(myinfo, bp->destcoin, desttx); } From 063de551e2c2f08823c6d74e14a2c5a8d0ac9ada Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Thu, 7 Mar 2019 18:57:20 +0800 Subject: [PATCH 145/167] set state to finished --- iguana/dpow/dpow_fsm.c | 42 ++++++++++++++++++++++-------------------- 1 file changed, 22 insertions(+), 20 deletions(-) diff --git a/iguana/dpow/dpow_fsm.c b/iguana/dpow/dpow_fsm.c index 45b84bb25..e23579f44 100755 --- a/iguana/dpow/dpow_fsm.c +++ b/iguana/dpow/dpow_fsm.c @@ -473,28 +473,28 @@ void dpow_statemachinestart(void *ptr) } else { - if ( dpow_haveutxo(myinfo,bp->destcoin,&ep->dest.prev_hash,&ep->dest.prev_vout,destaddr,src->symbol) > 0 ) - { - if ( (strcmp("KMD",dest->symbol) == 0 ) && (ep->dest.prev_vout != -1) ) - { - // lock the dest utxo if destination coin is KMD. - if (dpow_lockunspent(myinfo,bp->destcoin,destaddr,bits256_str(str2,ep->dest.prev_hash),ep->dest.prev_vout) != 0) - printf(">>>> LOCKED %s UTXO.(%s) vout.(%d)\n",dest->symbol,bits256_str(str2,ep->dest.prev_hash),ep->dest.prev_vout); - else - printf("<<<< FAILED TO LOCK %s UTXO.(%s) vout.(%d)\n",dest->symbol,bits256_str(str2,ep->dest.prev_hash),ep->dest.prev_vout); - } - } - if ( dpow_haveutxo(myinfo,bp->srccoin,&ep->src.prev_hash,&ep->src.prev_vout,srcaddr,"") > 0 ) - { - if ( ( strcmp("KMD",src->symbol) == 0 ) && (ep->src.prev_vout != -1) ) + if ( dpow_haveutxo(myinfo,bp->destcoin,&ep->dest.prev_hash,&ep->dest.prev_vout,destaddr,src->symbol) > 0 ) { - // lock the src coin selected utxo if the source coin is KMD. - if (dpow_lockunspent(myinfo,bp->srccoin,srcaddr,bits256_str(str2,ep->src.prev_hash),ep->src.prev_vout) != 0) - printf(">>>> LOCKED %s UTXO.(%s) vout.(%d\n",src->symbol,bits256_str(str2,ep->src.prev_hash),ep->src.prev_vout); - else - printf("<<<< FAILED TO LOCK %s UTXO.(%s) vout.(%d)\n",src->symbol,bits256_str(str2,ep->src.prev_hash),ep->src.prev_vout); + if ( (strcmp("KMD",dest->symbol) == 0 ) && (ep->dest.prev_vout != -1) ) + { + // lock the dest utxo if destination coin is KMD. + if (dpow_lockunspent(myinfo,bp->destcoin,destaddr,bits256_str(str2,ep->dest.prev_hash),ep->dest.prev_vout) != 0) + printf(">>>> LOCKED %s UTXO.(%s) vout.(%d)\n",dest->symbol,bits256_str(str2,ep->dest.prev_hash),ep->dest.prev_vout); + else + printf("<<<< FAILED TO LOCK %s UTXO.(%s) vout.(%d)\n",dest->symbol,bits256_str(str2,ep->dest.prev_hash),ep->dest.prev_vout); + } + } + if ( dpow_haveutxo(myinfo,bp->srccoin,&ep->src.prev_hash,&ep->src.prev_vout,srcaddr,"") > 0 ) + { + if ( ( strcmp("KMD",src->symbol) == 0 ) && (ep->src.prev_vout != -1) ) + { + // lock the src coin selected utxo if the source coin is KMD. + if (dpow_lockunspent(myinfo,bp->srccoin,srcaddr,bits256_str(str2,ep->src.prev_hash),ep->src.prev_vout) != 0) + printf(">>>> LOCKED %s UTXO.(%s) vout.(%d\n",src->symbol,bits256_str(str2,ep->src.prev_hash),ep->src.prev_vout); + else + printf("<<<< FAILED TO LOCK %s UTXO.(%s) vout.(%d)\n",src->symbol,bits256_str(str2,ep->src.prev_hash),ep->src.prev_vout); + } } - } if ( bp->isratify != 0 ) { bp->notaries[myind].ratifysrcutxo = ep->src.prev_hash; @@ -529,6 +529,8 @@ void dpow_statemachinestart(void *ptr) { //printf("abort %s ht.%d due to new checkpoint.%d\n",dp->symbol,checkpoint.blockhash.height,dp->checkpoint.blockhash.height); dp->ratifying -= bp->isratify; + // set state to finished. + bp->state = 0xffffffff; free(ptr); return; } From 65ceafeac034e8c434d5588e5c66b76783373c88 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Thu, 7 Mar 2019 19:17:35 +0800 Subject: [PATCH 146/167] fix memleak? --- iguana/dPoW.h | 2 +- iguana/dpow/dpow_fsm.c | 17 ++++++++++++----- iguana/iguana_notary.c | 2 +- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/iguana/dPoW.h b/iguana/dPoW.h index 81812c3a9..fd2dfea68 100755 --- a/iguana/dPoW.h +++ b/iguana/dPoW.h @@ -115,7 +115,7 @@ struct dpow_block uint64_t recvmask,bestmask,ratifybestmask,ratifyrecvmask,pendingbestmask,pendingratifybestmask,ratifysigmasks[2]; struct dpow_recvdata recv[64]; struct dpow_entry notaries[DPOW_MAXRELAYS]; - uint32_t MoMdepth,state,starttime,timestamp,waiting,sigcrcs[2],txidcrcs[2],utxocrcs[2],lastepoch,paxwdcrc,lastnanosend; + uint32_t MoMdepth,state,starttime,timestamp,waiting,sigcrcs[2],txidcrcs[2],utxocrcs[2],lastepoch,paxwdcrc,lastnanosend,finished; int32_t rawratifiedlens[2],height,numnotaries,numerrors,completed,minsigs,duration,numratified,isratify,require0,scores[DPOW_MAXRELAYS]; int8_t myind,bestk,ratifybestk,pendingbestk,pendingratifybestk,matches,bestmatches; cJSON *ratified; diff --git a/iguana/dpow/dpow_fsm.c b/iguana/dpow/dpow_fsm.c index e23579f44..bc378d2bf 100755 --- a/iguana/dpow/dpow_fsm.c +++ b/iguana/dpow/dpow_fsm.c @@ -284,6 +284,7 @@ void dpow_statemachinestart(void *ptr) if ( src == 0 || dest == 0 ) { printf("null coin ptr? (%s %p or %s %p)\n",dp->symbol,src,dp->dest,dest); + bp->finished = 0xffffffff; free(ptr); return; } @@ -322,6 +323,7 @@ void dpow_statemachinestart(void *ptr) fprintf(stderr,"cant ratify more than 64 notaries ratified has %d\n",numratified); free(ptr); free_json(ratified); + bp->finished = 0xffffffff; return; } for (i=0; iratifying != 0 && bp->isratify == 0 ) { printf("skip notarization ht.%d when ratifying\n",bp->height); + bp->finished = 0xffffffff; free(ptr); return; } @@ -432,6 +435,7 @@ void dpow_statemachinestart(void *ptr) printf(" statemachinestart this node %s %s is not official notary numnotaries.%d kmdht.%d bpht.%d\n",srcaddr,destaddr,bp->numnotaries,kmdheight,bp->height); free(ptr); dp->ratifying -= bp->isratify; + bp->finished = 0xffffffff; exit(-1); return; } @@ -442,6 +446,7 @@ void dpow_statemachinestart(void *ptr) printf("statemachinestart no kmdheight.%d\n",kmdheight); free(ptr); dp->ratifying -= bp->isratify; + bp->finished = 0xffffffff; return; } bp->myind = myind; @@ -455,6 +460,7 @@ void dpow_statemachinestart(void *ptr) printf("%02x",bp->ratified_pubkeys[0][i]); printf(" new, cant change notary0\n"); dp->ratifying -= bp->isratify; + bp->finished = 0xffffffff; free(ptr); return; } @@ -529,10 +535,9 @@ void dpow_statemachinestart(void *ptr) { //printf("abort %s ht.%d due to new checkpoint.%d\n",dp->symbol,checkpoint.blockhash.height,dp->checkpoint.blockhash.height); dp->ratifying -= bp->isratify; - // set state to finished. - bp->state = 0xffffffff; - free(ptr); - return; + goto end; + //free(ptr); + //return; } sleep(1); } @@ -700,7 +705,8 @@ void dpow_statemachinestart(void *ptr) dpow_sendrawtransaction(myinfo, bp->srccoin, srctx); } } - + +end: // unlock the dest utxo on KMD. if ( (strcmp("KMD",dest->symbol) == 0 ) && (ep->dest.prev_vout != -1) ) { @@ -717,5 +723,6 @@ void dpow_statemachinestart(void *ptr) // dp->blocks[bp->height] = 0; bp->state = 0xffffffff; + bp->finished = 0xffffffff; free(ptr); } diff --git a/iguana/iguana_notary.c b/iguana/iguana_notary.c index 5087ac05a..65c53d020 100755 --- a/iguana/iguana_notary.c +++ b/iguana/iguana_notary.c @@ -160,7 +160,7 @@ void dpow_srcupdate(struct supernet_info *myinfo,struct dpow_info *dp,int32_t he printf("ht.%d maxblocks.%d\n",ht,dp->maxblocks); for (i=ht-DPOW_MAXFREQ*5; i>ht-DPOW_MAXFREQ*100&&i>DPOW_MAXFREQ; i--) { - if ( (bp= dp->blocks[i]) != 0 && bp->state == 0xffffffff ) //(i % DPOW_MAXFREQ) != 0 && + if ( (bp= dp->blocks[i]) != 0 && bp->finished == 0xffffffff ) //(i % DPOW_MAXFREQ) != 0 && { if ( dp->currentbp == dp->blocks[i] ) dp->currentbp = 0; From 7f8f6b10962e4c6160effa5d267285be5c46f653 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Thu, 7 Mar 2019 19:18:34 +0800 Subject: [PATCH 147/167] fix --- iguana/dpow/dpow_fsm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iguana/dpow/dpow_fsm.c b/iguana/dpow/dpow_fsm.c index bc378d2bf..3a33ed386 100755 --- a/iguana/dpow/dpow_fsm.c +++ b/iguana/dpow/dpow_fsm.c @@ -705,6 +705,7 @@ void dpow_statemachinestart(void *ptr) dpow_sendrawtransaction(myinfo, bp->srccoin, srctx); } } + bp->state = 0xffffffff; end: // unlock the dest utxo on KMD. @@ -722,7 +723,6 @@ end: } // dp->blocks[bp->height] = 0; - bp->state = 0xffffffff; bp->finished = 0xffffffff; free(ptr); } From f87fe68d269fcb259533356747dcbc2fd612efb8 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sun, 10 Mar 2019 13:36:39 +0800 Subject: [PATCH 148/167] remove bail out on NULL MoMoM, not required now that NULL MoMoM is fixed! --- iguana/dpow/dpow_fsm.c | 7 +++---- iguana/dpow/dpow_rpc.c | 12 +++++++----- iguana/iguana_notary.c | 4 ++-- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/iguana/dpow/dpow_fsm.c b/iguana/dpow/dpow_fsm.c index 3a33ed386..d67b428bc 100755 --- a/iguana/dpow/dpow_fsm.c +++ b/iguana/dpow/dpow_fsm.c @@ -570,10 +570,9 @@ void dpow_statemachinestart(void *ptr) src_or_dest = 0; else src_or_dest = 1; extralen = dpow_paxpending(myinfo,extras,sizeof(extras),&bp->paxwdcrc,bp->MoM,bp->MoMdepth,bp->CCid,src_or_dest,bp); - // if MoMoM is not avalible yet, then stop this round and try again later. - // This might no longer be needed... It can stop notarizations dead if they have not happened for 1440 blocks. - if ( extralen == -1 ) - break; + // This is no longer be needed... It can stop notarizations dead if they have not happened for 1440 blocks. + //if ( extralen == -1 ) + // break; bp->notaries[bp->myind].paxwdcrc = bp->paxwdcrc; } if ( dp->checkpoint.blockhash.height > checkpoint.blockhash.height ) //(checkpoint.blockhash.height % 100) != 0 && diff --git a/iguana/dpow/dpow_rpc.c b/iguana/dpow/dpow_rpc.c index e670622e9..fd29805bf 100755 --- a/iguana/dpow/dpow_rpc.c +++ b/iguana/dpow/dpow_rpc.c @@ -301,14 +301,15 @@ int32_t dpow_paxpending(struct supernet_info *myinfo,uint8_t *hex,int32_t hexsiz n += iguana_rwbignum(1,&hex[n],sizeof(MoM),MoM.bytes); MoMdepth = (MoMdepth & 0xffff) | ((uint32_t)CCid<<16); n += iguana_rwnum(1,&hex[n],sizeof(MoMdepth),(uint32_t *)&MoMdepth); - if ( (srcinfojson= dpow_getinfo(myinfo,bp->srccoin)) != 0 ) + /*if ( (srcinfojson= dpow_getinfo(myinfo,bp->srccoin)) != 0 ) { + // not needed CCid is passed to this function already, and we dont need the ppmomheight anymore! CCid = juint(srcinfojson,"CCid"); if ( CCid > 1 ) ppMoMheight = jint(srcinfojson,"ppMoMheight"); free_json(srcinfojson); //printf("ppMoMheight.%i CCid.%i\n", ppMoMheight, CCid); - } + } */ if ( CCid > 1 && src_or_dest == 0 && strcmp(bp->destcoin->symbol,"KMD") == 0 ) //strncmp(bp->srccoin->symbol,"TXSCL",5) == 0 && { kmdcoin = bp->destcoin; @@ -317,15 +318,16 @@ int32_t dpow_paxpending(struct supernet_info *myinfo,uint8_t *hex,int32_t hexsiz kmdheight = jint(infojson,"blocks"); free_json(infojson); } - // 5 is easily enough.. KMD is pretty safe + // 5 block delay is easily enough most of the time. In rare case KMD is reorged more than this, + // the backup notary validation can be used to complete the import. if ( (retjson= dpow_MoMoMdata(kmdcoin,bp->srccoin->symbol,kmdheight-5,bp->CCid)) != 0 ) { - if ( ppMoMheight != 0 && jstr(retjson,"error") != 0 ) + /*if ( ppMoMheight != 0 && jstr(retjson,"error") != 0 ) { // MoMoM returned NULL when after 2 MoM exist on the chain. free_json(retjson); return(-1); - } + } */ if ( (hexstr= jstr(retjson,"data")) != 0 && (hexlen= (int32_t)strlen(hexstr)) > 0 && n+hexlen/2 <= hexsize ) { hexlen >>= 1; diff --git a/iguana/iguana_notary.c b/iguana/iguana_notary.c index 65c53d020..578e9ad6d 100755 --- a/iguana/iguana_notary.c +++ b/iguana/iguana_notary.c @@ -86,8 +86,8 @@ void dpow_srcupdate(struct supernet_info *myinfo,struct dpow_info *dp,int32_t he supressfreq = 3; if ( dp->DESTHEIGHT < dp->prevDESTHEIGHT+supressfreq ) { - suppress = 1; - //fprintf(stderr,"suppress %s -> KMD freq KMD blocks.%d\n",dp->symbol,checkpointfreq); + suppress = 1; + //fprintf(stderr,"suppress %s -> KMD freq KMD blocks.%d\n",dp->symbol,checkpointfreq); } } /*if ( strcmp(dp->dest,"KMD") == 0 )//|| strcmp(dp->dest,"CHAIN") == 0 ) From 65ea49e512db78fa8630b93f5fdb8dbe9f0b9bd4 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 15 Mar 2019 11:57:50 +0800 Subject: [PATCH 149/167] try --- iguana/dpow/dpow_rpc.c | 156 ++++++++++++++++++----------------------- 1 file changed, 69 insertions(+), 87 deletions(-) diff --git a/iguana/dpow/dpow_rpc.c b/iguana/dpow/dpow_rpc.c index fd29805bf..c36f89789 100755 --- a/iguana/dpow/dpow_rpc.c +++ b/iguana/dpow/dpow_rpc.c @@ -113,118 +113,100 @@ char *Notaries_seeds[65]; int32_t komodo_initjson(char *fname) { - char *fstr,*field,*hexstr; cJSON *argjson,*array,*item; long fsize; uint16_t port; int32_t i,n,num,retval = -1; - //for (i=0; i Notaries_BTCminsigs ) + Notaries_BTCminsigs = num; + Notaries_minsigs = juint(argjson,"minsigs"); + if ( (array= jarray(&n,argjson,"seeds")) != 0 && n <= 64 ) { - if ( (port= juint(argjson,"port")) != 0 ) - Notaries_port = port; - if ( (num= juint(argjson,"BTCminsigs")) > Notaries_BTCminsigs ) - Notaries_BTCminsigs = num; - Notaries_minsigs = juint(argjson,"minsigs"); - if ( (array= jarray(&n,argjson,"seeds")) != 0 && n <= 64 ) + for (i=0; i 0 ) - { - for (i=0; i= 180000 ) - { - for (i=0; iFULLNODE < 0 ) { - sprintf(params,"[\"%d\"]",height); - if ( (retstr= bitcoind_passthru(coin->symbol,coin->chain->serverport,coin->chain->userpass,"notaries",params)) != 0 ) + if ( (retstr= bitcoind_passthru(coin->symbol,coin->chain->serverport,coin->chain->userpass,"getiguanajson","")) != 0 ) { - if ( (retjson= cJSON_Parse(retstr)) != 0 ) - { -//printf("%s\n",retstr); - if ( (array= jarray(&num,retjson,"notaries")) != 0 ) - { - if ( num > 64 ) - { - printf("warning: numnotaries.%d? > 64?\n",num); - num = 64; - } - for (i=0; i 0 ) + { + for (i=0; i Date: Fri, 15 Mar 2019 12:00:10 +0800 Subject: [PATCH 150/167] fix --- iguana/dpow/dpow_rpc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/iguana/dpow/dpow_rpc.c b/iguana/dpow/dpow_rpc.c index c36f89789..393ef273a 100755 --- a/iguana/dpow/dpow_rpc.c +++ b/iguana/dpow/dpow_rpc.c @@ -116,7 +116,7 @@ int32_t komodo_initjson(char *fname) char *fstr; long fsize; int32_t retval = -1; if ( (fstr= OS_filestr(&fsize,fname)) != 0 ) { - retval= komodo_initjson2(fstr) + retval = komodo_initjson2(fstr); free(fstr); } return(retval); @@ -131,7 +131,7 @@ int32_t komodo_initjson2(char *fstr) initflag = 1; } portable_mutex_lock(¬aries_mutex); - char *field,*hexstr; cJSON *array,*item; uint16_t port; int32_t i,n,numretval = -1;; + char *field,*hexstr; cJSON *array,*item,*argjson; uint16_t port; int32_t i,n,numretval = -1; if ( (argjson= cJSON_Parse(fstr)) != 0 ) { // memset arrays to 0! From a5daea1aecb8b68860c4be7d5ee4f627d560f665 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 15 Mar 2019 12:02:37 +0800 Subject: [PATCH 151/167] fix --- iguana/dpow/dpow_rpc.c | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/iguana/dpow/dpow_rpc.c b/iguana/dpow/dpow_rpc.c index 393ef273a..a26a129fb 100755 --- a/iguana/dpow/dpow_rpc.c +++ b/iguana/dpow/dpow_rpc.c @@ -111,27 +111,17 @@ int32_t Notaries_minsigs = DPOW_MIN_ASSETCHAIN_SIGS; uint16_t Notaries_port = DPOW_SOCKPORT; char *Notaries_seeds[65]; -int32_t komodo_initjson(char *fname) -{ - char *fstr; long fsize; int32_t retval = -1; - if ( (fstr= OS_filestr(&fsize,fname)) != 0 ) - { - retval = komodo_initjson2(fstr); - free(fstr); - } - return(retval); -} - int32_t komodo_initjson2(char *fstr) { + char *field,*hexstr; cJSON *array,*item,*argjson; uint16_t port; int32_t i,n,num,retval = -1; static portable_mutex_t notaries_mutex; static int32_t initflag; if ( initflag == 0 ) { portable_mutex_init(¬aries_mutex); initflag = 1; } + portable_mutex_lock(¬aries_mutex); - char *field,*hexstr; cJSON *array,*item,*argjson; uint16_t port; int32_t i,n,numretval = -1; if ( (argjson= cJSON_Parse(fstr)) != 0 ) { // memset arrays to 0! @@ -183,6 +173,17 @@ int32_t komodo_initjson2(char *fstr) portable_mutex_unlock(¬aries_mutex); } +int32_t komodo_initjson(char *fname) +{ + char *fstr; long fsize; int32_t retval = -1; + if ( (fstr= OS_filestr(&fsize,fname)) != 0 ) + { + retval = komodo_initjson2(fstr); + free(fstr); + } + return(retval); +} + int32_t komodo_notaries(char *symbol,uint8_t pubkeys[64][33],int32_t height) { int32_t i,num=-1, didinit=0; struct iguana_info *coin; char params[64],*retstr; cJSON *retjson; From aa70ef35f46c2c2e51e2ce6d878dcb002fa06f13 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 15 Mar 2019 12:04:57 +0800 Subject: [PATCH 152/167] fix --- iguana/dpow/dpow_rpc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iguana/dpow/dpow_rpc.c b/iguana/dpow/dpow_rpc.c index a26a129fb..b41ef1f30 100755 --- a/iguana/dpow/dpow_rpc.c +++ b/iguana/dpow/dpow_rpc.c @@ -195,7 +195,7 @@ int32_t komodo_notaries(char *symbol,uint8_t pubkeys[64][33],int32_t height) { printf("NOTARIES retstr.%s\n", retstr); if ( komodo_initjson2(retstr) < 0 ) - printf("init notaries failed!"\n"); + printf("init notaries failed!\n"); free(retstr); } } From 1f30916e86fcfe4ad1e99c7844b72a877d38e59a Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 15 Mar 2019 12:06:27 +0800 Subject: [PATCH 153/167] fix --- iguana/dpow/dpow_rpc.c | 1 + 1 file changed, 1 insertion(+) diff --git a/iguana/dpow/dpow_rpc.c b/iguana/dpow/dpow_rpc.c index b41ef1f30..5f09bec75 100755 --- a/iguana/dpow/dpow_rpc.c +++ b/iguana/dpow/dpow_rpc.c @@ -171,6 +171,7 @@ int32_t komodo_initjson2(char *fstr) free_json(argjson); } portable_mutex_unlock(¬aries_mutex); + return(retval) } int32_t komodo_initjson(char *fname) From dd3cefcd34a934f19a5fa372b81ff1d9b901bc95 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 15 Mar 2019 12:06:38 +0800 Subject: [PATCH 154/167] fix --- iguana/dpow/dpow_rpc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iguana/dpow/dpow_rpc.c b/iguana/dpow/dpow_rpc.c index 5f09bec75..51d9e7250 100755 --- a/iguana/dpow/dpow_rpc.c +++ b/iguana/dpow/dpow_rpc.c @@ -171,7 +171,7 @@ int32_t komodo_initjson2(char *fstr) free_json(argjson); } portable_mutex_unlock(¬aries_mutex); - return(retval) + return(retval); } int32_t komodo_initjson(char *fname) From 88d1561da19903617452bbccbcfdb67f15b21f14 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 15 Mar 2019 12:13:16 +0800 Subject: [PATCH 155/167] remove print spam --- iguana/dpow/dpow_rpc.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/iguana/dpow/dpow_rpc.c b/iguana/dpow/dpow_rpc.c index 51d9e7250..9459d9f05 100755 --- a/iguana/dpow/dpow_rpc.c +++ b/iguana/dpow/dpow_rpc.c @@ -138,10 +138,10 @@ int32_t komodo_initjson2(char *fstr) for (i=0; isymbol,coin->chain->serverport,coin->chain->userpass,"getiguanajson","")) != 0 ) { - printf("NOTARIES retstr.%s\n", retstr); + //printf("NOTARIES retstr.%s\n", retstr); if ( komodo_initjson2(retstr) < 0 ) printf("init notaries failed!\n"); free(retstr); @@ -207,7 +207,7 @@ int32_t komodo_notaries(char *symbol,uint8_t pubkeys[64][33],int32_t height) decode_hex(pubkeys[i],33,Notaries_elected[i][1]); return(Notaries_num); } else return(-1); - printf("staked_notaries returns.%d\n",num); + //printf("staked_notaries returns.%d\n",num); return(num); } From 7af57eff75a5a83282881fb1c2908495ce483bdc Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 15 Mar 2019 13:08:12 +0800 Subject: [PATCH 156/167] try --- iguana/iguana_notary.c | 3 +++ iguana/main.c | 42 ++++++++++++++++++++++++++++++++++++++---- 2 files changed, 41 insertions(+), 4 deletions(-) diff --git a/iguana/iguana_notary.c b/iguana/iguana_notary.c index 578e9ad6d..a14151fad 100755 --- a/iguana/iguana_notary.c +++ b/iguana/iguana_notary.c @@ -83,7 +83,10 @@ void dpow_srcupdate(struct supernet_info *myinfo,struct dpow_info *dp,int32_t he { int supressfreq = DPOW_CHECKPOINTFREQ; if ( is_STAKED(dp->symbol) != 0 ) + { + dp->minsigs = Notaries_minsigs; supressfreq = 3; + } if ( dp->DESTHEIGHT < dp->prevDESTHEIGHT+supressfreq ) { suppress = 1; diff --git a/iguana/main.c b/iguana/main.c index cdad3859e..c2b3a30b4 100755 --- a/iguana/main.c +++ b/iguana/main.c @@ -2162,6 +2162,38 @@ void komodo_REVS_merge(char *str,char *str2) getchar(); } +void dpow_loop(void *arg) +{ + struct supernet_info *myinfo = arg; double startmilli,endmilli; + int32_t counter = 0; + printf("start dpow loop\n"); + while ( 1 ) + { + counter++; + startmilli = OS_milliseconds(); + endmilli = startmilli + 1000; + if ( relay == 0 ) + relay = iguana_coinfind("RELAY"); + if ( myinfo->IAMNOTARY != 0 ) + { + if ( myinfo->numdpows == 1 ) + { + iguana_dPoWupdate(myinfo,myinfo->DPOWS[0]); + endmilli = startmilli + 100; + } + else if ( myinfo->numdpows > 1 ) + { + iguana_dPoWupdate(myinfo,myinfo->DPOWS[counter % myinfo->numdpows]); + endmilli = startmilli + 30; + } + } + if ( counter > 100000 ) + counter = 0; + while ( OS_milliseconds() < endmilli ) + usleep(10000); + } +} + int32_t komodo_initjson(char *fname); void iguana_main(void *arg) @@ -2251,7 +2283,7 @@ void iguana_main(void *arg) return; } strcpy(myinfo->rpcsymbol,"BTCD"); - iguana_urlinit(myinfo,ismainnet,usessl); + //iguana_urlinit(myinfo,ismainnet,usessl); portable_mutex_init(&myinfo->pending_mutex); portable_mutex_init(&myinfo->MoM_mutex); portable_mutex_init(&myinfo->dpowmutex); @@ -2275,9 +2307,10 @@ void iguana_main(void *arg) { if ( iguana_commandline(myinfo,arg) == 0 ) { - iguana_helpinit(myinfo); + //iguana_helpinit(myinfo); //iguana_relays_init(myinfo); - basilisks_init(myinfo); + //basilisks_init(myinfo); + myinfo->basilisks.launched = iguana_launch(iguana_coinfind("BTCD"),"dpow_loop",dpow_loop,myinfo,IGUANA_PERMTHREAD); #ifdef __APPLE__ iguana_appletests(myinfo); #endif @@ -2291,7 +2324,8 @@ void iguana_main(void *arg) } else { - basilisks_init(myinfo); + //basilisks_init(myinfo); + } iguana_launchdaemons(myinfo); } From cb75e29aa6264eec2db2c8141703d0b3159cde2e Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 15 Mar 2019 13:10:02 +0800 Subject: [PATCH 157/167] fix --- iguana/main.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/iguana/main.c b/iguana/main.c index c2b3a30b4..cbbe78120 100755 --- a/iguana/main.c +++ b/iguana/main.c @@ -2172,8 +2172,6 @@ void dpow_loop(void *arg) counter++; startmilli = OS_milliseconds(); endmilli = startmilli + 1000; - if ( relay == 0 ) - relay = iguana_coinfind("RELAY"); if ( myinfo->IAMNOTARY != 0 ) { if ( myinfo->numdpows == 1 ) From 8b9c30fecef1e7e829737d7ce268833e53c7ac27 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 15 Mar 2019 13:12:47 +0800 Subject: [PATCH 158/167] try --- iguana/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iguana/main.c b/iguana/main.c index cbbe78120..1b2b0ee5b 100755 --- a/iguana/main.c +++ b/iguana/main.c @@ -794,7 +794,7 @@ void iguana_launchdaemons(struct supernet_info *myinfo) iguana_launch(0,"rpcloop",iguana_rpcloop,myinfo,IGUANA_PERMTHREAD); // limit to oneprocess printf("launch mainloop\n"); // disable basilisk: OS_thread_create(malloc(sizeof(pthread_t)),NULL,(void *)DEX_explorerloop,(void *)myinfo); - OS_thread_create(malloc(sizeof(pthread_t)),NULL,(void *)jumblr_loop,(void *)myinfo); + //OS_thread_create(malloc(sizeof(pthread_t)),NULL,(void *)jumblr_loop,(void *)myinfo); OS_thread_create(malloc(sizeof(pthread_t)),NULL,(void *)dpow_psockloop,(void *)myinfo); mainloop(myinfo); } From 4dd57af65ba9b64e4599bebfb2f679558bb77529 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 15 Mar 2019 13:20:52 +0800 Subject: [PATCH 159/167] try fix --- iguana/iguana_notary.c | 1 + iguana/main.c | 5 ++--- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/iguana/iguana_notary.c b/iguana/iguana_notary.c index a14151fad..7c85fda2f 100755 --- a/iguana/iguana_notary.c +++ b/iguana/iguana_notary.c @@ -227,6 +227,7 @@ void dpow_destupdate(struct supernet_info *myinfo,struct dpow_info *dp,int32_t h void iguana_dPoWupdate(struct supernet_info *myinfo,struct dpow_info *dp) { + printf("dPoW updated called!\n"); int32_t height,num; uint32_t blocktime; bits256 blockhash,merkleroot; struct iguana_info *src,*dest; //if ( strcmp(dp->symbol,"KMD") == 0 ) { diff --git a/iguana/main.c b/iguana/main.c index 1b2b0ee5b..f707cf1a6 100755 --- a/iguana/main.c +++ b/iguana/main.c @@ -794,7 +794,7 @@ void iguana_launchdaemons(struct supernet_info *myinfo) iguana_launch(0,"rpcloop",iguana_rpcloop,myinfo,IGUANA_PERMTHREAD); // limit to oneprocess printf("launch mainloop\n"); // disable basilisk: OS_thread_create(malloc(sizeof(pthread_t)),NULL,(void *)DEX_explorerloop,(void *)myinfo); - //OS_thread_create(malloc(sizeof(pthread_t)),NULL,(void *)jumblr_loop,(void *)myinfo); + OS_thread_create(malloc(sizeof(pthread_t)),NULL,(void *)dpow_loop,(void *)myinfo); OS_thread_create(malloc(sizeof(pthread_t)),NULL,(void *)dpow_psockloop,(void *)myinfo); mainloop(myinfo); } @@ -2185,7 +2185,7 @@ void dpow_loop(void *arg) endmilli = startmilli + 30; } } - if ( counter > 100000 ) + if ( counter > 1000000 ) counter = 0; while ( OS_milliseconds() < endmilli ) usleep(10000); @@ -2308,7 +2308,6 @@ void iguana_main(void *arg) //iguana_helpinit(myinfo); //iguana_relays_init(myinfo); //basilisks_init(myinfo); - myinfo->basilisks.launched = iguana_launch(iguana_coinfind("BTCD"),"dpow_loop",dpow_loop,myinfo,IGUANA_PERMTHREAD); #ifdef __APPLE__ iguana_appletests(myinfo); #endif From 6d41cc09f9663d7fb060cf8c1595542f63ad3e0b Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 15 Mar 2019 13:23:11 +0800 Subject: [PATCH 160/167] fix --- iguana/main.c | 60 +++++++++++++++++++++++++-------------------------- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/iguana/main.c b/iguana/main.c index f707cf1a6..6766f7442 100755 --- a/iguana/main.c +++ b/iguana/main.c @@ -778,6 +778,36 @@ void jumblr_loop(void *ptr) } } +void dpow_loop(void *arg) +{ + struct supernet_info *myinfo = arg; double startmilli,endmilli; + int32_t counter = 0; + printf("start dpow loop\n"); + while ( 1 ) + { + counter++; + startmilli = OS_milliseconds(); + endmilli = startmilli + 1000; + if ( myinfo->IAMNOTARY != 0 ) + { + if ( myinfo->numdpows == 1 ) + { + iguana_dPoWupdate(myinfo,myinfo->DPOWS[0]); + endmilli = startmilli + 100; + } + else if ( myinfo->numdpows > 1 ) + { + iguana_dPoWupdate(myinfo,myinfo->DPOWS[counter % myinfo->numdpows]); + endmilli = startmilli + 30; + } + } + if ( counter > 1000000 ) + counter = 0; + while ( OS_milliseconds() < endmilli ) + usleep(10000); + } +} + void iguana_launchdaemons(struct supernet_info *myinfo) { int32_t i; char *helperargs,helperstr[512]; @@ -2162,36 +2192,6 @@ void komodo_REVS_merge(char *str,char *str2) getchar(); } -void dpow_loop(void *arg) -{ - struct supernet_info *myinfo = arg; double startmilli,endmilli; - int32_t counter = 0; - printf("start dpow loop\n"); - while ( 1 ) - { - counter++; - startmilli = OS_milliseconds(); - endmilli = startmilli + 1000; - if ( myinfo->IAMNOTARY != 0 ) - { - if ( myinfo->numdpows == 1 ) - { - iguana_dPoWupdate(myinfo,myinfo->DPOWS[0]); - endmilli = startmilli + 100; - } - else if ( myinfo->numdpows > 1 ) - { - iguana_dPoWupdate(myinfo,myinfo->DPOWS[counter % myinfo->numdpows]); - endmilli = startmilli + 30; - } - } - if ( counter > 1000000 ) - counter = 0; - while ( OS_milliseconds() < endmilli ) - usleep(10000); - } -} - int32_t komodo_initjson(char *fname); void iguana_main(void *arg) From 5e470c3ad91341a8feebb37552668ee5155a1ac8 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 15 Mar 2019 13:24:57 +0800 Subject: [PATCH 161/167] wtf is helper? --- iguana/main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/iguana/main.c b/iguana/main.c index 6766f7442..93b21b7e2 100755 --- a/iguana/main.c +++ b/iguana/main.c @@ -811,7 +811,7 @@ void dpow_loop(void *arg) void iguana_launchdaemons(struct supernet_info *myinfo) { int32_t i; char *helperargs,helperstr[512]; - if ( IGUANA_NUMHELPERS == 0 )//|| COMMANDLINE_ARGFILE != 0 ) + /*(if ( IGUANA_NUMHELPERS == 0 )//|| COMMANDLINE_ARGFILE != 0 ) IGUANA_NUMHELPERS = 1; for (i=0; i Date: Fri, 15 Mar 2019 13:26:44 +0800 Subject: [PATCH 162/167] print --- iguana/main.c | 1 + 1 file changed, 1 insertion(+) diff --git a/iguana/main.c b/iguana/main.c index 93b21b7e2..5d6345748 100755 --- a/iguana/main.c +++ b/iguana/main.c @@ -797,6 +797,7 @@ void dpow_loop(void *arg) } else if ( myinfo->numdpows > 1 ) { + fprintf(stderr, "doing coin.%i\n", counter % myinfo->numdpows); iguana_dPoWupdate(myinfo,myinfo->DPOWS[counter % myinfo->numdpows]); endmilli = startmilli + 30; } From 387ee71cc0f95b659545b53a51e45f67998bb0e6 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 15 Mar 2019 13:29:29 +0800 Subject: [PATCH 163/167] helper is RPC? --- iguana/main.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/iguana/main.c b/iguana/main.c index 5d6345748..eabf41f9d 100755 --- a/iguana/main.c +++ b/iguana/main.c @@ -812,7 +812,7 @@ void dpow_loop(void *arg) void iguana_launchdaemons(struct supernet_info *myinfo) { int32_t i; char *helperargs,helperstr[512]; - /*(if ( IGUANA_NUMHELPERS == 0 )//|| COMMANDLINE_ARGFILE != 0 ) + (if ( IGUANA_NUMHELPERS == 0 )//|| COMMANDLINE_ARGFILE != 0 ) IGUANA_NUMHELPERS = 1; for (i=0; i Date: Fri, 15 Mar 2019 13:32:09 +0800 Subject: [PATCH 164/167] fix --- iguana/main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/iguana/main.c b/iguana/main.c index eabf41f9d..309028fe9 100755 --- a/iguana/main.c +++ b/iguana/main.c @@ -812,7 +812,7 @@ void dpow_loop(void *arg) void iguana_launchdaemons(struct supernet_info *myinfo) { int32_t i; char *helperargs,helperstr[512]; - (if ( IGUANA_NUMHELPERS == 0 )//|| COMMANDLINE_ARGFILE != 0 ) + /*if ( IGUANA_NUMHELPERS == 0 )//|| COMMANDLINE_ARGFILE != 0 ) IGUANA_NUMHELPERS = 1; for (i=0; i Date: Fri, 15 Mar 2019 13:35:44 +0800 Subject: [PATCH 165/167] remove spam --- iguana/iguana_notary.c | 1 - iguana/main.c | 1 - 2 files changed, 2 deletions(-) diff --git a/iguana/iguana_notary.c b/iguana/iguana_notary.c index 7c85fda2f..a14151fad 100755 --- a/iguana/iguana_notary.c +++ b/iguana/iguana_notary.c @@ -227,7 +227,6 @@ void dpow_destupdate(struct supernet_info *myinfo,struct dpow_info *dp,int32_t h void iguana_dPoWupdate(struct supernet_info *myinfo,struct dpow_info *dp) { - printf("dPoW updated called!\n"); int32_t height,num; uint32_t blocktime; bits256 blockhash,merkleroot; struct iguana_info *src,*dest; //if ( strcmp(dp->symbol,"KMD") == 0 ) { diff --git a/iguana/main.c b/iguana/main.c index 309028fe9..46f6b7836 100755 --- a/iguana/main.c +++ b/iguana/main.c @@ -797,7 +797,6 @@ void dpow_loop(void *arg) } else if ( myinfo->numdpows > 1 ) { - fprintf(stderr, "doing coin.%i\n", counter % myinfo->numdpows); iguana_dPoWupdate(myinfo,myinfo->DPOWS[counter % myinfo->numdpows]); endmilli = startmilli + 30; } From e0e6d9efe59228e2b884602b5b08e6dab96dfe7b Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 15 Mar 2019 13:52:10 +0800 Subject: [PATCH 166/167] add STAKED build flag --- iguana/dpow/dpow_rpc.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/iguana/dpow/dpow_rpc.c b/iguana/dpow/dpow_rpc.c index 9459d9f05..efd2fbf84 100755 --- a/iguana/dpow/dpow_rpc.c +++ b/iguana/dpow/dpow_rpc.c @@ -188,6 +188,7 @@ int32_t komodo_initjson(char *fname) int32_t komodo_notaries(char *symbol,uint8_t pubkeys[64][33],int32_t height) { int32_t i,num=-1, didinit=0; struct iguana_info *coin; char params[64],*retstr; cJSON *retjson; +#if STAKED if ( (coin= iguana_coinfind("KMD")) != 0 ) { if ( coin->FULLNODE < 0 ) @@ -201,6 +202,7 @@ int32_t komodo_notaries(char *symbol,uint8_t pubkeys[64][33],int32_t height) } } } +#endif if ( Notaries_num > 0 ) { for (i=0; i Date: Fri, 15 Mar 2019 13:54:39 +0800 Subject: [PATCH 167/167] fix --- iguana/iguana_notary.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/iguana/iguana_notary.c b/iguana/iguana_notary.c index a14151fad..761238977 100755 --- a/iguana/iguana_notary.c +++ b/iguana/iguana_notary.c @@ -60,16 +60,16 @@ void dpow_checkpointset(struct supernet_info *myinfo,struct dpow_checkpoint *che int8_t is_STAKED(const char *chain_name) { - int8_t STAKED; + int8_t ret; if ( chain_name[0] == 0 ) return(0); if ( (strcmp(chain_name, "LABS") == 0) || (strncmp(chain_name, "LABS", 4) == 0) ) - STAKED = 1; // These chains are allowed coin emissions. + ret = 1; // These chains are allowed coin emissions. else if ( (strcmp(chain_name, "CFEK") == 0) || (strncmp(chain_name, "CFEK", 4) == 0) ) - STAKED = 2; // These chains have no speical rules at all. + ret = 2; // These chains have no speical rules at all. else if ( (strcmp(chain_name, "TEST") == 0) || (strncmp(chain_name, "TEST", 4) == 0) ) - STAKED = 3; // These chains are for testing consensus to create a chain etc. Not meant to be actually used for anything important. - return(STAKED); + ret = 3; // These chains are for testing consensus to create a chain etc. Not meant to be actually used for anything important. + return(ret); }; void dpow_srcupdate(struct supernet_info *myinfo,struct dpow_info *dp,int32_t height,bits256 hash,uint32_t timestamp,uint32_t blocktime)