diff --git a/iguana/dpow/dpow_fsm.c b/iguana/dpow/dpow_fsm.c index cdea65bf2..347556f79 100755 --- a/iguana/dpow/dpow_fsm.c +++ b/iguana/dpow/dpow_fsm.c @@ -102,7 +102,7 @@ void dpow_sync(struct supernet_info *myinfo,struct dpow_block *bp,uint64_t refma mask = dpow_maskmin(refmask,bp,&lastk); //dpow_utxosync(myinfo,bp,mask,myind,srchash); if ( bp->notaries[myind].masks[lastk] == 0 ) - dpow_signedtxgen(myinfo,(src_or_dest != 0) ? bp->destcoin : bp->srccoin,bp,lastk,mask,myind,bp->opret_symbol,bits256_nonz(bp->desttxid) == 0 ? DPOW_SIGBTCCHANNEL : DPOW_SIGCHANNEL,src_or_dest); + dpow_signedtxgen(myinfo,(src_or_dest != 0) ? bp->destcoin : bp->srccoin,bp,lastk,mask,myind,bp->opret_symbol,src_or_dest != 0 ? DPOW_SIGBTCCHANNEL : DPOW_SIGCHANNEL,src_or_dest); } int32_t dpow_datahandler(struct supernet_info *myinfo,uint32_t channel,uint32_t height,uint8_t *data,int32_t datalen,int32_t src_or_dest) @@ -113,11 +113,12 @@ int32_t dpow_datahandler(struct supernet_info *myinfo,uint32_t channel,uint32_t dpow_notaryfind(myinfo,bp,&myind,myinfo->DPOW.minerkey33); if ( myind < 0 ) return(-1); - coin = (src_or_dest != 0) ? bp->destcoin : bp->srccoin; for (i=0; i<32; i++) srchash.bytes[i] = myinfo->DPOW.minerkey33[i+1]; if ( channel == DPOW_UTXOCHANNEL ) { + src_or_dest = 1; + coin = (src_or_dest != 0) ? bp->destcoin : bp->srccoin; memset(&U,0,sizeof(U)); if ( dpow_rwutxobuf(0,data,&U,bp) < 0 ) { @@ -145,6 +146,8 @@ int32_t dpow_datahandler(struct supernet_info *myinfo,uint32_t channel,uint32_t } else if ( channel == DPOW_SIGCHANNEL || channel == DPOW_SIGBTCCHANNEL ) { + src_or_dest = (channel == DPOW_SIGBTCCHANNEL); + coin = (src_or_dest != 0) ? bp->destcoin : bp->srccoin; if ( dpow_rwsigentry(0,data,&dsig) < 0 ) return(0); if ( dsig.senderind >= 0 && dsig.senderind < DPOW_MAXRELAYS ) @@ -181,10 +184,12 @@ int32_t dpow_datahandler(struct supernet_info *myinfo,uint32_t channel,uint32_t } else printf("%s illegal lastk.%d or senderind.%d or senderpub.%llx\n",coin->symbol,dsig.lastk,dsig.senderind,*(long long *)dsig.senderpub); } else printf("couldnt find senderind.%d height.%d channel.%x\n",dsig.senderind,height,channel); //if ( 0 && bp != 0 ) - printf(" SIG.%d sender.%d lastk.%d mask.%llx siglen.%d recv.%llx\n",height,dsig.senderind,dsig.lastk,(long long)dsig.mask,dsig.siglen,(long long)bp->recvmask); + printf("%s SIG.%d sender.%d lastk.%d mask.%llx siglen.%d recv.%llx\n",coin->symbol,height,dsig.senderind,dsig.lastk,(long long)dsig.mask,dsig.siglen,(long long)bp->recvmask); } else if ( channel == DPOW_TXIDCHANNEL || channel == DPOW_BTCTXIDCHANNEL ) { + 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++) diff --git a/iguana/dpow/dpow_network.c b/iguana/dpow/dpow_network.c index 93f303ac7..9d94b08c2 100755 --- a/iguana/dpow/dpow_network.c +++ b/iguana/dpow/dpow_network.c @@ -114,7 +114,7 @@ void dpow_nanomsg_update(struct supernet_info *myinfo) if ( crc32 == np->crc32 && (firstz= dpow_crc32find(myinfo,crc32,np->channel)) >= 0 ) { printf("NANORECV ht.%d channel.%08x (%d) crc32.%08x:%08x datalen.%d:%d firstz.%d\n",np->height,np->channel,size,np->crc32,crc32,np->datalen,(int32_t)(size - sizeof(*np)),firstz); - if ( dpow_datahandler(myinfo,np->channel,np->height,np->packet,np->datalen,1) >= 0 ) + if ( dpow_datahandler(myinfo,np->channel,np->height,np->packet,np->datalen) >= 0 ) myinfo->DPOW.crcs[firstz] = crc32; } } else printf("np->datalen.%d %d (size %d - %ld)\n",np->datalen,(int32_t)(size-sizeof(*np)),size,sizeof(*np)); diff --git a/iguana/dpow/dpow_tx.c b/iguana/dpow/dpow_tx.c index a01808fb8..52befadcc 100755 --- a/iguana/dpow/dpow_tx.c +++ b/iguana/dpow/dpow_tx.c @@ -182,8 +182,6 @@ void dpow_rawtxsign(struct supernet_info *myinfo,struct iguana_info *coin,struct m = 0; ep = &bp->notaries[myind]; cp = (src_or_dest != 0) ? &bp->notaries[myind].dest : &bp->notaries[myind].src; - if ( src_or_dest == 0 ) - printf("bestk.%d mask.%llx dpowsign.(%s)\n",bestk,(long long)bestmask,rawtx); if ( (jsonstr= dpow_signrawtransaction(myinfo,coin,rawtx,vins)) != 0 ) { if ( (signobj= cJSON_Parse(jsonstr)) != 0 ) @@ -199,7 +197,7 @@ void dpow_rawtxsign(struct supernet_info *myinfo,struct iguana_info *coin,struct item = jitem(vin,j); if ( (sobj= jobj(item,"scriptSig")) != 0 && (sigstr= jstr(sobj,"hex")) != 0 && strlen(sigstr) > 32 ) { - printf("%s height.%d mod.%d VINI.%d myind.%d MINE.(%s) j.%d\n",(src_or_dest != 0) ? bp->srccoin->symbol : bp->destcoin->symbol,bp->height,bp->height%bp->numnotaries,j,myind,jprint(item,0),j); + printf("%s height.%d mod.%d VINI.%d myind.%d MINE.(%s) j.%d\n",(src_or_dest != 0) ? bp->destcoin->symbol : bp->srccoin->symbol,bp->height,bp->height%bp->numnotaries,j,myind,jprint(item,0),j); cp->siglens[bestk] = (int32_t)strlen(sigstr) >> 1; if ( src_or_dest != 0 ) bp->destsigsmasks[bestk] |= (1LL << myind); @@ -229,8 +227,6 @@ int32_t dpow_signedtxgen(struct supernet_info *myinfo,struct iguana_info *coin,s if ( bp->numnotaries < 8 ) incr = 1; else incr = sqrt(bp->numnotaries) + 1; - if ( src_or_dest == 0 ) - printf("signedtxgen KMD\n"); bestmask = dpow_maskmin(bestmask,bp,&bestk); ep = &bp->notaries[myind]; memset(&zero,0,sizeof(zero)); diff --git a/iguana/iguana_notary.c b/iguana/iguana_notary.c index b9352e47b..1c8657b92 100755 --- a/iguana/iguana_notary.c +++ b/iguana/iguana_notary.c @@ -27,7 +27,7 @@ #include "iguana777.h" #include "notaries.h" -int32_t dpow_datahandler(struct supernet_info *myinfo,uint32_t channel,uint32_t height,uint8_t *data,int32_t datalen,int32_t src_or_dest); +int32_t 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_rpc.c"