Browse Source

Merge pull request #266 from jl777/dev

Dev
dPoW
jl777 8 years ago
committed by GitHub
parent
commit
d1a9161535
  1. 3
      basilisk/basilisk.c
  2. 214
      iguana/dpow/dpow_network.c
  3. 2
      iguana/iguana777.h
  4. 4
      iguana/iguana_payments.c

3
basilisk/basilisk.c

@ -903,13 +903,14 @@ void basilisks_loop(void *arg)
{ {
dp = &myinfo->DPOWS[counter % myinfo->numdpows]; dp = &myinfo->DPOWS[counter % myinfo->numdpows];
iguana_dPoWupdate(myinfo,dp); iguana_dPoWupdate(myinfo,dp);
if ( (counter % myinfo->numdpows) != 0 ) //if ( (counter % myinfo->numdpows) != 0 )
{ {
//fprintf(stderr,"F "); //fprintf(stderr,"F ");
iguana_dPoWupdate(myinfo,&myinfo->DPOWS[0]); iguana_dPoWupdate(myinfo,&myinfo->DPOWS[0]);
} }
endmilli = startmilli + 30; endmilli = startmilli + 30;
} }
//fprintf(stderr,"F ");
} }
else else
{ {

214
iguana/dpow/dpow_network.c

@ -287,9 +287,9 @@ char *_dex_reqsend(struct supernet_info *myinfo,char *handler,uint8_t *key,int32
{ {
timeout = 1000; timeout = 1000;
nn_setsockopt(reqsock,NN_SOL_SOCKET,NN_SNDTIMEO,&timeout,sizeof(timeout)); nn_setsockopt(reqsock,NN_SOL_SOCKET,NN_SNDTIMEO,&timeout,sizeof(timeout));
timeout = 5000; //timeout = 5000;
nn_setsockopt(reqsock,NN_TCP,NN_RECONNECT_IVL,&timeout,sizeof(timeout)); //nn_setsockopt(reqsock,NN_TCP,NN_RECONNECT_IVL,&timeout,sizeof(timeout));
timeout = 10000; timeout = 1000;
nn_setsockopt(reqsock,NN_SOL_SOCKET,NN_RCVTIMEO,&timeout,sizeof(timeout)); nn_setsockopt(reqsock,NN_SOL_SOCKET,NN_RCVTIMEO,&timeout,sizeof(timeout));
for (i=0; i<sizeof(myinfo->dexseed_ipaddrs)/sizeof(*myinfo->dexseed_ipaddrs); i++) for (i=0; i<sizeof(myinfo->dexseed_ipaddrs)/sizeof(*myinfo->dexseed_ipaddrs); i++)
if ( nn_connect(reqsock,nanomsg_tcpname(0,str,myinfo->dexseed_ipaddrs[i],REP_SOCK)) < 0 ) if ( nn_connect(reqsock,nanomsg_tcpname(0,str,myinfo->dexseed_ipaddrs[i],REP_SOCK)) < 0 )
@ -318,8 +318,8 @@ char *_dex_reqsend(struct supernet_info *myinfo,char *handler,uint8_t *key,int32
nn_setsockopt(subsock,NN_SOL_SOCKET,NN_RCVTIMEO,&timeout,sizeof(timeout)); nn_setsockopt(subsock,NN_SOL_SOCKET,NN_RCVTIMEO,&timeout,sizeof(timeout));
nn_setsockopt(subsock,NN_SUB,NN_SUB_SUBSCRIBE,"",0); nn_setsockopt(subsock,NN_SUB,NN_SUB_SUBSCRIBE,"",0);
printf("CLIENT sockets req.%d sub.%d\n",reqsock,subsock); printf("CLIENT sockets req.%d sub.%d\n",reqsock,subsock);
timeout = 5000; //timeout = 5000;
nn_setsockopt(reqsock,NN_TCP,NN_RECONNECT_IVL,&timeout,sizeof(timeout)); //nn_setsockopt(reqsock,NN_TCP,NN_RECONNECT_IVL,&timeout,sizeof(timeout));
timeout = 10000; timeout = 10000;
nn_setsockopt(reqsock,NN_SOL_SOCKET,NN_RCVTIMEO,&timeout,sizeof(timeout)); nn_setsockopt(reqsock,NN_SOL_SOCKET,NN_RCVTIMEO,&timeout,sizeof(timeout));
} }
@ -408,14 +408,14 @@ char *_dex_reqsend(struct supernet_info *myinfo,char *handler,uint8_t *key,int32
printf("%d: subscribe connect (%s)\n",myinfo->numdexipbits,str); printf("%d: subscribe connect (%s)\n",myinfo->numdexipbits,str);
} }
} }
//#ifndef __APPLE__ #ifndef __APPLE__
if ( (rand() % 100) < 40 ) if ( (rand() % 100) < 40 )
{ {
nanomsg_tcpname(0,str,ipaddr,REP_SOCK); nanomsg_tcpname(0,str,ipaddr,REP_SOCK);
nn_connect(myinfo->reqsock,str); nn_connect(myinfo->reqsock,str);
printf("%d: req connect (%s)\n",myinfo->numdexipbits,str); printf("%d: req connect (%s)\n",myinfo->numdexipbits,str);
} }
//#endif #endif
} }
} }
if ( freeptr != 0 ) if ( freeptr != 0 )
@ -960,6 +960,7 @@ char *_dex_sendrawtransaction(struct supernet_info *myinfo,char *symbol,char *si
char *_dex_importaddress(struct supernet_info *myinfo,char *symbol,char *address) char *_dex_importaddress(struct supernet_info *myinfo,char *symbol,char *address)
{ {
struct dex_request dexreq; struct dex_request dexreq;
return(clonestr("{\"error\":\"importaddress deprecated\"}"));
memset(&dexreq,0,sizeof(dexreq)); memset(&dexreq,0,sizeof(dexreq));
safecopy(dexreq.name,symbol,sizeof(dexreq.name)); safecopy(dexreq.name,symbol,sizeof(dexreq.name));
dexreq.func = 'A'; dexreq.func = 'A';
@ -1262,12 +1263,13 @@ void dpow_nanomsginit(struct supernet_info *myinfo,char *ipaddr)
} }
else else
{ {
timeout = 500; timeout = 100;
nn_setsockopt(repsock,NN_SOL_SOCKET,NN_SNDTIMEO,&timeout,sizeof(timeout)); nn_setsockopt(repsock,NN_SOL_SOCKET,NN_SNDTIMEO,&timeout,sizeof(timeout));
nn_setsockopt(dexsock,NN_SOL_SOCKET,NN_SNDTIMEO,&timeout,sizeof(timeout)); nn_setsockopt(dexsock,NN_SOL_SOCKET,NN_SNDTIMEO,&timeout,sizeof(timeout));
timeout = 10; nn_setsockopt(pubsock,NN_SOL_SOCKET,NN_SNDTIMEO,&timeout,sizeof(timeout));
timeout = 1;
nn_setsockopt(dexsock,NN_SOL_SOCKET,NN_RCVTIMEO,&timeout,sizeof(timeout)); nn_setsockopt(dexsock,NN_SOL_SOCKET,NN_RCVTIMEO,&timeout,sizeof(timeout));
timeout = 500; timeout = 1;
nn_setsockopt(repsock,NN_SOL_SOCKET,NN_RCVTIMEO,&timeout,sizeof(timeout)); nn_setsockopt(repsock,NN_SOL_SOCKET,NN_RCVTIMEO,&timeout,sizeof(timeout));
maxsize = 1024 * 1024; maxsize = 1024 * 1024;
printf("RCVBUF.%d\n",nn_setsockopt(dexsock,NN_SOL_SOCKET,NN_RCVBUF,&maxsize,sizeof(maxsize))); printf("RCVBUF.%d\n",nn_setsockopt(dexsock,NN_SOL_SOCKET,NN_RCVBUF,&maxsize,sizeof(maxsize)));
@ -1281,7 +1283,7 @@ void dpow_nanomsginit(struct supernet_info *myinfo,char *ipaddr)
} }
myinfo->dpowipbits[0] = (uint32_t)calc_ipbits(myinfo->ipaddr); myinfo->dpowipbits[0] = (uint32_t)calc_ipbits(myinfo->ipaddr);
myinfo->numdpowipbits = 1; myinfo->numdpowipbits = 1;
timeout = 10; timeout = 1;
nn_setsockopt(dpowsock,NN_SOL_SOCKET,NN_RCVTIMEO,&timeout,sizeof(timeout)); nn_setsockopt(dpowsock,NN_SOL_SOCKET,NN_RCVTIMEO,&timeout,sizeof(timeout));
maxsize = 1024 * 1024; maxsize = 1024 * 1024;
printf("RCVBUF.%d\n",nn_setsockopt(dpowsock,NN_SOL_SOCKET,NN_RCVBUF,&maxsize,sizeof(maxsize))); printf("RCVBUF.%d\n",nn_setsockopt(dpowsock,NN_SOL_SOCKET,NN_RCVBUF,&maxsize,sizeof(maxsize)));
@ -1886,7 +1888,7 @@ void dpow_ipbitsadd(struct supernet_info *myinfo,struct dpow_info *dp,uint32_t *
int32_t dpow_nanomsg_update(struct supernet_info *myinfo) int32_t dpow_nanomsg_update(struct supernet_info *myinfo)
{ {
int32_t i,n=0,num=0,size,broadcastflag,firstz = -1; char *retstr; uint32_t crc32,r,m; struct dpow_nanomsghdr *np=0; struct dpow_info *dp; struct dpow_block *bp; struct dex_nanomsghdr *dexp = 0; void *freeptr; int32_t i,n,num,num2,flags=0,size,iter,lastval=0,broadcastflag,firstz = -1; char *retstr; uint32_t crc32,r,m; struct dpow_nanomsghdr *np=0; struct dpow_info *dp; struct dpow_block *bp; struct dex_nanomsghdr *dexp = 0; void *freeptr;
if ( time(NULL) < myinfo->nanoinit+5 || (myinfo->dpowsock < 0 && myinfo->dexsock < 0 && myinfo->repsock < 0) ) if ( time(NULL) < myinfo->nanoinit+5 || (myinfo->dpowsock < 0 && myinfo->dexsock < 0 && myinfo->repsock < 0) )
return(-1); return(-1);
if ( myinfo->IAMNOTARY != 0 && myinfo->numnotaries <= 0 ) if ( myinfo->IAMNOTARY != 0 && myinfo->numnotaries <= 0 )
@ -1895,125 +1897,127 @@ int32_t dpow_nanomsg_update(struct supernet_info *myinfo)
printf("INIT with %d notaries\n",myinfo->numnotaries); printf("INIT with %d notaries\n",myinfo->numnotaries);
} }
portable_mutex_lock(&myinfo->dpowmutex); portable_mutex_lock(&myinfo->dpowmutex);
/*for (i=0; i<100; i++) num = num2 = n = 0;
for (iter=0; iter<100; iter++)
{ {
struct nn_pollfd pfd; freeptr = 0;
pfd.fd = myinfo->dpowsock; if ( (flags & 1) == 0 && (size= signed_nn_recv(&freeptr,myinfo->ctx,myinfo->notaries,myinfo->numnotaries,myinfo->dpowsock,&np)) > 0 )
pfd.events = NN_POLLIN;
if ( nn_poll(&pfd,1,100) > 0 )
break;
usleep(1000);
}*/
while ( (size= signed_nn_recv(&freeptr,myinfo->ctx,myinfo->notaries,myinfo->numnotaries,myinfo->dpowsock,&np)) >= 0 && num < 1000 )
{
num++;
if ( size > 0 )
{ {
//fprintf(stderr,"%d ",size); num++;
if ( np->version0 == (DPOW_VERSION & 0xff) && np->version1 == ((DPOW_VERSION >> 8) & 0xff) ) if ( size > 0 )
{ {
//printf("v.%02x %02x datalen.%d size.%d %d vs %d\n",np->version0,np->version1,np->datalen,size,np->datalen,(int32_t)(size - sizeof(*np))); //fprintf(stderr,"%d ",size);
if ( np->datalen == (size - sizeof(*np)) ) if ( np->version0 == (DPOW_VERSION & 0xff) && np->version1 == ((DPOW_VERSION >> 8) & 0xff) )
{ {
crc32 = calc_crc32(0,np->packet,np->datalen); //printf("v.%02x %02x datalen.%d size.%d %d vs %d\n",np->version0,np->version1,np->datalen,size,np->datalen,(int32_t)(size - sizeof(*np)));
dp = 0; if ( np->datalen == (size - sizeof(*np)) )
for (i=0; i<myinfo->numdpows; i++)
{ {
if ( strcmp(np->symbol,myinfo->DPOWS[i].symbol) == 0 ) crc32 = calc_crc32(0,np->packet,np->datalen);
dp = 0;
for (i=0; i<myinfo->numdpows; i++)
{ {
dp = &myinfo->DPOWS[i]; if ( strcmp(np->symbol,myinfo->DPOWS[i].symbol) == 0 )
break; {
dp = &myinfo->DPOWS[i];
break;
}
} }
} if ( dp != 0 && crc32 == np->crc32 )
if ( dp != 0 && crc32 == np->crc32 )
{
if ( i == myinfo->numdpows )
printf("received nnpacket for (%s)\n",np->symbol);
else
{ {
dpow_ipbitsadd(myinfo,dp,np->ipbits,np->numipbits,np->senderind,np->myipbits); if ( i == myinfo->numdpows )
if ( (bp= dpow_heightfind(myinfo,dp,np->height)) != 0 && bp->state != 0xffffffff && bp->myind >= 0 ) printf("received nnpacket for (%s)\n",np->symbol);
else
{ {
//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); dpow_ipbitsadd(myinfo,dp,np->ipbits,np->numipbits,np->senderind,np->myipbits);
if ( np->senderind >= 0 && np->senderind < bp->numnotaries ) if ( (bp= dpow_heightfind(myinfo,dp,np->height)) != 0 && bp->state != 0xffffffff && bp->myind >= 0 )
{ {
if ( memcmp(bp->notaries[np->senderind].pubkey+1,np->srchash.bytes,32) == 0 && bits256_nonz(np->srchash) != 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);
if ( np->senderind >= 0 && np->senderind < bp->numnotaries )
{ {
if ( bp->isratify == 0 ) if ( memcmp(bp->notaries[np->senderind].pubkey+1,np->srchash.bytes,32) == 0 && bits256_nonz(np->srchash) != 0 )
dpow_nanoutxoget(myinfo,dp,bp,&np->notarize,0,np->senderind,np->channel); {
else dpow_nanoutxoget(myinfo,dp,bp,&np->ratify,1,np->senderind,np->channel); if ( bp->isratify == 0 )
dpow_datahandler(myinfo,dp,bp,np->senderind,np->channel,np->height,np->packet,np->datalen); dpow_nanoutxoget(myinfo,dp,bp,&np->notarize,0,np->senderind,np->channel);
} else printf("wrong senderind.%d\n",np->senderind); else dpow_nanoutxoget(myinfo,dp,bp,&np->ratify,1,np->senderind,np->channel);
} dpow_datahandler(myinfo,dp,bp,np->senderind,np->channel,np->height,np->packet,np->datalen);
} //else printf("height.%d bp.%p state.%x senderind.%d\n",np->height,bp,bp!=0?bp->state:0,np->senderind); } else printf("wrong senderind.%d\n",np->senderind);
//dp->crcs[firstz] = crc32; }
} } //else printf("height.%d bp.%p state.%x senderind.%d\n",np->height,bp,bp!=0?bp->state:0,np->senderind);
} //else printf("crc error from.%d %x vs %x or no dp.%p [%s]\n",np->senderind,crc32,np->crc32,dp,np->symbol); //dp->crcs[firstz] = crc32;
} else printf("ignore.%d np->datalen.%d %d (size %d - %ld) [%s]\n",np->senderind,np->datalen,(int32_t)(size-sizeof(*np)),size,sizeof(*np),np->symbol); }
} //else printf("wrong version from.%d %02x %02x size.%d [%s]\n",np->senderind,np->version0,np->version1,size,np->symbol); } //else printf("crc error from.%d %x vs %x or no dp.%p [%s]\n",np->senderind,crc32,np->crc32,dp,np->symbol);
} //else printf("illegal size.%d\n",size); } else printf("ignore.%d np->datalen.%d %d (size %d - %ld) [%s]\n",np->senderind,np->datalen,(int32_t)(size-sizeof(*np)),size,sizeof(*np),np->symbol);
} //else printf("wrong version from.%d %02x %02x size.%d [%s]\n",np->senderind,np->version0,np->version1,size,np->symbol);
}
} else flags |= 1;
if ( freeptr != 0 ) if ( freeptr != 0 )
nn_freemsg(freeptr), np = 0, freeptr = 0; nn_freemsg(freeptr), np = 0, freeptr = 0;
} //else printf("no packets\n"); if ( myinfo->dexsock >= 0 ) // from servers
n = 0;
if ( myinfo->dexsock >= 0 ) // from servers
{
while ( (size= signed_nn_recv(&freeptr,myinfo->ctx,myinfo->notaries,myinfo->numnotaries,myinfo->dexsock,&dexp)) > 0 && n < 1000 )
{ {
//fprintf(stderr,"%d ",size); freeptr = 0;
n++; if ( (flags & 2) == 0 && (size= signed_nn_recv(&freeptr,myinfo->ctx,myinfo->notaries,myinfo->numnotaries,myinfo->dexsock,&dexp)) > 0 )
if ( dex_packetcheck(myinfo,dexp,size) == 0 )
{ {
//printf("FROM BUS.%08x -> pub\n",dexp->crc32); //fprintf(stderr,"%d ",size);
signed_nn_send(myinfo,myinfo->ctx,myinfo->persistent_priv,myinfo->pubsock,dexp,size); n++;
dex_packet(myinfo,dexp,size); if ( dex_packetcheck(myinfo,dexp,size) == 0 )
} {
//printf("GOT DEX bus PACKET.%d\n",size); //printf("FROM BUS.%08x -> pub\n",dexp->crc32);
signed_nn_send(myinfo,myinfo->ctx,myinfo->persistent_priv,myinfo->pubsock,dexp,size);
dex_packet(myinfo,dexp,size);
}
//printf("GOT DEX bus PACKET.%d\n",size);
} else flags |= 2;
if ( freeptr != 0 ) if ( freeptr != 0 )
nn_freemsg(freeptr), dexp = 0, freeptr = 0; nn_freemsg(freeptr), dexp = 0, freeptr = 0;
} }
} if ( myinfo->repsock >= 0 ) // from clients
if ( myinfo->repsock >= 0 ) // from clients
{
while ( (size= nn_recv(myinfo->repsock,&dexp,NN_MSG,0)) > 0 )
{ {
num++; dexp = 0;
//printf("REP got %d crc.%08x\n",size,calc_crc32(0,(void *)dexp,size)); if ( (flags & 4) == 0 && (size= nn_recv(myinfo->repsock,&dexp,NN_MSG,0)) > 0 )
if ( (retstr= dex_response(&broadcastflag,myinfo,dexp)) != 0 )
{ {
signed_nn_send(myinfo,myinfo->ctx,myinfo->persistent_priv,myinfo->repsock,retstr,(int32_t)strlen(retstr)+1); num2++;
//printf("send back[%ld]\n",strlen(retstr)+1); //printf("REP got %d crc.%08x\n",size,calc_crc32(0,(void *)dexp,size));
free(retstr); if ( (retstr= dex_response(&broadcastflag,myinfo,dexp)) != 0 )
if ( broadcastflag != 0 )
{ {
printf("BROADCAST dexp request.[%d]\n",size); signed_nn_send(myinfo,myinfo->ctx,myinfo->persistent_priv,myinfo->repsock,retstr,(int32_t)strlen(retstr)+1);
signed_nn_send(myinfo,myinfo->ctx,myinfo->persistent_priv,myinfo->dexsock,dexp,size); //printf("send back[%ld]\n",strlen(retstr)+1);
free(retstr);
if ( broadcastflag != 0 )
{
//printf("BROADCAST dexp request.[%d]\n",size);
signed_nn_send(myinfo,myinfo->ctx,myinfo->persistent_priv,myinfo->dexsock,dexp,size);
}
} }
} else
else
{
if ( (m= myinfo->numdpowipbits) > 0 )
{
r = myinfo->dpowipbits[rand() % m];
signed_nn_send(myinfo,myinfo->ctx,myinfo->persistent_priv,myinfo->repsock,&r,sizeof(r));
//printf("REP.%08x <- rand ip m.%d %x\n",dexp->crc32,m,r);
} else printf("illegal state without dpowipbits?\n");
if ( dex_packetcheck(myinfo,dexp,size) == 0 )
{ {
signed_nn_send(myinfo,myinfo->ctx,myinfo->persistent_priv,myinfo->dexsock,dexp,size); if ( (m= myinfo->numdpowipbits) > 0 )
signed_nn_send(myinfo,myinfo->ctx,myinfo->persistent_priv,myinfo->pubsock,dexp,size); {
//printf("REP.%08x -> dexbus and pub, t.%d lag.%d\n",dexp->crc32,dexp->timestamp,(int32_t)(time(NULL)-dexp->timestamp)); r = myinfo->dpowipbits[rand() % m];
dex_packet(myinfo,dexp,size); signed_nn_send(myinfo,myinfo->ctx,myinfo->persistent_priv,myinfo->repsock,&r,sizeof(r));
} else printf("failed dexpacketcheck\n"); //printf("REP.%08x <- rand ip m.%d %x\n",dexp->crc32,m,r);
} } else printf("illegal state without dpowipbits?\n");
//printf("GOT DEX rep PACKET.%d\n",size); if ( dex_packetcheck(myinfo,dexp,size) == 0 )
//if ( freeptr != 0 ) {
// nn_freemsg(freeptr), dexp = 0, freeptr = 0; signed_nn_send(myinfo,myinfo->ctx,myinfo->persistent_priv,myinfo->dexsock,dexp,size);
signed_nn_send(myinfo,myinfo->ctx,myinfo->persistent_priv,myinfo->pubsock,dexp,size);
//printf("REP.%08x -> dexbus and pub, t.%d lag.%d\n",dexp->crc32,dexp->timestamp,(int32_t)(time(NULL)-dexp->timestamp));
dex_packet(myinfo,dexp,size);
} else printf("failed dexpacketcheck\n");
}
//printf("GOT DEX rep PACKET.%d\n",size);
//if ( freeptr != 0 )
// nn_freemsg(freeptr), dexp = 0, freeptr = 0;
//if ( num > 1000 )
// break;
} else flags |= 4;
if ( dexp != 0 ) if ( dexp != 0 )
nn_freemsg(dexp), dexp = 0; nn_freemsg(dexp), dexp = 0;
if ( num > 1000 )
break;
} }
if ( (num + n + num2) != lastval )
{
//printf("lastval.%d: num.%d n.%d num2.%d rep packets\n",lastval,num,n,num2);
lastval = (num + n + num2);
} else break;
} }
portable_mutex_unlock(&myinfo->dpowmutex); portable_mutex_unlock(&myinfo->dpowmutex);
return(num); return(num);

2
iguana/iguana777.h

@ -133,7 +133,7 @@ struct supernet_info
struct liquidity_info linfos[512]; cJSON *liquidity_currencies; struct pending_trade *trades; portable_mutex_t pending_mutex; struct liquidity_info linfos[512]; cJSON *liquidity_currencies; struct pending_trade *trades; portable_mutex_t pending_mutex;
struct komodo_notaries NOTARY; struct komodo_notaries NOTARY;
char seedipaddr[64]; uint32_t dpowipbits[128]; int32_t numdpowipbits; portable_mutex_t notarymutex,dpowmutex; char seedipaddr[64]; uint32_t dpowipbits[128]; int32_t numdpowipbits; portable_mutex_t notarymutex,dpowmutex;
char dexseed_ipaddrs[8][64]; uint32_t dexipbits[128]; int32_t numdexipbits; portable_mutex_t dexmutex; char dexseed_ipaddrs[2][64]; uint32_t dexipbits[128]; int32_t numdexipbits; portable_mutex_t dexmutex;
// compatibility // compatibility
bits256 pangea_category,instantdex_category; bits256 pangea_category,instantdex_category;
uint8_t logs[256],exps[510]; uint8_t logs[256],exps[510];

4
iguana/iguana_payments.c

@ -366,7 +366,7 @@ uint64_t _iguana_interest(uint32_t now,int32_t chainheight,uint32_t txlocktime,u
uint64_t iguana_interest(struct supernet_info *myinfo,struct iguana_info *coin,bits256 txid,int32_t vout,uint64_t value) uint64_t iguana_interest(struct supernet_info *myinfo,struct iguana_info *coin,bits256 txid,int32_t vout,uint64_t value)
{ {
char *retstr; int32_t height; cJSON *retjson; struct iguana_txid T,*tx; uint64_t interest=0; char *retstr; int32_t height; cJSON *retjson=0; struct iguana_txid T,*tx; uint64_t interest=0;
if ( coin->FULLNODE < 0 ) // komodod is running if ( coin->FULLNODE < 0 ) // komodod is running
{ {
if ( (retjson= dpow_gettxout(myinfo,coin,txid,vout)) != 0 ) if ( (retjson= dpow_gettxout(myinfo,coin,txid,vout)) != 0 )
@ -394,7 +394,7 @@ uint64_t iguana_interest(struct supernet_info *myinfo,struct iguana_info *coin,b
interest = _iguana_interest((uint32_t)time(NULL),coin->longestchain,tx->locktime,value); interest = _iguana_interest((uint32_t)time(NULL),coin->longestchain,tx->locktime,value);
} }
} }
char str[65]; printf("interest for %s.v%d %.8f %.8f\n",bits256_str(str,txid),vout,dstr(value),dstr(interest)); char str[65]; printf("interest for %s.v%d %.8f %.8f (%s)\n",bits256_str(str,txid),vout,dstr(value),dstr(interest),retjson!=0?jprint(retjson,0):"");
return(interest); return(interest);
} }

Loading…
Cancel
Save