From a04b17f8df77f7cf8412d7f063f80ba847ffd9a9 Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 5 Jul 2019 23:58:16 -1100 Subject: [PATCH] Tweaks --- src/komodo_nSPV.h | 1 + src/komodo_nSPV_fullnode.h | 10 +++++----- src/komodo_nSPV_superlite.h | 1 + 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/komodo_nSPV.h b/src/komodo_nSPV.h index fd90df5f4..98ec7cd52 100644 --- a/src/komodo_nSPV.h +++ b/src/komodo_nSPV.h @@ -374,6 +374,7 @@ int32_t NSPV_rwbroadcastresp(int32_t rwflag,uint8_t *serialized,struct NSPV_broa int32_t len = 0; len += iguana_rwbignum(rwflag,&serialized[len],sizeof(ptr->txid),(uint8_t *)&ptr->txid); len += iguana_rwnum(rwflag,&serialized[len],sizeof(ptr->retcode),&ptr->retcode); + fprintf(stderr,"broadcastresp[%d]\n",len); return(len); } diff --git a/src/komodo_nSPV_fullnode.h b/src/komodo_nSPV_fullnode.h index a29176255..bc3003dd4 100644 --- a/src/komodo_nSPV_fullnode.h +++ b/src/komodo_nSPV_fullnode.h @@ -197,12 +197,11 @@ uint8_t *NSPV_getrawtx(uint256 &hashBlock,uint16_t *txlenp,uint256 txid) int32_t NSPV_sendrawtransaction(struct NSPV_broadcastresp *ptr,uint8_t *data,int32_t n) { - CTransaction tx; std::string rawtx; + CTransaction tx; std::vector rawdata; ptr->retcode = 0; - rawtx.resize(n*2+1); - init_hexbytes_noT((char *)rawtx.data(),data,n); - //fprintf(stderr,"rawtx.(%s)\n",rawtx.c_str()); - if ( DecodeHexTx(tx,rawtx) != 0 ) + rawdata.resize(n); + memcpy(&rawdata[0],data,n); + if ( DecodeHexTx(tx,rawdata.GetHex()) != 0 ) { LOCK(cs_main); ptr->txid = tx.GetHash(); @@ -494,6 +493,7 @@ void komodo_nSPVreq(CNode *pfrom,std::vector request) // received a req { response.resize(1 + slen); response[0] = NSPV_BROADCASTRESP; + fprintf(stderr,"slen.%d\n"); if ( NSPV_rwbroadcastresp(1,&response[1],&B) == slen ) { pfrom->PushMessage("nSPV",response); diff --git a/src/komodo_nSPV_superlite.h b/src/komodo_nSPV_superlite.h index bea83c38c..c7aec72ad 100644 --- a/src/komodo_nSPV_superlite.h +++ b/src/komodo_nSPV_superlite.h @@ -401,6 +401,7 @@ UniValue NSPV_broadcast(char *hex) } free(msg); memset(&B,0,sizeof(B)); + B.retcode = -2; return(NSPV_broadcast_json(&B)); }