jl777 8 years ago
parent
commit
8ebeceb367
  1. 13
      iguana/dpow/dpow_fsm.c
  2. 2
      iguana/dpow/dpow_network.c
  3. 2
      iguana/iguana_notary.c

13
iguana/dpow/dpow_fsm.c

@ -59,15 +59,15 @@ void dpow_sync(struct supernet_info *myinfo,struct dpow_block *bp,uint64_t refma
dpow_signedtxgen(myinfo,bp->coin,bp,lastk,mask,myind,bp->opret_symbol,bits256_nonz(bp->btctxid) == 0 ? DPOW_SIGBTCCHANNEL : DPOW_SIGCHANNEL); dpow_signedtxgen(myinfo,bp->coin,bp,lastk,mask,myind,bp->opret_symbol,bits256_nonz(bp->btctxid) == 0 ? DPOW_SIGBTCCHANNEL : DPOW_SIGCHANNEL);
} }
void dpow_datahandler(struct supernet_info *myinfo,struct dpow_block *bp,uint32_t channel,uint32_t height,uint8_t *data,int32_t datalen) void dpow_datahandler(struct supernet_info *myinfo,uint32_t channel,uint32_t height,uint8_t *data,int32_t datalen)
{ {
bits256 hashmsg,txid,commit,srchash; uint32_t flag = 0; int32_t senderind,i,vout,myind = -1; char str[65],str2[65]; struct dpow_sigentry dsig; struct dpow_entry *ep,E; bits256 hashmsg,txid,commit,srchash; struct dpow_block *bp = 0; uint32_t flag = 0; int32_t senderind,i,vout,myind = -1; char str[65],str2[65]; struct dpow_sigentry dsig; struct dpow_entry *ep,E;
if ( channel == DPOW_UTXOCHANNEL || channel == DPOW_UTXOBTCCHANNEL ) if ( channel == DPOW_UTXOCHANNEL || channel == DPOW_UTXOBTCCHANNEL )
{ {
memset(&E,0,sizeof(E)); memset(&E,0,sizeof(E));
if ( dpow_rwutxobuf(0,data,&hashmsg,&E) < 0 ) if ( dpow_rwutxobuf(0,data,&hashmsg,&E) < 0 )
return; return;
if ( bp != 0 || (bp= dpow_heightfind(myinfo,height,channel == DPOW_UTXOBTCCHANNEL)) != 0 ) if ( (bp= dpow_heightfind(myinfo,height,channel == DPOW_UTXOBTCCHANNEL)) != 0 )
{ {
dpow_notaryfind(myinfo,bp,&myind,myinfo->DPOW.minerkey33); dpow_notaryfind(myinfo,bp,&myind,myinfo->DPOW.minerkey33);
if ( myind < 0 ) if ( myind < 0 )
@ -97,7 +97,7 @@ void dpow_datahandler(struct supernet_info *myinfo,struct dpow_block *bp,uint32_
{ {
if ( dpow_rwsigentry(0,data,&dsig) < 0 ) if ( dpow_rwsigentry(0,data,&dsig) < 0 )
return; return;
if ( dsig.senderind >= 0 && dsig.senderind < DPOW_MAXRELAYS && (bp != 0 || (bp= dpow_heightfind(myinfo,height,channel == DPOW_SIGBTCCHANNEL)) != 0) ) if ( dsig.senderind >= 0 && dsig.senderind < DPOW_MAXRELAYS && (bp= dpow_heightfind(myinfo,height,channel == DPOW_SIGBTCCHANNEL)) != 0 )
{ {
dpow_notaryfind(myinfo,bp,&myind,myinfo->DPOW.minerkey33); dpow_notaryfind(myinfo,bp,&myind,myinfo->DPOW.minerkey33);
if ( myind < 0 ) if ( myind < 0 )
@ -125,9 +125,7 @@ void dpow_datahandler(struct supernet_info *myinfo,struct dpow_block *bp,uint32_
} }
else if ( channel == DPOW_TXIDCHANNEL || channel == DPOW_BTCTXIDCHANNEL ) else if ( channel == DPOW_TXIDCHANNEL || channel == DPOW_BTCTXIDCHANNEL )
{ {
if ( bp != 0 || (bp= dpow_heightfind(myinfo,height,channel == DPOW_BTCTXIDCHANNEL)) != 0 ) if ( (bp= dpow_heightfind(myinfo,height,channel == DPOW_BTCTXIDCHANNEL)) != 0 )
{
if ( bp->state != 0xffffffff )
{ {
for (i=0; i<32; i++) for (i=0; i<32; i++)
srchash.bytes[i] = data[i]; srchash.bytes[i] = data[i];
@ -154,7 +152,6 @@ void dpow_datahandler(struct supernet_info *myinfo,struct dpow_block *bp,uint32_
bp->signedtx[0] = 0; bp->signedtx[0] = 0;
} }
} }
}
} else printf("txidchannel cant find bp for %d\n",height); } else printf("txidchannel cant find bp for %d\n",height);
} }
} }

2
iguana/dpow/dpow_network.c

@ -110,7 +110,7 @@ void dpow_nanomsg_update(struct supernet_info *myinfo)
{ {
myinfo->DPOW.crcs[firstz] = crc32; myinfo->DPOW.crcs[firstz] = crc32;
printf("NANORECV ht.%d channel.%08x (%d) crc32.%08x:%08x datalen.%d:%d\n",np->height,np->channel,size,np->crc32,crc32,np->datalen,(int32_t)(size - sizeof(*np))); printf("NANORECV ht.%d channel.%08x (%d) crc32.%08x:%08x datalen.%d:%d\n",np->height,np->channel,size,np->crc32,crc32,np->datalen,(int32_t)(size - sizeof(*np)));
dpow_datahandler(myinfo,0,np->channel,np->height,np->packet,size - np->size); dpow_datahandler(myinfo,np->channel,np->height,np->packet,size - np->size);
} }
} }
if ( np != 0 ) if ( np != 0 )

2
iguana/iguana_notary.c

@ -27,7 +27,7 @@
#include "iguana777.h" #include "iguana777.h"
#include "notaries.h" #include "notaries.h"
void dpow_datahandler(struct supernet_info *myinfo,struct dpow_block *bp,uint32_t channel,uint32_t height,uint8_t *data,int32_t datalen); void dpow_datahandler(struct supernet_info *myinfo,uint32_t channel,uint32_t height,uint8_t *data,int32_t datalen);
#include "dpow/dpow_network.c" #include "dpow/dpow_network.c"
#include "dpow/dpow_rpc.c" #include "dpow/dpow_rpc.c"

Loading…
Cancel
Save