This commit is contained in:
jl777
2019-07-15 02:16:12 -11:00
parent 28e10d71bf
commit 720bf6251b
4 changed files with 22 additions and 2 deletions

View File

@@ -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; i<ptr->numtxids; 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);

View File

@@ -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;
};

View File

@@ -563,7 +563,7 @@ void komodo_nSPVreq(CNode *pfrom,std::vector<uint8_t> 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]);
}

View File

@@ -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; i<ptr->numtxids; 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);