From 93dbf7d383328982bfc3a8eb4c9bfddea2581dfe Mon Sep 17 00:00:00 2001 From: jl777 Date: Wed, 9 Nov 2016 17:32:22 -0300 Subject: [PATCH] test --- iguana/dpow/dpow_fsm.c | 16 +++++++++++----- iguana/dpow/dpow_network.c | 2 +- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/iguana/dpow/dpow_fsm.c b/iguana/dpow/dpow_fsm.c index 7f89cc1de..d0c431344 100755 --- a/iguana/dpow/dpow_fsm.c +++ b/iguana/dpow/dpow_fsm.c @@ -96,12 +96,18 @@ void dpow_utxosync(struct supernet_info *myinfo,struct dpow_info *dp,struct dpow } } -void dpow_sync(struct supernet_info *myinfo,struct dpow_info *dp,struct dpow_block *bp,uint64_t refmask,int32_t myind,bits256 srchash,uint32_t channel,int32_t src_or_dest) +void dpow_sync(struct supernet_info *myinfo,struct dpow_info *dp,struct dpow_block *bp,int8_t bestk,uint64_t refmask,int32_t myind,bits256 srchash,uint32_t channel,int32_t src_or_dest) { int8_t lastk; uint64_t mask; - mask = dpow_maskmin(refmask,bp,&lastk); + if ( bestk < 0 ) + mask = dpow_maskmin(refmask,bp,&lastk); + else + { + lastk = bestk; + mask = refmask; + } //dpow_utxosync(myinfo,bp,mask,myind,srchash); - //if ( bp->notaries[myind].masks[lastk] == 0 ) + if ( bp->notaries[myind].masks[lastk] == 0 ) dpow_signedtxgen(myinfo,dp,(src_or_dest != 0) ? bp->destcoin : bp->srccoin,bp,lastk,mask,myind,src_or_dest != 0 ? DPOW_SIGBTCCHANNEL : DPOW_SIGCHANNEL,src_or_dest); } @@ -193,7 +199,7 @@ int32_t dpow_datahandler(struct supernet_info *myinfo,struct dpow_info *dp,uint3 dpow_utxosync(myinfo,dp,bp,0,myind,srchash); bp->recvmask |= (1LL << senderind); } - dpow_sync(myinfo,dp,bp,ep->recvmask,myind,srchash,channel,src_or_dest); + dpow_sync(myinfo,dp,bp,-1,ep->recvmask,myind,srchash,channel,src_or_dest); flag = 1; } //printf("bestk.%d %llx vs recv.%llx\n",bp->bestk,(long long)bp->bestmask,(long long)bp->recvmask); @@ -251,7 +257,7 @@ int32_t dpow_datahandler(struct supernet_info *myinfo,struct dpow_info *dp,uint3 } } //printf(" ht.%d (%d %llx) <<<<<<<< %s from.%d got lastk.%d %llx/%llx siglen.%d >>>>>>>>>\n",bp->height,bp->bestk,(long long)bp->bestmask,coin->symbol,dsig.senderind,dsig.lastk,(long long)dsig.mask,(long long)bp->destsigsmasks[dsig.lastk],dsig.siglen); - dpow_sync(myinfo,dp,bp,dsig.mask,myind,srchash,channel,src_or_dest); + dpow_sync(myinfo,dp,bp,dsig.lastk,dsig.mask,myind,srchash,channel,src_or_dest); flag = 1; } } else printf("%s pubkey mismatch for senderind.%d %llx vs %llx\n",coin->symbol,dsig.senderind,*(long long *)dsig.senderpub,*(long long *)bp->notaries[dsig.senderind].pubkey); diff --git a/iguana/dpow/dpow_network.c b/iguana/dpow/dpow_network.c index efa9030cb..202fe5541 100755 --- a/iguana/dpow/dpow_network.c +++ b/iguana/dpow/dpow_network.c @@ -352,7 +352,7 @@ void dpow_sigsend(struct supernet_info *myinfo,struct dpow_info *dp,struct dpow_ { struct dpow_sigentry dsig; int32_t i,len; uint8_t data[4096]; struct dpow_entry *ep; ep = &bp->notaries[myind]; - //printf("ht.%d sigsend.%s: myind.%d bestk.%d %llx >>>>>> broadcast channel.%x best.(%d %llx) recv.%llx\n",bp->height,sigchannel == DPOW_SIGCHANNEL ? bp->srccoin->symbol : bp->destcoin->symbol,myind,bestk,(long long)bestmask,sigchannel,bp->bestk,(long long)(bp->bestk>=0?bp->bestmask:0),(long long)bp->recvmask); + printf("ht.%d sigsend.%s: myind.%d bestk.%d %llx >>>>>> broadcast channel.%x best.(%d %llx) recv.%llx\n",bp->height,sigchannel == DPOW_SIGCHANNEL ? bp->srccoin->symbol : bp->destcoin->symbol,myind,bestk,(long long)bestmask,sigchannel,bp->bestk,(long long)(bp->bestk>=0?bp->bestmask:0),(long long)bp->recvmask); memset(&dsig,0,sizeof(dsig)); for (i=0; i<33; i++) dsig.senderpub[i] = dp->minerkey33[i];