From 720bf6251b64cf58ff1c5e2ac594f76a83c98878 Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 15 Jul 2019 02:16:12 -1100 Subject: [PATCH] Syntax --- src/komodo_nSPV.h | 3 ++- src/komodo_nSPV_defs.h | 1 + src/komodo_nSPV_fullnode.h | 2 +- src/komodo_nSPV_superlite.h | 18 ++++++++++++++++++ 4 files changed, 22 insertions(+), 2 deletions(-) diff --git a/src/komodo_nSPV.h b/src/komodo_nSPV.h index 541eeb8d2..dc561c6b0 100644 --- a/src/komodo_nSPV.h +++ b/src/komodo_nSPV.h @@ -208,8 +208,9 @@ int32_t NSPV_rwmempoolresp(int32_t rwflag,uint8_t *serialized,struct NSPV_mempoo if ( ptr->txids == 0 ) ptr->txids = (uint256 *)calloc(sizeof(*ptr->txids),ptr->numtxids); for (i=0; inumtxids; i++) - len += NSPV_rwtxidresp(rwflag,&serialized[len],&ptr->txids[i]); + len += iguana_rwbignum(rwflag,&serialized[len],sizeof(ptr->txids[i]),(uint8_t *)&ptr->txids[i]); } + len += iguana_rwbignum(rwflag,&serialized[len],sizeof(ptr->txid),(uint8_t *)&ptr->txid); len += iguana_rwnum(rwflag,&serialized[len],sizeof(ptr->nodeheight),&ptr->nodeheight); len += iguana_rwnum(rwflag,&serialized[len],sizeof(ptr->vout),&ptr->vout); len += iguana_rwnum(rwflag,&serialized[len],sizeof(ptr->pad32),&ptr->pad32); diff --git a/src/komodo_nSPV_defs.h b/src/komodo_nSPV_defs.h index ddba19cb6..1380f87d2 100644 --- a/src/komodo_nSPV_defs.h +++ b/src/komodo_nSPV_defs.h @@ -100,6 +100,7 @@ struct NSPV_mempoolresp { uint256 *txids; char coinaddr[64]; + uint256 txid; int32_t nodeheight,vout,pad32; uint16_t numtxids; uint8_t CCflag,funcid; }; diff --git a/src/komodo_nSPV_fullnode.h b/src/komodo_nSPV_fullnode.h index 09f8df4d2..be3c1b9e9 100644 --- a/src/komodo_nSPV_fullnode.h +++ b/src/komodo_nSPV_fullnode.h @@ -563,7 +563,7 @@ void komodo_nSPVreq(CNode *pfrom,std::vector request) // received a req pfrom->PushMessage("nSPV",response); pfrom->prevtimes[ind] = timestamp; } - NSPV_mempoolresp_purge(&T); + NSPV_mempoolresp_purge(&M); } } else fprintf(stderr,"len.%d req1.%d\n",len,request[1]); } diff --git a/src/komodo_nSPV_superlite.h b/src/komodo_nSPV_superlite.h index ba763f191..31c92955f 100644 --- a/src/komodo_nSPV_superlite.h +++ b/src/komodo_nSPV_superlite.h @@ -437,6 +437,24 @@ UniValue NSPV_txidsresp_json(struct NSPV_txidsresp *ptr) return(result); } +UniValue NSPV_mempoolresp_json(struct NSPV_mempoolresp *ptr) +{ + UniValue result(UniValue::VOBJ),array(UniValue::VARR); int32_t i; + result.push_back(Pair("result","success")); + for (i=0; inumtxids; i++) + array.push_back(Pair("txid",ptr->txids[i].GetHex().c_str())); + result.push_back(Pair("txids",array)); + result.push_back(Pair("address",ptr->coinaddr)); + result.push_back(Pair("isCC",ptr->CCflag)); + result.push_back(Pair("height",(int64_t)ptr->nodeheight)); + result.push_back(Pair("numtxids",(int64_t)ptr->numtxids)); + result.push_back(Pair("txid",ptr->txid.GetHex().c_str())); + result.push_back(Pair("vout",(int64_t)ptr->vout)); + result.push_back(Pair("funcid",(int64_t)ptr->funcid)); + result.push_back(Pair("lastpeer",NSPV_lastpeer)); + return(result); +} + UniValue NSPV_ntzsresp_json(struct NSPV_ntzsresp *ptr) { UniValue result(UniValue::VOBJ);