Have full node txproof return height if not set

This commit is contained in:
jl777
2019-07-22 05:30:04 -11:00
parent 0ce3df8627
commit db4721816c

View File

@@ -408,8 +408,10 @@ int32_t NSPV_gettxproof(struct NSPV_txproof *ptr,int32_t vout,uint256 txid,int32
return(-1);
ptr->txid = txid;
ptr->vout = vout;
if ( height != 0 )
{
ptr->height = height;
if ( height != 0 && (pindex= komodo_chainactive(height)) != 0 && komodo_blockload(block,pindex) == 0 )
if ((pindex= komodo_chainactive(height)) != 0 && komodo_blockload(block,pindex) == 0 )
{
BOOST_FOREACH(const CTransaction&tx, block.vtx)
{
@@ -437,6 +439,12 @@ int32_t NSPV_gettxproof(struct NSPV_txproof *ptr,int32_t vout,uint256 txid,int32
//fprintf(stderr,"gettxproof slen.%d\n",(int32_t)(sizeof(*ptr) - sizeof(ptr->tx) - sizeof(ptr->txproof) + ptr->txlen + ptr->txprooflen));
}
}
}
else
{
if ( GetTransaction(args->txid,tx,hashBlock,false) != 0 )
ptr->height = komodo_blockheight(hashBlock);
}
ptr->unspentvalue = CCgettxout(txid,vout,1,1);
return(sizeof(*ptr) - sizeof(ptr->tx) - sizeof(ptr->txproof) + ptr->txlen + ptr->txprooflen);
}