From c08562eb3eaf707a138589a9c3060d590cd82470 Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 14 Nov 2016 09:36:55 -0300 Subject: [PATCH] test --- iguana/dpow/dpow_fsm.c | 5 +++++ iguana/dpow/dpow_network.c | 21 ++++++++++++--------- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/iguana/dpow/dpow_fsm.c b/iguana/dpow/dpow_fsm.c index 802c32ff8..c30891afe 100755 --- a/iguana/dpow/dpow_fsm.c +++ b/iguana/dpow/dpow_fsm.c @@ -301,6 +301,11 @@ void dpow_statemachinestart(void *ptr) free(ptr); return; } + if ( bp->isratify != 0 && memcmp(bp->notaries[0].pubkey,bp->ratified_pubkeys[0],33) != 0 ) + { + printf("cant change notary0\n"); + return; + } printf(" myind.%d myaddr.(%s %s)\n",myind,srcaddr,destaddr); if ( myind == 0 && bits256_nonz(destprevtxid0) != 0 && bits256_nonz(srcprevtxid0) != 0 && destprevvout0 >= 0 && srcprevvout0 >= 0 ) { diff --git a/iguana/dpow/dpow_network.c b/iguana/dpow/dpow_network.c index cbde84128..349c4d217 100755 --- a/iguana/dpow/dpow_network.c +++ b/iguana/dpow/dpow_network.c @@ -348,11 +348,12 @@ void dpow_send(struct supernet_info *myinfo,struct dpow_info *dp,struct dpow_blo } np->senderind = bp->myind; memcpy(np->ipbits,dp->ipbits,dp->numipbits * sizeof(*dp->ipbits)); - //for (i=0; inumipbits; i++) - // printf("%08x ",np->ipbits[i]); - //printf(" dpow_send.(%d) size.%d numipbits.%d myind.%d\n",datalen,size,np->numipbits,bp->myind); - dpow_nanoutxoset(&np->notarize,bp,0); - dpow_nanoutxoset(&np->ratify,bp,1); + for (i=0; inumipbits; i++) + printf("%08x ",np->ipbits[i]); + printf(" dpow_send.(%d) size.%d numipbits.%d myind.%d\n",datalen,size,np->numipbits,bp->myind); + if ( bp->isratify == 0 ) + dpow_nanoutxoset(&np->notarize,bp,0); + else dpow_nanoutxoset(&np->ratify,bp,1); np->size = size; np->datalen = datalen; np->crc32 = crc32; @@ -381,8 +382,8 @@ void dpow_ipbitsadd(struct supernet_info *myinfo,struct dpow_info *dp,uint32_t * } n = dp->numipbits; matched = missing = 0; - //for (i=0; imyaddr.myipbits); dpow_addnotary(myinfo,dp,ipaddr); + printf("recv numips.(%d %d)\n",myinfo->numdpowipbits,dp->numipbits); } void dpow_nanomsg_update(struct supernet_info *myinfo) @@ -446,8 +448,9 @@ void dpow_nanomsg_update(struct supernet_info *myinfo) { if ( np->senderind >= 0 && np->senderind < bp->numnotaries ) { - dpow_nanoutxoget(myinfo,dp,bp,&np->notarize,0,np->senderind); - dpow_nanoutxoget(myinfo,dp,bp,&np->ratify,1,np->senderind); + if ( bp->isratify == 0 ) + dpow_nanoutxoget(myinfo,dp,bp,&np->notarize,0,np->senderind); + else dpow_nanoutxoget(myinfo,dp,bp,&np->ratify,1,np->senderind); dpow_datahandler(myinfo,dp,bp,np->senderind,np->channel,np->height,np->packet,np->datalen); } }