Return height -1 if tx can't be found

This commit is contained in:
jl777
2019-08-14 02:14:55 -11:00
parent d654b4136c
commit e4073351d4

View File

@@ -448,8 +448,9 @@ int32_t NSPV_sendrawtransaction(struct NSPV_broadcastresp *ptr,uint8_t *data,int
int32_t NSPV_gettxproof(struct NSPV_txproof *ptr,int32_t vout,uint256 txid,int32_t height) int32_t NSPV_gettxproof(struct NSPV_txproof *ptr,int32_t vout,uint256 txid,int32_t height)
{ {
int32_t flag = 0,len = 0; CTransaction _tx; uint256 hashBlock; CBlock block; CBlockIndex *pindex; int32_t flag = 0,len = 0; CTransaction _tx; uint256 hashBlock; CBlock block; CBlockIndex *pindex;
if ( (ptr->tx= NSPV_getrawtx(_tx,hashBlock,&ptr->txlen,txid)) == 0 ) ptr->height = -1;
return(-1); if ( (ptr->tx= NSPV_getrawtx(_tx,hashBlock,&ptr->txlen,txid)) != 0 )
{
ptr->txid = txid; ptr->txid = txid;
ptr->vout = vout; ptr->vout = vout;
ptr->hashblock = hashBlock; ptr->hashblock = hashBlock;
@@ -488,6 +489,7 @@ int32_t NSPV_gettxproof(struct NSPV_txproof *ptr,int32_t vout,uint256 txid,int32
} }
} }
ptr->unspentvalue = CCgettxout(txid,vout,1,1); ptr->unspentvalue = CCgettxout(txid,vout,1,1);
}
return(sizeof(*ptr) - sizeof(ptr->tx) - sizeof(ptr->txproof) + ptr->txlen + ptr->txprooflen); return(sizeof(*ptr) - sizeof(ptr->tx) - sizeof(ptr->txproof) + ptr->txlen + ptr->txprooflen);
} }