From 714ec71862591017d07431f674d40905718dfb66 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sun, 16 Oct 2016 10:39:24 -0300 Subject: [PATCH] test --- iguana/dpow/dpow_fsm.c | 18 ++++++++++++++---- iguana/dpow/dpow_network.c | 4 +++- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/iguana/dpow/dpow_fsm.c b/iguana/dpow/dpow_fsm.c index d97cddb3f..6c8034ce9 100755 --- a/iguana/dpow/dpow_fsm.c +++ b/iguana/dpow/dpow_fsm.c @@ -102,11 +102,18 @@ void dpow_sync(struct supernet_info *myinfo,struct dpow_block *bp,uint64_t refma void dpow_datahandler(struct supernet_info *myinfo,uint32_t channel,uint32_t height,uint8_t *data,int32_t datalen,int32_t src_or_dest) { - bits256 hashmsg,txid,commit,srchash; struct dpow_block *bp = 0; uint32_t flag = 0; int32_t senderind,i,myind = -1; char str[65],str2[65]; struct dpow_sigentry dsig; struct dpow_entry *ep; struct dpow_coinentry *cp; struct dpow_utxoentry U; struct iguana_info *coin; - if ( (bp= dpow_heightfind(myinfo,height)) == 0 ) + bits256 hashmsg,txid,commit,srchash; struct dpow_block *bp = 0; uint32_t starttime,flag = 0; int32_t senderind,i,myind = -1; char str[65],str2[65]; struct dpow_sigentry dsig; struct dpow_entry *ep; struct dpow_coinentry *cp; struct dpow_utxoentry U; struct iguana_info *coin; + starttime = (uint32_t)time(NULL); + while ( 1 ) { - printf("dpow_datahandler: cant find ht.%d\n",height); - return; + if ( (bp= dpow_heightfind(myinfo,height)) != 0 ) + break; + if ( time(NULL) > starttime+10 ) + { + printf("dpow_datahandler: cant find ht.%d\n",height); + return; + } + sleep(1); } dpow_notaryfind(myinfo,bp,&myind,myinfo->DPOW.minerkey33); if ( myind < 0 ) @@ -116,7 +123,10 @@ void dpow_datahandler(struct supernet_info *myinfo,uint32_t channel,uint32_t hei { memset(&U,0,sizeof(U)); if ( dpow_rwutxobuf(0,data,&U,bp) < 0 ) + { + printf("error from rwutxobuf\n"); return; + } if ( bits256_cmp(hashmsg,bp->hashmsg) != 0 ) { printf("unexpected mismatch hashmsg.%s vs %s\n",bits256_str(str,hashmsg),bits256_str(str2,bp->hashmsg)); diff --git a/iguana/dpow/dpow_network.c b/iguana/dpow/dpow_network.c index e24381307..07e04a8b9 100755 --- a/iguana/dpow/dpow_network.c +++ b/iguana/dpow/dpow_network.c @@ -193,8 +193,10 @@ int32_t dpow_rwutxobuf(int32_t rwflag,uint8_t *data,struct dpow_utxoentry *up,st { uint8_t numnotaries; uint64_t othermask; int32_t i,len = 0; if ( bits256_nonz(up->srchash) == 0 || bits256_nonz(up->desthash) == 0 ) + { + printf("dpow_rwutxobuf null src.%d or dest.%d\n",bits256_nonz(up->srchash),bits256_nonz(up->desthash)); return(-1); - len = 2; + } len += iguana_rwbignum(rwflag,&data[len],sizeof(up->hashmsg),up->hashmsg.bytes); len += iguana_rwbignum(rwflag,&data[len],sizeof(up->srchash),up->srchash.bytes); len += iguana_rwbignum(rwflag,&data[len],sizeof(up->desthash),up->desthash.bytes);