From 1713a171cd5db7097685d67ce76a4bf69d1cc07a Mon Sep 17 00:00:00 2001 From: jl777 Date: Wed, 3 Jul 2019 03:09:33 -1100 Subject: [PATCH] Adjust Len by sizeof ptr --- src/komodo_nSPV.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/komodo_nSPV.h b/src/komodo_nSPV.h index 117438e51..bd5b5cbef 100644 --- a/src/komodo_nSPV.h +++ b/src/komodo_nSPV.h @@ -388,12 +388,13 @@ int32_t NSPV_getaddressutxos(struct NSPV_utxosresp *ptr,char *coinaddr) // check total += it->second.satoshis; n++; } - fprintf(stderr,"getaddressutxos for %s -> n.%d total %.8f interest %.8f\n",coinaddr,n,dstr(total),dstr(interest)); + len = (int32_t)(sizeof(*ptr) + sizeof(*ptr->utxos)*ptr->numutxos - sizeof(ptr->utxos)); + fprintf(stderr,"getaddressutxos for %s -> n.%d:%d total %.8f interest %.8f len.%d\n",coinaddr,n,ptr->numutxos,dstr(total),dstr(interest),len); if ( n == ptr->numutxos ) { ptr->total = total; ptr->interest = interest; - return((int32_t)(sizeof(*ptr) + sizeof(*ptr->utxos)*ptr->numutxos)); + return(len); } } if ( ptr->utxos != 0 ) @@ -461,6 +462,7 @@ void komodo_nSPVreq(CNode *pfrom,std::vector request) // received a req slen = NSPV_getaddressutxos(&U,coinaddr); response.resize(1 + slen); response[0] = NSPV_UTXOSRESP; + printf("slen.%d\n",slen); if ( NSPV_rwutxosresp(1,&response[1],&U) == slen ) { pfrom->PushMessage("nSPV",response);