Browse Source

Merge pull request #160 from jl777/dev

Dev
win-cross
jl777 8 years ago
committed by GitHub
parent
commit
b448971bbb
  1. 2
      basilisk/basilisk_MSG.c
  2. 1
      iguana/dPoW.h
  3. 2
      iguana/dpow/dpow_fsm.c
  4. 22
      iguana/dpow/dpow_network.c
  5. 2
      iguana/dpow/dpow_tx.c

2
basilisk/basilisk_MSG.c

@ -307,7 +307,7 @@ HASH_ARRAY_STRING(basilisk,sendmessage,hash,vals,hexstr)
} else printf("not notary.%d relayid.%d\n",myinfo->IAMNOTARY,myinfo->NOTARY.RELAYID);
if ( vals != 0 && juint(vals,"fanout") == 0 )
jaddnum(vals,"fanout",MAX(8,(int32_t)sqrt(myinfo->NOTARY.NUMRELAYS)+2));
if ( 0 && data != 0 && datalen != 0 )
if ( data != 0 && datalen != 0 )
dex_reqsend(myinfo,space,datalen+BASILISK_KEYSIZE);
return(basilisk_standardservice("OUT",myinfo,0,jbits256(vals,"desthash"),vals,hexstr,0));
}

1
iguana/dPoW.h

@ -146,5 +146,6 @@ char *basilisk_respond_addmessage(struct supernet_info *myinfo,uint8_t *key,int3
char *dpow_sendrawtransaction(struct supernet_info *myinfo,struct iguana_info *coin,char *signedtx);
cJSON *dpow_gettxout(struct supernet_info *myinfo,struct iguana_info *coin,bits256 txid,int32_t vout);
int32_t dpow_getchaintip(struct supernet_info *myinfo,bits256 *blockhashp,uint32_t *blocktimep,bits256 *txs,uint32_t *numtxp,struct iguana_info *coin);
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);
#endif

2
iguana/dpow/dpow_fsm.c

@ -36,7 +36,7 @@ void dpow_utxo2entry(struct dpow_block *bp,struct dpow_entry *ep,struct dpow_utx
bp->notaries[i].othermask |= up->othermasks[i];
ep->commit = up->commit;
ep->height = up->height;
ep->recvmask = up->recvmask;
ep->recvmask |= up->recvmask;
ep->bestk = up->bestk;
ep->src.prev_hash = up->srchash;
ep->dest.prev_hash = up->desthash;

22
iguana/dpow/dpow_network.c

@ -686,7 +686,7 @@ void dpow_ratify_update(struct supernet_info *myinfo,struct dpow_info *dp,struct
void dpow_notarize_update(struct supernet_info *myinfo,struct dpow_info *dp,struct dpow_block *bp,uint8_t senderind,int8_t bestk,uint64_t bestmask,uint64_t recvmask,bits256 srcutxo,uint16_t srcvout,bits256 destutxo,uint16_t destvout,uint8_t siglens[2],uint8_t sigs[2][DPOW_MAXSIGLEN],uint32_t paxwdcrc)
{
int32_t i,bestmatches = 0,matches = 0,paxmatches = 0,paxbestmatches = 0;
bits256 srchash; int32_t i,flag,bestmatches = 0,matches = 0,paxmatches = 0,paxbestmatches = 0;
if ( bp->myind < 0 )
return;
if ( bp->isratify == 0 && bp->state != 0xffffffff && senderind >= 0 && senderind < bp->numnotaries && bits256_nonz(srcutxo) != 0 && bits256_nonz(destutxo) != 0 )
@ -704,7 +704,7 @@ void dpow_notarize_update(struct supernet_info *myinfo,struct dpow_info *dp,stru
if ( bestmask != 0 )
bp->notaries[senderind].bestmask = bestmask;
if ( recvmask != 0 )
bp->notaries[senderind].recvmask = recvmask;
bp->notaries[senderind].recvmask |= recvmask;
if ( (bp->notaries[senderind].paxwdcrc= paxwdcrc) != 0 )
{
//fprintf(stderr,"{%d %x} ",senderind,paxwdcrc);
@ -731,7 +731,7 @@ void dpow_notarize_update(struct supernet_info *myinfo,struct dpow_info *dp,stru
{
bp->recvmask |= (1LL << senderind) | (1LL << bp->myind);
bp->bestmask = dpow_maskmin(bp->recvmask,bp,&bp->bestk);
//dpow_bestconsensus(bp);
dpow_bestconsensus(bp);
}
if ( bp->bestk >= 0 )
bp->notaries[bp->myind].bestk = bp->bestk;
@ -741,6 +741,7 @@ void dpow_notarize_update(struct supernet_info *myinfo,struct dpow_info *dp,stru
bp->notaries[bp->myind].recvmask = bp->recvmask;
if ( bp->bestk >= 0 )
{
flag = -1;
for (i=0; i<bp->numnotaries; i++)
{
if ( bp->paxwdcrc == bp->notaries[i].paxwdcrc )
@ -757,9 +758,18 @@ void dpow_notarize_update(struct supernet_info *myinfo,struct dpow_info *dp,stru
} //else printf("?%x ",bp->notaries[i].paxwdcrc);
}
}
else if ( i == senderind && ((1LL << bp->myind) & bp->bestmask) != 0 && ((1LL << i) & bp->bestmask) != 0 && ((1LL << bp->myind) & bp->notaries[i].recvmask) == 0 )
flag = senderind;
if ( 0 && bp->myind <= 1 && bp->notaries[i].paxwdcrc != 0 )
printf("%d.(%x %d %llx r%llx) ",i,bp->notaries[i].paxwdcrc,bp->notaries[i].bestk,(long long)bp->notaries[i].bestmask,(long long)bp->notaries[i].recvmask);
}
if ( flag >= 0 )
{
//printf("flag.%d -> send\n",flag);
for (i=0; i<sizeof(srchash); i++)
srchash.bytes[i] = dp->minerkey33[i+1];
dpow_send(myinfo,dp,bp,srchash,bp->hashmsg,0,bp->height,(void *)"ping",0);
}
if ( 0 && bp->myind <= 1 )
printf("recv.%llx best.(%d %llx) m.%d p.%d:%d b.%d\n",(long long)bp->recvmask,bp->bestk,(long long)bp->bestmask,matches,paxmatches,paxbestmatches,bestmatches);
if ( bestmatches >= bp->minsigs && paxbestmatches >= bp->minsigs )
@ -785,7 +795,7 @@ void dpow_notarize_update(struct supernet_info *myinfo,struct dpow_info *dp,stru
}
}
if ( (rand() % 30) == 0 )
printf("[%d] ips.%d %s NOTARIZE.%d matches.%d paxmatches.%d bestmatches.%d bestk.%d %llx recv.%llx sigmasks.(%llx %llx) senderind.%d state.%x (%x %x %x) pax.%x\n",bp->myind,dp->numipbits,dp->symbol,bp->minsigs,matches,paxmatches,bestmatches,bp->bestk,(long long)bp->bestmask,(long long)bp->recvmask,(long long)(bp->bestk>=0?bp->destsigsmasks[bp->bestk]:0),(long long)(bp->bestk>=0?bp->srcsigsmasks[bp->bestk]:0),senderind,bp->state,bp->hashmsg.uints[0],bp->desttxid.uints[0],bp->srctxid.uints[0],bp->paxwdcrc);
printf("%p [%d] ips.%d %s NOTARIZE.%d matches.%d paxmatches.%d bestmatches.%d bestk.%d %llx recv.%llx sigmasks.(%llx %llx) senderind.%d state.%x (%x %x %x) pax.%x\n",bp,bp->myind,dp->numipbits,dp->symbol,bp->minsigs,matches,paxmatches,bestmatches,bp->bestk,(long long)bp->bestmask,(long long)bp->recvmask,(long long)(bp->bestk>=0?bp->destsigsmasks[bp->bestk]:0),(long long)(bp->bestk>=0?bp->srcsigsmasks[bp->bestk]:0),senderind,bp->state,bp->hashmsg.uints[0],bp->desttxid.uints[0],bp->srctxid.uints[0],bp->paxwdcrc);
}
}
@ -1026,9 +1036,9 @@ int32_t dpow_nanomsg_update(struct supernet_info *myinfo)
void dpow_nanomsginit(struct supernet_info *myinfo,char *ipaddr) { }
uint32_t 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)
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)
{
return(0);
return;
}
int32_t dpow_nanomsg_update(struct supernet_info *myinfo) { return(0); }

2
iguana/dpow/dpow_tx.c

@ -22,7 +22,7 @@ void dpow_bestmask_update(struct supernet_info *myinfo,struct dpow_info *dp,stru
return;
bp->notaries[nn_senderind].bestk = nn_bestk;
bp->notaries[nn_senderind].bestmask = nn_bestmask;
bp->notaries[nn_senderind].recvmask = nn_recvmask;
bp->notaries[nn_senderind].recvmask |= nn_recvmask;
startscore = bp->scores[nn_senderind];
if ( bp->bestk >= 0 )
{

Loading…
Cancel
Save