jl777 8 years ago
parent
commit
bd72942edb
  1. 26
      iguana/iguana_notary.c
  2. 1
      iguana/main.c

26
iguana/iguana_notary.c

@ -86,21 +86,35 @@ uint32_t dpow_send(struct supernet_info *myinfo,struct dpow_block *bp,bits256 sr
free(np);
printf("NANOSEND ht.%d channel.%08x (%d) crc32.%08x\n",np->height,np->channel,size,np->crc32);
return(sentbytes);
//return(basilisk_channelsend(myinfo,srchash,desthash,channel,msgbits,data,datalen,120));
//return(basilisk_crcsend(myinfo,1,bp->sendbuf,sizeof(bp->sendbuf),srchash,desthash,channel,msgbits,data,datalen,crcs));
}
void dpow_nanomsg_update(struct supernet_info *myinfo)
{
int32_t size; uint32_t crc32; struct dpow_nanomsghdr *np;
static uint32_t crcs[1024];
int32_t i,size,firstz = -1; uint32_t crc32; struct dpow_nanomsghdr *np;
while ( (size= nn_recv(myinfo->DPOW.sock,&np,NN_MSG,0)) >= 0 )
{
if ( size >= 0 )
{
crc32 = calc_crc32(0,np->packet,np->datalen);
printf("NANORECV ht.%d channel.%08x (%d) crc32.%08x:%08x datalen.%d:%d\n",np->height,np->channel,size,np->crc32,crc32,np->datalen,(int32_t)(size - sizeof(*np)));
if ( crc32 == np->crc32 && np->datalen == (size - sizeof(*np)) )
{
for (i=0; i<sizeof(crcs)/sizeof(*crcs); i++)
{
if ( crcs[i] == crc32 )
{
printf("NANODUPLICATE.%08x\n",crc32);
return;
}
else if ( crcs[i] == 0 )
firstz = i;
}
if ( firstz < 0 )
firstz = (rand() % (sizeof(crcs)/sizeof(*crcs)));
crcs[firstz] = crc32;
printf("NANORECV ht.%d channel.%08x (%d) crc32.%08x:%08x datalen.%d:%d\n",np->height,np->channel,size,np->crc32,crc32,np->datalen,(int32_t)(size - sizeof(*np)));
dpow_datahandler(myinfo,0,np->channel,np->height,np->packet,size - np->size);
}
if ( np != 0 )
nn_freemsg(np);
}
@ -1084,7 +1098,7 @@ int32_t dpow_update(struct supernet_info *myinfo,struct dpow_block *bp,uint32_t
{
if ( ep->masks[bp->bestk] == 0 )
dpow_signedtxgen(myinfo,bp->coin,bp,bp->bestk,bp->bestmask,myind,bp->opret_symbol,sigchannel);
//else dpow_sigsend(myinfo,bp,myind,bp->bestk,bp->bestmask,srchash,sigchannel);
else dpow_sigsend(myinfo,bp,myind,bp->bestk,bp->bestmask,srchash,sigchannel);
}
//dpow_channelget(myinfo,bp,txidchannel);
@ -1093,7 +1107,7 @@ int32_t dpow_update(struct supernet_info *myinfo,struct dpow_block *bp,uint32_t
//dpow_channelget(myinfo,bp,sigchannel);
if ( ep->masks[bp->bestk] == 0 )
dpow_signedtxgen(myinfo,bp->coin,bp,bp->bestk,bp->bestmask,myind,bp->opret_symbol,sigchannel);
//else dpow_sigsend(myinfo,bp,myind,bp->bestk,bp->bestmask,srchash,sigchannel);
else dpow_sigsend(myinfo,bp,myind,bp->bestk,bp->bestmask,srchash,sigchannel);
}
return(bp->state);
}

1
iguana/main.c

@ -1359,6 +1359,7 @@ STRING_ARG(SuperNET,myipaddr,ipaddr)
{
strcpy(myinfo->ipaddr,ipaddr);
myinfo->myaddr.myipbits = (uint32_t)calc_ipbits(ipaddr);
printf("SET MYIPADDR.(%s)\n",ipaddr);
basilisk_setmyid(myinfo);
}
}

Loading…
Cancel
Save