This commit is contained in:
jl777
2019-07-10 01:38:55 -11:00
parent 958f2c198e
commit 46b8950f04
3 changed files with 11 additions and 8 deletions

View File

@@ -279,12 +279,12 @@ void NSPV_txproof_copy(struct NSPV_txproof *dest,struct NSPV_txproof *ptr)
*dest = *ptr;
if ( ptr->tx != 0 )
{
dest->tx = malloc(ptr->txlen);
dest->tx = (uint8_t *)malloc(ptr->txlen);
memcpy(dest->tx,ptr->tx,ptr->txlen);
}
if ( ptr->txproof != 0 )
{
dest->txproof = malloc(ptr->txprooflen);
dest->txproof = (uint8_t *)malloc(ptr->txprooflen);
memcpy(dest->txproof,ptr->txproof,ptr->txprooflen);
}
}
@@ -348,17 +348,17 @@ void NSPV_ntzsproof_copy(struct NSPV_ntzsproofresp *dest,struct NSPV_ntzsproofre
*dest = *ptr;
if ( ptr->common.hdrs != 0 )
{
dest->common.hdrs = malloc(ptr->common.numhdrs * sizeof(*ptr->common.hdrs));
dest->common.hdrs = (struct NSPV_equihdr *)malloc(ptr->common.numhdrs * sizeof(*ptr->common.hdrs));
memcpy(dest->common.hdrs,ptr->common.hdrs,ptr->common.numhdrs * sizeof(*ptr->common.hdrs));
}
if ( ptr->prevntz != 0 )
{
dest->prevntz = malloc(ptr->prevtxlen);
dest->prevntz = (uint8_t *)malloc(ptr->prevtxlen);
memcpy(dest->prevntz,ptr->prevntz,ptr->prevtxlen);
}
if ( ptr->nextntz != 0 )
{
dest->nextntz = malloc(ptr->nexttxlen);
dest->nextntz = (uint8_t *)malloc(ptr->nexttxlen);
memcpy(dest->nextntz,ptr->nextntz,ptr->nexttxlen);
}
}

View File

@@ -80,9 +80,9 @@ int32_t NSPV_ntzextract(struct NSPV_ntz *ptr,uint256 ntztxid,int32_t txidht,uint
int32_t NSPV_getntzsresp(struct NSPV_ntzsresp *ptr,int32_t reqheight)
{
struct NSPV_ntzargs prev,next;
if ( height < chainActive.LastTip()->GetHeight() )
height++;
if ( NSPV_notarized_bracket(&prev,&next,height) == 0 )
if ( reqheight < chainActive.LastTip()->GetHeight() )
reqheight++;
if ( NSPV_notarized_bracket(&prev,&next,reqheight) == 0 )
{
if ( prev.ntzheight != 0 )
{

View File

@@ -43,6 +43,7 @@ struct NSPV_txproof NSPV_txproof_cache[NSPV_MAXVINS * 4];
struct NSPV_ntzsresp *NSPV_ntzsresp_find(int32_t reqheight)
{
int32_t i;
for (i=0; i<sizeof(NSPV_ntzsresp_cache)/sizeof(*NSPV_ntzsresp_cache); i++)
if ( NSPV_ntzsresp_cache[i].reqheight == reqheight )
return(&NSPV_ntzsresp_cache[i]);
@@ -64,6 +65,7 @@ struct NSPV_txproof *NSPV_ntzsresp_add(struct NSPV_ntzsresp *ptr)
struct NSPV_txproof *NSPV_txproof_find(uint256 txid)
{
int32_t i;
for (i=0; i<sizeof(NSPV_txproof_cache)/sizeof(*NSPV_txproof_cache); i++)
if ( NSPV_txproof_cache[i].txid == txid )
return(&NSPV_txproof_cache[i]);
@@ -85,6 +87,7 @@ struct NSPV_txproof *NSPV_txproof_add(struct NSPV_txproof *ptr)
struct NSPV_ntzsproofresp *NSPV_ntzsproof_find(uint256 prevtxid,uint256 nexttxid)
{
int32_t i;
for (i=0; i<sizeof(NSPV_ntzsproofresp_cache)/sizeof(*NSPV_ntzsproofresp_cache); i++)
if ( NSPV_ntzsproofresp_cache[i].prevtxid == prevtxid && NSPV_ntzsproofresp_cache[i].nexttxid == nexttxid )
return(&NSPV_ntzsproofresp_cache[i]);