jl777 8 years ago
parent
commit
a2dc18fc02
  1. 5
      iguana/dpow/dpow_fsm.c
  2. 12
      iguana/dpow/dpow_network.c
  3. 3
      iguana/dpow/dpow_tx.c

5
iguana/dpow/dpow_fsm.c

@ -202,6 +202,11 @@ void dpow_statemachinestart(void *ptr)
printf("statemachinestart %s->%s %s ht.%d minsigs.%d duration.%d start.%u\n",dp->symbol,dp->dest,bits256_str(str,checkpoint.blockhash.hash),checkpoint.blockhash.height,minsigs,duration,checkpoint.timestamp); printf("statemachinestart %s->%s %s ht.%d minsigs.%d duration.%d start.%u\n",dp->symbol,dp->dest,bits256_str(str,checkpoint.blockhash.hash),checkpoint.blockhash.height,minsigs,duration,checkpoint.timestamp);
src = iguana_coinfind(dp->symbol); src = iguana_coinfind(dp->symbol);
dest = iguana_coinfind(dp->dest); dest = iguana_coinfind(dp->dest);
if ( src == 0 || dest == 0 )
{
printf("null coin ptr? (%s %p or %s %p)\n",dp->symbol,src,dp->dest,dest);
return;
}
if ( strcmp(src->symbol,"KMD") == 0 ) if ( strcmp(src->symbol,"KMD") == 0 )
kmdheight = checkpoint.blockhash.height; kmdheight = checkpoint.blockhash.height;
else if ( strcmp(dest->symbol,"KMD") == 0 ) else if ( strcmp(dest->symbol,"KMD") == 0 )

12
iguana/dpow/dpow_network.c

@ -348,9 +348,9 @@ 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);
if ( bp->isratify == 0 ) if ( bp->isratify == 0 )
dpow_nanoutxoset(&np->notarize,bp,0); dpow_nanoutxoset(&np->notarize,bp,0);
else dpow_nanoutxoset(&np->ratify,bp,1); else dpow_nanoutxoset(&np->ratify,bp,1);
@ -382,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++)
@ -411,7 +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); //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)

3
iguana/dpow/dpow_tx.c

@ -426,7 +426,9 @@ int32_t dpow_signedtxgen(struct supernet_info *myinfo,struct dpow_info *dp,struc
printf("signedtxgen src_or_dest.%d (%d %llx) useratified.%d\n",src_or_dest,bestk,(long long)bestmask,useratified); printf("signedtxgen src_or_dest.%d (%d %llx) useratified.%d\n",src_or_dest,bestk,(long long)bestmask,useratified);
if ( (vins= dpow_vins(coin,bp,bestk,bestmask,1,src_or_dest,useratified)) != 0 ) if ( (vins= dpow_vins(coin,bp,bestk,bestmask,1,src_or_dest,useratified)) != 0 )
{ {
printf("call notarytx\n");
txid = dpow_notarytx(rawtx,&numsigs,coin->chain->isPoS,bp,bestk,bestmask,0,src_or_dest,bp->numratified!=0?bp->ratified_pubkeys:0,useratified); txid = dpow_notarytx(rawtx,&numsigs,coin->chain->isPoS,bp,bestk,bestmask,0,src_or_dest,bp->numratified!=0?bp->ratified_pubkeys:0,useratified);
printf("got notarytx (%s)\n",rawtx);
if ( bits256_nonz(txid) != 0 && rawtx[0] != 0 ) // send tx to share utxo set if ( bits256_nonz(txid) != 0 && rawtx[0] != 0 ) // send tx to share utxo set
{ {
if ( useratified != 0 ) if ( useratified != 0 )
@ -435,6 +437,7 @@ int32_t dpow_signedtxgen(struct supernet_info *myinfo,struct dpow_info *dp,struc
{ {
if ( (signobj= cJSON_Parse(jsonstr)) != 0 ) if ( (signobj= cJSON_Parse(jsonstr)) != 0 )
{ {
printf("signobj.(%s)\n",jsonstr);
if ( ((signedtx= jstr(signobj,"hex")) != 0 || (signedtx= jstr(signobj,"result")) != 0) && (rawtx2= dpow_decoderawtransaction(myinfo,coin,signedtx)) != 0 ) if ( ((signedtx= jstr(signobj,"hex")) != 0 || (signedtx= jstr(signobj,"result")) != 0) && (rawtx2= dpow_decoderawtransaction(myinfo,coin,signedtx)) != 0 )
{ {
if ( (txobj2= cJSON_Parse(rawtx2)) != 0 ) if ( (txobj2= cJSON_Parse(rawtx2)) != 0 )

Loading…
Cancel
Save