int16 -> int32
This commit is contained in:
@@ -29,7 +29,7 @@
|
||||
#ifndef KOMODO_NSPV_H
|
||||
#define KOMODO_NSPV_H
|
||||
|
||||
int32_t iguana_rwbuf(int32_t rwflag,uint8_t *serialized,uint16_t len,uint8_t *buf)
|
||||
int32_t iguana_rwbuf(int32_t rwflag,uint8_t *serialized,int32_t len,uint8_t *buf)
|
||||
{
|
||||
if ( rwflag != 0 )
|
||||
memcpy(serialized,buf,len);
|
||||
@@ -73,7 +73,7 @@ int32_t iguana_rwuint8vec(int32_t rwflag,uint8_t *serialized,int32_t *biglenp,ui
|
||||
if ( (vsize= *biglenp) > 0 && vsize < MAX_TX_SIZE_AFTER_SAPLING )
|
||||
{
|
||||
if ( *ptrp == 0 )
|
||||
*ptrp = (uint8_t *)calloc(1,vsize); // relies on uint16_t being "small" to prevent mem exhaustion
|
||||
*ptrp = (uint8_t *)calloc(1,vsize);
|
||||
len += iguana_rwbuf(rwflag,&serialized[len],vsize,*ptrp);
|
||||
}
|
||||
return(len);
|
||||
|
||||
@@ -190,7 +190,6 @@ uint8_t *NSPV_getrawtx(CTransaction &tx,uint256 &hashBlock,int32_t *txlenp,uint2
|
||||
uint8_t *rawtx = 0;
|
||||
*txlenp = 0;
|
||||
{
|
||||
LOCK(cs_main);
|
||||
if (!GetTransaction(txid, tx, hashBlock, false))
|
||||
return(0);
|
||||
string strHex = EncodeHexTx(tx);
|
||||
@@ -210,7 +209,7 @@ int32_t NSPV_sendrawtransaction(struct NSPV_broadcastresp *ptr,uint8_t *data,int
|
||||
ptr->retcode = 0;
|
||||
if ( NSPV_txextract(tx,data,n) == 0 )
|
||||
{
|
||||
LOCK(cs_main);
|
||||
//LOCK(cs_main);
|
||||
ptr->txid = tx.GetHash();
|
||||
//fprintf(stderr,"try to addmempool transaction %s\n",ptr->txid.GetHex().c_str());
|
||||
if ( myAddtomempool(tx) != 0 )
|
||||
@@ -496,14 +495,14 @@ void komodo_nSPVreq(CNode *pfrom,std::vector<uint8_t> request) // received a req
|
||||
{
|
||||
if ( timestamp > pfrom->prevtimes[ind] )
|
||||
{
|
||||
struct NSPV_broadcastresp B; uint16_t n,offset; uint256 txid;
|
||||
struct NSPV_broadcastresp B; uint32_t n,offset; uint256 txid;
|
||||
if ( len > 1+sizeof(txid)+sizeof(n) )
|
||||
{
|
||||
iguana_rwbignum(0,&request[1],sizeof(txid),(uint8_t *)&txid);
|
||||
iguana_rwnum(0,&request[1+sizeof(txid)],sizeof(n),&n);
|
||||
memset(&B,0,sizeof(B));
|
||||
offset = 1 + sizeof(txid) + sizeof(n);
|
||||
if ( request.size() == offset+n && (slen= NSPV_sendrawtransaction(&B,&request[offset],n)) > 0 )
|
||||
if ( n < MAX_TX_SIZE_AFTER_SAPLING && request.size() == offset+n && (slen= NSPV_sendrawtransaction(&B,&request[offset],n)) > 0 )
|
||||
{
|
||||
response.resize(1 + slen);
|
||||
response[0] = NSPV_BROADCASTRESP;
|
||||
|
||||
@@ -593,7 +593,7 @@ UniValue NSPV_txidhdrsproof(uint256 prevtxid,uint256 nexttxid)
|
||||
msg[len++] = NSPV_NTZSPROOF;
|
||||
len += iguana_rwbignum(1,&msg[len],sizeof(prevtxid),(uint8_t *)&prevtxid);
|
||||
len += iguana_rwbignum(1,&msg[len],sizeof(nexttxid),(uint8_t *)&nexttxid);
|
||||
//for (iter=0; iter<3; iter++);
|
||||
for (iter=0; iter<3; iter++);
|
||||
if ( NSPV_req(0,msg,len,NODE_NSPV,msg[0]>>1) != 0 )
|
||||
{
|
||||
for (i=0; i<NSPV_POLLITERS; i++)
|
||||
@@ -602,7 +602,7 @@ UniValue NSPV_txidhdrsproof(uint256 prevtxid,uint256 nexttxid)
|
||||
if ( NSPV_ntzsproofresult.prevtxid == prevtxid && NSPV_ntzsproofresult.nexttxid == nexttxid )
|
||||
return(NSPV_ntzsproof_json(&NSPV_ntzsproofresult));
|
||||
}
|
||||
} //else sleep(1);
|
||||
} else sleep(1);
|
||||
memset(&P,0,sizeof(P));
|
||||
return(NSPV_ntzsproof_json(&P));
|
||||
}
|
||||
@@ -671,7 +671,7 @@ UniValue NSPV_spentinfo(uint256 txid,int32_t vout)
|
||||
|
||||
UniValue NSPV_broadcast(char *hex)
|
||||
{
|
||||
uint8_t *msg,*data; uint256 txid; uint16_t n; int32_t i,iter,len = 0; struct NSPV_broadcastresp B;
|
||||
uint8_t *msg,*data; uint256 txid; int32_t i,n,iter,len = 0; struct NSPV_broadcastresp B;
|
||||
NSPV_broadcast_purge(&NSPV_broadcastresult);
|
||||
n = (int32_t)strlen(hex) >> 1;
|
||||
data = (uint8_t *)malloc(n);
|
||||
|
||||
Reference in New Issue
Block a user