diff --git a/iguana/dpow/dpow_fsm.c b/iguana/dpow/dpow_fsm.c index 228ce1038..03fc81544 100755 --- a/iguana/dpow/dpow_fsm.c +++ b/iguana/dpow/dpow_fsm.c @@ -230,81 +230,6 @@ int32_t dpow_opreturn_parsesrc(bits256 *blockhashp,int32_t *heightp,bits256 *txi return(-1); } -/*bits256 dpow_calcMoM(uint32_t *MoMdepthp,struct supernet_info *myinfo,struct iguana_info *coin,int32_t height) -{ - struct komodo_ccdataMoMoM mdata; bits256 MoM,blockhash,merkle,*merkles; cJSON *blockjson; uint64_t signedmask; int32_t breakht=0,notht=0,ht,maxdepth = DPOW_MAXMOMDEPTH,MoMdepth = 0; - memset(MoM.bytes,0,sizeof(MoM)); - blockhash = dpow_getblockhash(myinfo,coin,height); - //printf("start MoM calc %s height.%d\n",coin->symbol,height); - if ( (blockjson= dpow_getblock(myinfo,coin,blockhash)) != 0 ) - { - merkle = jbits256(blockjson,"merkleroot"); - free_json(blockjson); - if ( bits256_nonz(merkle) != 0 ) - { - merkles = calloc(4*maxdepth+1,sizeof(*merkles)); - merkles[MoMdepth++] = merkle; - ht = height - MoMdepth; - while ( MoMdepth < maxdepth && ht > breakht && ht > 0 ) - { - //fprintf(stderr,"%s.%d ",coin->symbol,ht); - blockhash = dpow_getblockhash(myinfo,coin,ht); - if ( (blockjson= dpow_getblock(myinfo,coin,blockhash)) != 0 ) - { - if ( breakht == 0 && dpow_hasnotarization(&signedmask,¬ht,myinfo,coin,blockjson,ht,&mdata) > 0 ) - { - breakht = notht; - printf("%s has notarization at %d for breakht.%d\n",coin->symbol,ht,notht); - } - merkle = jbits256(blockjson,"merkleroot"); - free_json(blockjson); - if ( bits256_nonz(merkle) != 0 ) - merkles[MoMdepth++] = merkle; - else - { - printf("%s MoMdepth.%d ht.%d from height.%d, null merkleroot\n",coin->symbol,MoMdepth,ht,height); - MoMdepth = 0; - if ( mdata.pairs != 0 ) - free(mdata.pairs); - break; - } - } - else - { - printf("%s MoMdepth.%d ht.%d from height.%d, no blockhash\n",coin->symbol,MoMdepth,ht,height); - MoMdepth = 0; - if ( mdata.pairs != 0 ) - free(mdata.pairs); - break; - } - ht = height - MoMdepth; - usleep(10000); - } - if ( MoMdepth > 0 ) - { - MoM = iguana_merkle(coin->symbol,merkles,MoMdepth); - char str[65]; printf("%s from height.%d ht.%d MoMdepth.%d -> MoM %s\n",coin->symbol,height,ht,MoMdepth,bits256_str(str,MoM)); - } - else - { - printf("unexpected %s from height.%d MoMdepth.%d vs max.%d\n",coin->symbol,height,MoMdepth,maxdepth); - MoMdepth = 0; - } - free(merkles); - } else printf("%s.ht%d null merkles\n",coin->symbol,height); - } else printf("%s.ht%d null block\n",coin->symbol,height); - *MoMdepthp = MoMdepth; - //printf("done MoM calc %s height.%d MoMdepth.%d\n",coin->symbol,height,MoMdepth); - return(MoM); -}*/ - -/*{ - "coin": "PIZZA", - "height": 30623, - "MoMdepth": 10000, - "MoM": "797239cfd3611d359ec515fa493062cc2838172a99fd86de1d0305d009abde40" -}*/ - bits256 dpow_calcMoM(uint32_t *MoMdepthp,struct supernet_info *myinfo,struct iguana_info *coin,int32_t height) { bits256 MoM; cJSON *MoMjson,*infojson; int32_t prevMoMheight;