From 7958b7ecfc7263692d93f21c1f3fb11640900aa9 Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 4 Jul 2019 01:32:35 -1100 Subject: [PATCH] Test --- src/komodo_nSPV.h | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/komodo_nSPV.h b/src/komodo_nSPV.h index 701f144b7..522adbcfa 100644 --- a/src/komodo_nSPV.h +++ b/src/komodo_nSPV.h @@ -76,10 +76,14 @@ int32_t iguana_rwequihdrvec(int32_t rwflag,uint8_t *serialized,uint16_t *vecsize len += iguana_rwnum(rwflag,&serialized[len],sizeof(*vecsizep),vecsizep); if ( (vsize= *vecsizep) != 0 ) { + fprintf(stderr,"vsize.%d ptrp.%p alloc %ld\n",*ptrp,sizeof(struct NSPV_equihdr)*vsize); if ( *ptrp == 0 ) - *ptrp = (struct NSPV_equihdr *)calloc(sizeof(**ptrp),vsize); // relies on uint16_t being "small" to prevent mem exhaustion + *ptrp = (struct NSPV_equihdr *)calloc(sizeof(struct NSPV_equihdr),vsize); // relies on uint16_t being "small" to prevent mem exhaustion for (i=0; ipad32),&ptr->pad32); len += iguana_rwnum(rwflag,&serialized[len],sizeof(ptr->prevtxidht),&ptr->prevtxidht); len += iguana_rwnum(rwflag,&serialized[len],sizeof(ptr->nexttxidht),&ptr->nexttxidht); + fprintf(stderr,"rwvecgtors lens %d %d\n",ptr->prevlen,ptr->nextlen); len += iguana_rwuint8vec(rwflag,&serialized[len],&ptr->prevlen,&ptr->prevntz); len += iguana_rwuint8vec(rwflag,&serialized[len],&ptr->nextlen,&ptr->nextntz); + fprintf(stderr,"rwntzsproof len %d\n",len); return(len); } @@ -544,7 +550,7 @@ int32_t NSPV_getntzsproofresp(struct NSPV_ntzsproofresp *ptr,int32_t prevht,int3 ptr->nexttxidht = nextht; ptr->common.numhdrs = (nextht - prevht + 1); ptr->common.hdrs = (struct NSPV_equihdr *)calloc(ptr->common.numhdrs,sizeof(*ptr->common.hdrs)); - fprintf(stderr,"allocate numhdrs.%d\n",ptr->common.numhdrs); + fprintf(stderr,"prev.%d next.%d allocate numhdrs.%d\n",prevht,nextht,ptr->common.numhdrs); for (i=0; icommon.numhdrs; i++) { fprintf(stderr,"%d ht.%d\n",i,prevht+i); @@ -670,13 +676,16 @@ void komodo_nSPVreq(CNode *pfrom,std::vector request) // received a req memset(&P,0,sizeof(P)); if ( (slen= NSPV_getntzsproofresp(&P,prevht,nextht)) > 0 ) { + fprintf(stderr,"ntzsproof slen.%d\n",slen); response.resize(1 + slen); response[0] = NSPV_NTZSPROOFRESP; if ( NSPV_rwntzsproofresp(1,&response[1],&P) == slen ) { + fprintf(stderr,"respond with %d\n",slen); pfrom->PushMessage("nSPV",response); pfrom->prevtimes[ind] = timestamp; } + fprintf(stderr,"purge.%d\n",P.common.numhdrs); NSPV_ntzsproofresp_purge(&P); } }