jl777 8 years ago
parent
commit
c08562eb3e
  1. 5
      iguana/dpow/dpow_fsm.c
  2. 21
      iguana/dpow/dpow_network.c

5
iguana/dpow/dpow_fsm.c

@ -301,6 +301,11 @@ void dpow_statemachinestart(void *ptr)
free(ptr); free(ptr);
return; return;
} }
if ( bp->isratify != 0 && memcmp(bp->notaries[0].pubkey,bp->ratified_pubkeys[0],33) != 0 )
{
printf("cant change notary0\n");
return;
}
printf(" myind.%d myaddr.(%s %s)\n",myind,srcaddr,destaddr); printf(" myind.%d myaddr.(%s %s)\n",myind,srcaddr,destaddr);
if ( myind == 0 && bits256_nonz(destprevtxid0) != 0 && bits256_nonz(srcprevtxid0) != 0 && destprevvout0 >= 0 && srcprevvout0 >= 0 ) if ( myind == 0 && bits256_nonz(destprevtxid0) != 0 && bits256_nonz(srcprevtxid0) != 0 && destprevvout0 >= 0 && srcprevvout0 >= 0 )
{ {

21
iguana/dpow/dpow_network.c

@ -348,11 +348,12 @@ void dpow_send(struct supernet_info *myinfo,struct dpow_info *dp,struct dpow_blo
} }
np->senderind = bp->myind; np->senderind = bp->myind;
memcpy(np->ipbits,dp->ipbits,dp->numipbits * sizeof(*dp->ipbits)); memcpy(np->ipbits,dp->ipbits,dp->numipbits * sizeof(*dp->ipbits));
//for (i=0; i<np->numipbits; i++) for (i=0; i<np->numipbits; i++)
// printf("%08x ",np->ipbits[i]); printf("%08x ",np->ipbits[i]);
//printf(" dpow_send.(%d) size.%d numipbits.%d myind.%d\n",datalen,size,np->numipbits,bp->myind); printf(" dpow_send.(%d) size.%d numipbits.%d myind.%d\n",datalen,size,np->numipbits,bp->myind);
dpow_nanoutxoset(&np->notarize,bp,0); if ( bp->isratify == 0 )
dpow_nanoutxoset(&np->ratify,bp,1); dpow_nanoutxoset(&np->notarize,bp,0);
else dpow_nanoutxoset(&np->ratify,bp,1);
np->size = size; np->size = size;
np->datalen = datalen; np->datalen = datalen;
np->crc32 = crc32; np->crc32 = crc32;
@ -381,8 +382,8 @@ void dpow_ipbitsadd(struct supernet_info *myinfo,struct dpow_info *dp,uint32_t *
} }
n = dp->numipbits; n = dp->numipbits;
matched = missing = 0; matched = missing = 0;
//for (i=0; i<numipbits; i++) for (i=0; i<numipbits; i++)
// printf("%08x ",ipbits[i]); printf("%08x ",ipbits[i]);
for (i=0; i<numipbits; i++) for (i=0; i<numipbits; i++)
{ {
for (j=0; j<n; j++) for (j=0; j<n; j++)
@ -410,6 +411,7 @@ void dpow_ipbitsadd(struct supernet_info *myinfo,struct dpow_info *dp,uint32_t *
dpow_addnotary(myinfo,dp,ipaddr); dpow_addnotary(myinfo,dp,ipaddr);
expand_ipbits(ipaddr,myinfo->myaddr.myipbits); expand_ipbits(ipaddr,myinfo->myaddr.myipbits);
dpow_addnotary(myinfo,dp,ipaddr); dpow_addnotary(myinfo,dp,ipaddr);
printf("recv numips.(%d %d)\n",myinfo->numdpowipbits,dp->numipbits);
} }
void dpow_nanomsg_update(struct supernet_info *myinfo) void dpow_nanomsg_update(struct supernet_info *myinfo)
@ -446,8 +448,9 @@ void dpow_nanomsg_update(struct supernet_info *myinfo)
{ {
if ( np->senderind >= 0 && np->senderind < bp->numnotaries ) if ( np->senderind >= 0 && np->senderind < bp->numnotaries )
{ {
dpow_nanoutxoget(myinfo,dp,bp,&np->notarize,0,np->senderind); if ( bp->isratify == 0 )
dpow_nanoutxoget(myinfo,dp,bp,&np->ratify,1,np->senderind); dpow_nanoutxoget(myinfo,dp,bp,&np->notarize,0,np->senderind);
else dpow_nanoutxoget(myinfo,dp,bp,&np->ratify,1,np->senderind);
dpow_datahandler(myinfo,dp,bp,np->senderind,np->channel,np->height,np->packet,np->datalen); dpow_datahandler(myinfo,dp,bp,np->senderind,np->channel,np->height,np->packet,np->datalen);
} }
} }

Loading…
Cancel
Save