Browse Source

fix

blackjok3r
blackjok3r 6 years ago
parent
commit
cb706fa692
  1. 2
      iguana/dPoW.h
  2. 7
      iguana/dpow/dpow_network.c
  3. 24
      iguana/dpow/dpow_tx.c

2
iguana/dPoW.h

@ -115,7 +115,7 @@ struct dpow_block
uint64_t recvmask,bestmask,ratifybestmask,ratifyrecvmask,pendingbestmask,pendingratifybestmask,ratifysigmasks[2]; uint64_t recvmask,bestmask,ratifybestmask,ratifyrecvmask,pendingbestmask,pendingratifybestmask,ratifysigmasks[2];
struct dpow_recvdata recv[64]; struct dpow_recvdata recv[64];
struct dpow_entry notaries[DPOW_MAXRELAYS]; struct dpow_entry notaries[DPOW_MAXRELAYS];
uint32_t MoMdepth,state,starttime,timestamp,waiting,sigcrcs[2],txidcrcs[2],utxocrcs[2],lastepoch,paxwdcrc,lastnanosend,finished; uint32_t MoMdepth,state,starttime,timestamp,waiting,sigcrcs[2],txidcrcs[2],utxocrcs[2],lastepoch,paxwdcrc,lastnanosend;
int32_t rawratifiedlens[2],height,numnotaries,numerrors,completed,minsigs,duration,numratified,isratify,require0,scores[DPOW_MAXRELAYS]; int32_t rawratifiedlens[2],height,numnotaries,numerrors,completed,minsigs,duration,numratified,isratify,require0,scores[DPOW_MAXRELAYS];
int8_t myind,bestk,ratifybestk,pendingbestk,pendingratifybestk,matches,bestmatches; int8_t myind,bestk,ratifybestk,pendingbestk,pendingratifybestk,matches,bestmatches;
cJSON *ratified; cJSON *ratified;

7
iguana/dpow/dpow_network.c

@ -2312,8 +2312,11 @@ int32_t dpow_nanomsg_update(struct supernet_info *myinfo)
printf("received nnpacket for (%s)\n",np->symbol); printf("received nnpacket for (%s)\n",np->symbol);
else else
{ {
dpow_ipbitsadd(myinfo,dp,np->ipbits,np->numipbits,sizeof(np->ipbits)/sizeof(*np->ipbits),np->senderind,np->myipbits); dpow_ipbitsadd(myinfo,dp,np->ipbits,np->numipbits,sizeof(np->ipbits)/sizeof(*np->ipbits),np->senderind,np->myipbits);.
if ( (bp= dpow_heightfind(myinfo,dp,np->height)) != 0 && bp->state != 0xffffffff && bp->myind >= 0 ) bp = dpow_heightfind(myinfo,dp,np->height);
if ( bp != 0 )
fprintf(stderr, "found bp in network receive!\n");
if ( bp != 0 && bp->state != 0xffffffff && bp->myind >= 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); 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 ( np->senderind >= 0 && np->senderind < bp->numnotaries )

24
iguana/dpow/dpow_tx.c

@ -176,21 +176,15 @@ struct dpow_block *dpow_heightfind(struct supernet_info *myinfo,struct dpow_info
int32_t i; struct dpow_block *bp = 0; int32_t i; struct dpow_block *bp = 0;
for (i = 0; i < dp->maxblocks; i++) for (i = 0; i < dp->maxblocks; i++)
{ {
if ( dp->blocks[i] != 0 ) if ( dp->blocks[i] != 0 && height == dp->blocks[i]->height )
{
if ( height == dp->blocks[i]->height )
{
fprintf(stderr, "FOUND DP: symbol.%s height.%i dp_height.%i\n",dp->symbol, height, dp->blocks[i]->height);
return(bp); return(bp);
} }
}
}
return(bp); return(bp);
} }
int32_t dpow_blockfind(struct supernet_info *myinfo,struct dpow_info *dp) int32_t dpow_blockfind(struct supernet_info *myinfo,struct dpow_info *dp)
{ {
int32_t i; struct dpow_block *bp = 0; int32_t i;
for (i = 0; i < dp->maxblocks; i++) for (i = 0; i < dp->maxblocks; i++)
{ {
if ( dp->blocks[i] == 0 ) if ( dp->blocks[i] == 0 )
@ -199,6 +193,20 @@ int32_t dpow_blockfind(struct supernet_info *myinfo,struct dpow_info *dp)
return(0); return(0);
} }
/* maybe this is better not sure...
int32_t dpow_blockfind(struct supernet_info *myinfo,struct dpow_info *dp)
{
int32_t i; uint32_t i,r;
while ( 1 )
{
OS_randombytes((uint8_t *)&r,sizeof(r));
i = r % dp->maxblocks;
if ( dp->blocks[i] == 0 )
break;
}
return(0);
}*/
int32_t dpow_voutstandard(struct supernet_info *myinfo,struct dpow_block *bp,uint8_t *serialized,int32_t m,int32_t src_or_dest,uint8_t pubkeys[][33],int32_t numratified) int32_t dpow_voutstandard(struct supernet_info *myinfo,struct dpow_block *bp,uint8_t *serialized,int32_t m,int32_t src_or_dest,uint8_t pubkeys[][33],int32_t numratified)
{ {
uint32_t paxwdcrc=0,locktime=0,numvouts; struct iguana_info *coin; uint64_t satoshis,satoshisB; int32_t i,n=0,opretlen,len=0; uint8_t opret[16384],data[16384],extras[16384]; uint32_t paxwdcrc=0,locktime=0,numvouts; struct iguana_info *coin; uint64_t satoshis,satoshisB; int32_t i,n=0,opretlen,len=0; uint8_t opret[16384],data[16384],extras[16384];

Loading…
Cancel
Save