jl777 8 years ago
parent
commit
800cad8ade
  1. 24
      iguana/dpow/dpow_fsm.c
  2. 9
      iguana/dpow/dpow_network.c
  3. 2
      iguana/dpow/dpow_tx.c

24
iguana/dpow/dpow_fsm.c

@ -268,29 +268,33 @@ int32_t dpow_datahandler(struct supernet_info *myinfo,struct dpow_info *dp,struc
{
src_or_dest = (channel == DPOW_BTCTXIDCHANNEL);
coin = (src_or_dest != 0) ? bp->destcoin : bp->srccoin;
printf("handle txid channel.%x\n",channel);
//printf("bp.%p datalen.%d\n",bp,datalen);
for (i=0; i<32; i++)
srchash.bytes[i] = data[i];
txid = bits256_doublesha256(0,&data[32],datalen-32);
init_hexbytes_noT(bp->signedtx,&data[32],datalen-32);
printf("signedtx.(%s)\n",bp->signedtx);
if ( bits256_cmp(txid,srchash) == 0 )
{
printf("verify (%s) it is properly signed! set ht.%d signedtxid to %s\n",coin->symbol,height,bits256_str(str,txid));
if ( src_or_dest != 0 )
{
bp->desttxid = txid;
bp->state = 1000;
dp->destupdated = 0;
dpow_signedtxgen(myinfo,dp,bp->srccoin,bp,bp->bestk,bp->bestmask,myind,DPOW_SIGCHANNEL,0,0);
//dpow_sigscheck(myinfo,dp,bp,DPOW_SIGCHANNEL,myind,0);
if ( bp->state < 1000 )
{
bp->desttxid = txid;
bp->state = 1000;
dp->destupdated = 0;
dpow_signedtxgen(myinfo,dp,bp->srccoin,bp,bp->bestk,bp->bestmask,myind,DPOW_SIGCHANNEL,0,0);
//dpow_sigscheck(myinfo,dp,bp,DPOW_SIGCHANNEL,myind,0);
}
}
else
{
bp->srctxid = txid;
printf("set state COMPLETED\n");
bp->state = 0xffffffff;
if ( bp->state != 0xffffffff )
{
bp->srctxid = txid;
printf("set state COMPLETED\n");
bp->state = 0xffffffff;
}
}
}
else

9
iguana/dpow/dpow_network.c

@ -296,9 +296,12 @@ void dpow_notarize_update(struct supernet_info *myinfo,struct dpow_info *dp,stru
}
if ( bp->srcsigsmasks[bp->bestk] == bp->bestmask ) // have all sigs
{
dpow_sigscheck(myinfo,dp,bp,bp->myind,0);
bp->state = 0xffffffff;
}
if ( bp->state != 0xffffffff )
{
dpow_sigscheck(myinfo,dp,bp,bp->myind,0);
bp->state = 0xffffffff;
}
} else printf("srcmask.%llx != bestmask.%llx\n",(long long)bp->srcsigsmasks[bp->bestk],(long long)bp->bestmask);
} else printf("destmask.%llx != bestmask.%llx\n",(long long)bp->destsigsmasks[bp->bestk],(long long)bp->bestmask);
}
}

2
iguana/dpow/dpow_tx.c

@ -465,7 +465,7 @@ void dpow_sigscheck(struct supernet_info *myinfo,struct dpow_info *dp,struct dpo
coin = (src_or_dest != 0) ? bp->destcoin : bp->srccoin;
memset(zero.bytes,0,sizeof(zero));
channel = (src_or_dest != 0) ? DPOW_SIGBTCCHANNEL : DPOW_SIGCHANNEL;
printf("sigscheck myind.%d src_dest.%d state.%x coin.%p\n",myind,src_or_dest,bp->state,coin);
printf("dpow_sigscheck myind.%d src_dest.%d state.%x coin.%s\n",myind,src_or_dest,bp->state,coin->symbol);
if ( bp->state != 0xffffffff && coin != 0 )
{
signedtxid = dpow_notarytx(bp->signedtx,&numsigs,coin->chain->isPoS,bp,bp->bestk,bp->bestmask,1,src_or_dest,bp->numratified!=0?bp->ratified_pubkeys:0,bp->numratified);

Loading…
Cancel
Save