Add caching to three requests: ntzsresp, txproof, ntzsproof

This commit is contained in:
jl777
2019-07-10 01:21:47 -11:00
parent 2992d085ec
commit 958f2c198e
4 changed files with 131 additions and 20 deletions

View File

@@ -77,7 +77,7 @@ int32_t NSPV_ntzextract(struct NSPV_ntz *ptr,uint256 ntztxid,int32_t txidht,uint
return(0);
}
int32_t NSPV_getntzsresp(struct NSPV_ntzsresp *ptr,int32_t height)
int32_t NSPV_getntzsresp(struct NSPV_ntzsresp *ptr,int32_t reqheight)
{
struct NSPV_ntzargs prev,next;
if ( height < chainActive.LastTip()->GetHeight() )
@@ -86,6 +86,7 @@ int32_t NSPV_getntzsresp(struct NSPV_ntzsresp *ptr,int32_t height)
{
if ( prev.ntzheight != 0 )
{
ptr->reqheight = reqheight;
if ( NSPV_ntzextract(&ptr->prevntz,prev.txid,prev.txidht,prev.desttxid,prev.ntzheight) < 0 )
return(-1);
}