Browse Source

Merge pull request #768 from jl777/dev

Dev
patch-6
jl777 7 years ago
committed by GitHub
parent
commit
13d171a68b
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 14
      iguana/dPoW.h
  2. 75
      iguana/dpow/dpow_fsm.c
  3. 7
      iguana/dpow/dpow_network.c
  4. 39
      iguana/dpow/dpow_rpc.c
  5. 12
      iguana/dpow/dpow_tx.c
  6. 2
      iguana/exchanges/withdraw
  7. 12
      iguana/iguana_notary.c
  8. 1
      iguana/m_notary_testnet
  9. 2
      includes/iguana_structs.h

14
iguana/dPoW.h

@ -16,6 +16,8 @@
#ifndef INCLUDE_DPOW_H
#define INCLUDE_DPOW_H
#define DPOW_MAXMOMDEPTH (1440 * 7)
#define DPOW_FIRSTRATIFY 1000
#define DPOW_CHECKPOINTFREQ 10
@ -141,8 +143,18 @@ struct dpow_info
uint32_t ipbits[128],numipbits;
struct dpow_block **blocks;
};
struct komodo_ccdatapair { int32_t notarization_height; uint32_t MoMoMoffset; };
struct komodo_ccdataMoMoM
{
bits256 MoMoM;
int32_t kmdstarti,kmdendi,MoMoMdepth,numpairs,len;
struct komodo_ccdatapair *pairs;
};
uint64_t dpow_notarybestk(uint64_t refmask,struct dpow_block *bp,int8_t *lastkp);
int32_t dpow_paxpending(uint8_t *hex,uint32_t *paxwdcrcp,bits256 MoM,uint32_t MoMdepth);
int32_t dpow_paxpending(uint8_t *hex,int32_t hexsize,uint32_t *paxwdcrcp,bits256 MoM,uint32_t MoMdepth,int32_t src_or_dest,struct dpow_block *bp);
void dex_updateclient(struct supernet_info *myinfo);
char *dex_reqsend(struct supernet_info *myinfo,char *handler,uint8_t *data,int32_t datalen,int32_t M,char *field);
char *basilisk_respond_addmessage(struct supernet_info *myinfo,uint8_t *key,int32_t keylen,uint8_t *data,int32_t datalen,int32_t sendping,uint32_t duration);

75
iguana/dpow/dpow_fsm.c

@ -162,7 +162,8 @@ int32_t dpow_checkutxo(struct supernet_info *myinfo,struct dpow_info *dp,struct
uint32_t Numallocated;
int32_t dpow_opreturn_parsesrc(bits256 *blockhashp,int32_t *heightp,bits256 *txidp,char *symbol,bits256 *MoMp,uint32_t *MoMdepthp,uint8_t *opret,int32_t opretlen)
int32_t dpow_opreturn_parsesrc(bits256 *blockhashp,int32_t *heightp,bits256 *txidp,char *symbol,bits256 *MoMp,uint32_t *MoMdepthp,uint8_t *opret,int32_t opretlen,struct komodo_ccdataMoMoM
*mdata)
{
int32_t i,c,len,offset = 0; uint8_t op;
symbol[0] = 0;
@ -171,6 +172,7 @@ int32_t dpow_opreturn_parsesrc(bits256 *blockhashp,int32_t *heightp,bits256 *txi
memset(txidp->bytes,0,sizeof(*txidp));
memset(MoMp->bytes,0,sizeof(*MoMp));
memset(MoMdepthp,0,sizeof(*MoMdepthp));
memset(mdata,0,sizeof(*mdata));
if ( opret[offset++] == 0x6a )
{
if ( (op= opret[offset++]) < 0x4c )
@ -198,16 +200,37 @@ int32_t dpow_opreturn_parsesrc(bits256 *blockhashp,int32_t *heightp,bits256 *txi
}
if ( offset+sizeof(bits256)+sizeof(uint32_t) <= opretlen )
{
uint32_t CCid,k;
offset += iguana_rwbignum(0,&opret[offset],sizeof(*MoMp),MoMp->bytes);
offset += iguana_rwnum(0,&opret[offset],sizeof(*MoMdepthp),(uint32_t *)MoMdepthp);
// MoMoM, depth, numpairs, (notarization ht, MoMoM offset)
if ( offset+52 <= opretlen )
{
offset += iguana_rwnum(0,&opret[offset],sizeof(CCid),(uint8_t *)&CCid);
offset += iguana_rwnum(0,&opret[offset],sizeof(uint32_t),(uint8_t *)&mdata->kmdstarti);
offset += iguana_rwnum(0,&opret[offset],sizeof(uint32_t),(uint8_t *)&mdata->kmdendi);
offset += iguana_rwbignum(0,&opret[offset],sizeof(mdata->MoMoM),(uint8_t *)&mdata->MoMoM);
offset += iguana_rwnum(0,&opret[offset],sizeof(uint32_t),(uint8_t *)&mdata->MoMoMdepth);
offset += iguana_rwnum(0,&opret[offset],sizeof(uint32_t),(uint8_t *)&mdata->numpairs);
mdata->len += sizeof(mdata->MoMoM) + sizeof(uint32_t)*4;
if ( offset+mdata->numpairs*8 == opretlen )
{
mdata->pairs = (struct komodo_ccdatapair *)calloc(mdata->numpairs,sizeof(*mdata->pairs));
for (k=0; k<mdata->numpairs; k++)
{
offset += iguana_rwnum(0,&opret[offset],sizeof(int32_t),(uint8_t *)&mdata->pairs[k].notarization_height);
offset += iguana_rwnum(0,&opret[offset],sizeof(uint32_t),(uint8_t *)&mdata->pairs[k].MoMoMoffset);
mdata->len += sizeof(uint32_t) * 2;
}
} else if ( mdata->numpairs > 0 )
printf("offset.%d + %d*8 != opretlen.%d\n",offset,mdata->numpairs,opretlen);
}
}
///printf("offset.%d vs len.%d\n",offset,len);
return(len);
}
return(-1);
}
int32_t dpow_txhasnotarization(uint64_t *signedmaskp,int32_t *nothtp,struct supernet_info *myinfo,struct iguana_info *coin,bits256 txid,int32_t height)
int32_t dpow_txhasnotarization(uint64_t *signedmaskp,int32_t *nothtp,struct supernet_info *myinfo,struct iguana_info *coin,bits256 txid,int32_t height,struct komodo_ccdataMoMoM *mdata)
{
cJSON *txobj,*vins,*vin,*vouts,*vout,*spentobj,*sobj; char *hexstr; uint8_t script[256]; bits256 spenttxid; uint64_t notarymask=0; int32_t i,j,numnotaries,len,spentvout,numvins,numvouts,hasnotarization = 0;
if ( (txobj= dpow_gettransaction(myinfo,coin,txid)) != 0 )
@ -269,12 +292,25 @@ int32_t dpow_txhasnotarization(uint64_t *signedmaskp,int32_t *nothtp,struct supe
{
len >>= 1;
decode_hex(script,len,hexstr);
if ( dpow_opreturn_parsesrc(&blockhash,nothtp,&txid,symbol,&MoM,&MoMdepth,script,len) > 0 )
if ( dpow_opreturn_parsesrc(&blockhash,nothtp,&txid,symbol,&MoM,&MoMdepth,script,len,mdata) > 0 && strcmp(symbol,coin->symbol) == 0 )
{
if ( Notaries_port != DPOW_SOCKPORT )
// if ( Notaries_port != DPOW_SOCKPORT ) // keep going till valid MoM found, useful for new chains without any MoM
{
if ( bits256_nonz(MoM) == 0 || MoMdepth == 0 || *nothtp >= height || *nothtp < 0 )
{
*nothtp = 0;
}
}
if ( mdata->pairs != 0 && mdata->numpairs > 0 )
{
for (j=0; j<mdata->numpairs; j++)
{
if ( mdata->pairs[j].notarization_height > coin->MoMoMheight )
{
coin->MoMoMheight = mdata->pairs[j].notarization_height;
printf("set %s MoMoMheight <- %d\n",coin->symbol,coin->MoMoMheight);
}
}
}
//printf("%s.%d notarizationht.%d %s -> %s MoM.%s [%d]\n",symbol,height,*nothtp,bits256_str(str,blockhash),bits256_str(str2,txid),bits256_str(str3,MoM),MoMdepth);
}
@ -291,17 +327,18 @@ int32_t dpow_txhasnotarization(uint64_t *signedmaskp,int32_t *nothtp,struct supe
return(hasnotarization);
}
int32_t dpow_hasnotarization(uint64_t *signedmaskp,int32_t *nothtp,struct supernet_info *myinfo,struct iguana_info *coin,cJSON *blockjson,int32_t ht)
int32_t dpow_hasnotarization(uint64_t *signedmaskp,int32_t *nothtp,struct supernet_info *myinfo,struct iguana_info *coin,cJSON *blockjson,int32_t ht,struct komodo_ccdataMoMoM *mdata)
{
int32_t i,n,hasnotarization = 0; bits256 txid; cJSON *txarray;
*nothtp = 0;
*signedmaskp = 0;
memset(mdata,0,sizeof(*mdata));
if ( (txarray= jarray(&n,blockjson,"tx")) != 0 )
{
for (i=0; i<n; i++)
{
txid = jbits256i(txarray,i);
hasnotarization += dpow_txhasnotarization(signedmaskp,nothtp,myinfo,coin,txid,ht);
hasnotarization += dpow_txhasnotarization(signedmaskp,nothtp,myinfo,coin,txid,ht,mdata);
}
}
return(hasnotarization);
@ -309,7 +346,7 @@ int32_t dpow_hasnotarization(uint64_t *signedmaskp,int32_t *nothtp,struct supern
bits256 dpow_calcMoM(uint32_t *MoMdepthp,struct supernet_info *myinfo,struct iguana_info *coin,int32_t height)
{
bits256 MoM,blockhash,merkle,*merkles; cJSON *blockjson; uint64_t signedmask; int32_t breakht=0,notht=0,ht,maxdepth = 1440,MoMdepth = 0;
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);
@ -328,10 +365,9 @@ bits256 dpow_calcMoM(uint32_t *MoMdepthp,struct supernet_info *myinfo,struct igu
blockhash = dpow_getblockhash(myinfo,coin,ht);
if ( (blockjson= dpow_getblock(myinfo,coin,blockhash)) != 0 )
{
if ( breakht == 0 && dpow_hasnotarization(&signedmask,&notht,myinfo,coin,blockjson,ht) > 0 )
if ( breakht == 0 && dpow_hasnotarization(&signedmask,&notht,myinfo,coin,blockjson,ht,&mdata) > 0 )
{
breakht = notht;
//free_json(blockjson);
printf("%s has notarization at %d for breakht.%d\n",coin->symbol,ht,notht);
}
merkle = jbits256(blockjson,"merkleroot");
@ -342,6 +378,8 @@ bits256 dpow_calcMoM(uint32_t *MoMdepthp,struct supernet_info *myinfo,struct igu
{
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;
}
}
@ -349,6 +387,8 @@ bits256 dpow_calcMoM(uint32_t *MoMdepthp,struct supernet_info *myinfo,struct igu
{
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;
@ -376,7 +416,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,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;
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;
memset(&zero,0,sizeof(zero));
MoM = zero;
srcprevtxid0 = destprevtxid0 = zero;
@ -616,9 +656,11 @@ void dpow_statemachinestart(void *ptr)
starttime = (uint32_t)time(NULL);
if ( bp->isratify == 0 )
{
//if ( (starttime= checkpoint.timestamp) == 0 )
bp->starttime = starttime;
extralen = dpow_paxpending(extras,&bp->paxwdcrc,bp->MoM,bp->MoMdepth);
if ( strcmp(bp->destcoin->symbol,"KMD") == 0 )
src_or_dest = 0;
else src_or_dest = 1;
extralen = dpow_paxpending(extras,sizeof(extras),&bp->paxwdcrc,bp->MoM,bp->MoMdepth,src_or_dest,bp);
bp->notaries[bp->myind].paxwdcrc = bp->paxwdcrc;
}
printf("PAXWDCRC.%x myind.%d isratify.%d DPOW.%s statemachine checkpoint.%d %s start.%u+dur.%d vs %ld\n",bp->paxwdcrc,bp->myind,bp->isratify,src->symbol,checkpoint.blockhash.height,bits256_str(str,checkpoint.blockhash.hash),starttime,bp->duration,time(NULL));
@ -636,7 +678,10 @@ void dpow_statemachinestart(void *ptr)
printf("break due to already ratifying\n");
break;
}
extralen = dpow_paxpending(extras,&bp->paxwdcrc,bp->MoM,bp->MoMdepth);
if ( strcmp(bp->destcoin->symbol,"KMD") == 0 )
src_or_dest = 0;
else src_or_dest = 1;
extralen = dpow_paxpending(extras,sizeof(extras),&bp->paxwdcrc,bp->MoM,bp->MoMdepth,src_or_dest,bp);
bp->notaries[bp->myind].paxwdcrc = bp->paxwdcrc;
}
if ( (checkpoint.blockhash.height % 100) != 0 && dp->checkpoint.blockhash.height > checkpoint.blockhash.height )

7
iguana/dpow/dpow_network.c

@ -1923,7 +1923,7 @@ void dpow_nanoutxoget(struct supernet_info *myinfo,struct dpow_info *dp,struct d
void dpow_send(struct supernet_info *myinfo,struct dpow_info *dp,struct dpow_block *bp,bits256 srchash,bits256 desthash,uint32_t channel,uint32_t msgbits,uint8_t *data,int32_t datalen)
{
struct dpow_nanomsghdr *np; int32_t i,size,extralen=0,sentbytes = 0; uint32_t crc32,paxwdcrc; uint8_t extras[10000];
struct dpow_nanomsghdr *np; int32_t i,src_or_dest,size,extralen=0,sentbytes = 0; uint32_t crc32,paxwdcrc; uint8_t extras[10000];
if ( bp->myind < 0 )
return;
if ( time(NULL) < myinfo->nanoinit+5 )
@ -1944,7 +1944,10 @@ void dpow_send(struct supernet_info *myinfo,struct dpow_info *dp,struct dpow_blo
//printf(" dpow_send.(%d) size.%d numipbits.%d myind.%d\n",datalen,size,np->numipbits,bp->myind);
if ( bp->isratify == 0 )
{
extralen = dpow_paxpending(extras,&paxwdcrc,bp->MoM,bp->MoMdepth);
if ( strcmp(bp->destcoin->symbol,"KMD") == 0 )
src_or_dest = 0;
else src_or_dest = 1;
extralen = dpow_paxpending(extras,sizeof(extras),&paxwdcrc,bp->MoM,bp->MoMdepth,src_or_dest,bp);
bp->paxwdcrc = bp->notaries[bp->myind].paxwdcrc = np->notarize.paxwdcrc = paxwdcrc;
//dpow_bestconsensus(bp);
dpow_nanoutxoset(myinfo,dp,&np->notarize,bp,0);

39
iguana/dpow/dpow_rpc.c

@ -226,18 +226,51 @@ bits256 dpow_getbestblockhash(struct supernet_info *myinfo,struct iguana_info *c
return(blockhash);
}
int32_t dpow_paxpending(uint8_t *hex,uint32_t *paxwdcrcp,bits256 MoM,uint32_t MoMdepth)
cJSON *dpow_MoMoMdata(struct iguana_info *coin,char *symbol,int32_t kmdheight)
{
char buf[128],*retstr=0; cJSON *retjson = 0; struct iguana_info *src;
if ( coin->FULLNODE < 0 && strcmp(coin->symbol,"KMD") == 0 && (src= iguana_coinfind(symbol)) != 0 )
{
sprintf(buf,"[\"%s\", \"%d\", \"%d\"]",symbol,kmdheight,src->MoMoMheight);
if ( (retstr= bitcoind_passthru(coin->symbol,coin->chain->serverport,coin->chain->userpass,"MoMoMdata",buf)) != 0 )
{
retjson = cJSON_Parse(retstr);
printf("MoMoM.%s -> %s\n",buf,retstr);
free(retstr);
}
usleep(10000);
}
return(retjson);
}
int32_t dpow_paxpending(uint8_t *hex,int32_t hexsize,uint32_t *paxwdcrcp,bits256 MoM,uint32_t MoMdepth,int32_t src_or_dest,struct dpow_block *bp)
{
struct iguana_info *coin; char *retstr,*hexstr; cJSON *retjson; int32_t n=0; uint32_t paxwdcrc;
struct iguana_info *coin,*kmdcoin=0; char *retstr,*hexstr; cJSON *retjson; int32_t hexlen=0,n=0; uint32_t paxwdcrc;
paxwdcrc = 0;
//if ( Notaries_port != DPOW_SOCKPORT )
{
n += iguana_rwbignum(1,&hex[n],sizeof(MoM),MoM.bytes);
n += iguana_rwnum(1,&hex[n],sizeof(MoMdepth),(uint32_t *)&MoMdepth);
if ( strcmp(bp->srccoin->symbol,"PIZZA") == 0 && src_or_dest == 0 && strcmp(bp->destcoin->symbol,"KMD") == 0 )
{
kmdcoin = bp->destcoin;
if ( (bp->height % 10) == 0 && kmdcoin->lastbestheight > 100 && (retjson= dpow_MoMoMdata(kmdcoin,bp->srccoin->symbol,(kmdcoin->lastbestheight/10)*10 - 5)) != 0 )
{
if ( (hexstr= jstr(retjson,"data")) != 0 && (hexlen= (int32_t)strlen(hexstr)) > 0 && n+hexlen/2 <= hexsize )
{
hexlen >>= 1;
decode_hex(&hex[n],hexlen,hexstr), n += hexlen;
}
free_json(retjson);
}
}
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);
}
*paxwdcrcp = paxwdcrc;
*paxwdcrcp = paxwdcrc;
return(n);
if ( (coin= iguana_coinfind("KMD")) != 0 )
{

12
iguana/dpow/dpow_tx.c

@ -226,17 +226,9 @@ int32_t dpow_voutstandard(struct dpow_block *bp,uint8_t *serialized,int32_t m,in
}
printf("numvouts.%d len.%d RATIFY vouts\n",numvouts,len);
}
/*if ( 0 && (src_or_dest == 0 || strcmp(bp->destcoin->symbol,"BTC") != 0) && (n= dpow_paxpending(extras,&paxwdcrc,bp->MoM,bp->MoMdepth)) > 0 )
if ( bp->MoMdepth > 0 && (strcmp(bp->destcoin->symbol,"KMD") == 0 || strcmp(bp->srccoin->symbol,"KMD") == 0) )
{
for (i=0; i<n; i++)
printf("%02x",extras[i]);
printf(" <- withdraw.%d %08x\n",n,paxwdcrc);
}
else*/ if ( bp->MoMdepth > 0 && (strcmp(bp->destcoin->symbol,"KMD") == 0 || strcmp(bp->srccoin->symbol,"KMD") == 0) )
{
n = dpow_paxpending(extras,&paxwdcrc,bp->MoM,bp->MoMdepth);
//n += iguana_rwbignum(1,&extras[n],sizeof(bp->MoM),bp->MoM.bytes);
//n += iguana_rwnum(1,&extras[n],sizeof(bp->MoMdepth),(uint32_t *)&bp->MoMdepth);
n = dpow_paxpending(extras,sizeof(extras),&paxwdcrc,bp->MoM,bp->MoMdepth,src_or_dest,bp);
}
satoshis = 0;
len += iguana_rwnum(1,&serialized[len],sizeof(satoshis),&satoshis);

2
iguana/exchanges/withdraw

@ -1,3 +1,3 @@
#!/bin/bash
source userpass
curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"withdraw\",\"coin\":\"KMD\",\"outputs\":[{\"RUgW6fLfVsLJ87Ng4zJTqNedJSKYQ9ToAf\":0.001}, {\"RUgW6fLfVsLJ87Ng4zJTqNedJSKYQ9ToAf\":0.002}]}"
curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"withdraw\",\"coin\":\"KMD\",\"outputs\":[{\"RUgW6fLfVsLJ87Ng4zJTqNedJSKYQ9ToAf\":0.001}, {\"RUgW6fLfVsLJ87Ng4zJTqNedJSKYQ9ToAf\":0.002}],\"broadcast\":1}"

12
iguana/iguana_notary.c

@ -60,7 +60,7 @@ 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)
{
void **ptrs; char str[65]; cJSON *blockjson; struct iguana_info *coin; struct dpow_checkpoint checkpoint; int32_t freq,minsigs,i,ht,notht; uint64_t signedmask; struct dpow_block *bp;
struct komodo_ccdataMoMoM mdata; void **ptrs; char str[65]; cJSON *blockjson; struct iguana_info *coin; struct dpow_checkpoint checkpoint; int32_t freq,minsigs,i,ht,notht; uint64_t signedmask; struct dpow_block *bp;
dpow_checkpointset(myinfo,&dp->last,height,hash,timestamp,blocktime);
checkpoint = dp->srcfifo[dp->srcconfirms];
if ( strcmp("BTC",dp->dest) == 0 )
@ -88,8 +88,10 @@ void dpow_srcupdate(struct supernet_info *myinfo,struct dpow_info *dp,int32_t he
if ( (blockjson= dpow_getblock(myinfo,coin,hash)) != 0 )
{
height = jint(blockjson,"height");
if ( dpow_hasnotarization(&signedmask,&notht,myinfo,coin,blockjson,height) <= 0 )
if ( dpow_hasnotarization(&signedmask,&notht,myinfo,coin,blockjson,height,&mdata) <= 0 )
{
if ( mdata.pairs != 0 )
free(mdata.pairs);
blocktime = juint(blockjson,"time");
free_json(blockjson);
if ( height > 0 && blocktime > 0 )
@ -579,7 +581,7 @@ void iguana_notarystats(int32_t totals[64],int32_t dispflag)
STRING_AND_TWOINTS(dpow,notarizations,symbol,height,numblocks)
{
int32_t i,j,ht,maxheight,notht,masksums[64]; uint64_t signedmask; cJSON *retjson,*blockjson,*item,*array; bits256 blockhash;
struct komodo_ccdataMoMoM mdata; int32_t i,j,ht,maxheight,notht,masksums[64]; uint64_t signedmask; cJSON *retjson,*blockjson,*item,*array; bits256 blockhash;
memset(masksums,0,sizeof(masksums));
ht = height;
if ( (coin= iguana_coinfind(symbol)) != 0 )
@ -597,8 +599,10 @@ STRING_AND_TWOINTS(dpow,notarizations,symbol,height,numblocks)
blockhash = dpow_getblockhash(myinfo,coin,ht);
if ( (blockjson= dpow_getblock(myinfo,coin,blockhash)) != 0 )
{
if ( dpow_hasnotarization(&signedmask,&notht,myinfo,coin,blockjson,ht) > 0 )
if ( dpow_hasnotarization(&signedmask,&notht,myinfo,coin,blockjson,ht,&mdata) > 0 )
{
if ( mdata.pairs != 0 )
free(mdata.pairs);
for (j=0; j<64; j++)
if ( ((1LL << j) & signedmask) != 0 )
masksums[j]++;

1
iguana/m_notary_testnet

@ -29,3 +29,4 @@ curl --url "http://127.0.0.1:7776" --data "{\"conf\":\"PIZZA.conf\",\"path\":\"$
curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"KMD\",\"pubkey\":\"$pubkey\"}"
#curl --url "http://127.0.0.1:7776" --data "{\"timeout\":60000,\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"BEER\",\"pubkey\":\"$pubkey\"}"
curl --url "http://127.0.0.1:7776" --data "{\"timeout\":60000,\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"PIZZA\",\"pubkey\":\"$pubkey\"}"

2
includes/iguana_structs.h

@ -499,7 +499,7 @@ struct iguana_info
uint32_t fastfind; FILE *fastfps[0x100]; uint8_t *fast[0x100]; int32_t *fasttables[0x100]; long fastsizes[0x100];
uint64_t instance_nonce,myservices,totalsize,totalrecv,totalpackets,sleeptime;
int64_t mining,totalfees,TMPallocated,MAXRECVCACHE,MAXMEM,PREFETCHLAG,estsize,activebundles;
int32_t MAXPEERS,MAXPENDINGREQUESTS,MAXBUNDLES,MAXSTUCKTIME,active,closestbundle,numemitted,lastsweep,numemit,startutc,newramchain,numcached,cachefreed,helperdepth,startPEND,endPEND,enableCACHE,FULLNODE,VALIDATENODE,origbalanceswritten,balanceswritten,lastRTheight,RTdatabad;
int32_t MoMoMheight,MAXPEERS,MAXPENDINGREQUESTS,MAXBUNDLES,MAXSTUCKTIME,active,closestbundle,numemitted,lastsweep,numemit,startutc,newramchain,numcached,cachefreed,helperdepth,startPEND,endPEND,enableCACHE,FULLNODE,VALIDATENODE,origbalanceswritten,balanceswritten,lastRTheight,RTdatabad;
bits256 balancehash,allbundles;
uint32_t lastsync,parsetime,numiAddrs,lastpossible,bundlescount,savedblocks,backlog,spendvectorsaved,laststats,lastinv2,symbolcrc,spendvalidated; char VALIDATEDIR[512];
int32_t longestchain,badlongestchain,longestchain_strange,RTramchain_busy,emitbusy,stuckiters,virtualchain,RTheight,RTreset_needed;

Loading…
Cancel
Save