(uint8_t *)
This commit is contained in:
@@ -376,7 +376,7 @@ void NSPV_broadcast_purge(struct NSPV_broadcastresp *ptr)
|
|||||||
|
|
||||||
// useful utility functions
|
// useful utility functions
|
||||||
|
|
||||||
uint256 NSPV_doublesha256(void *data,int32_t datalen)
|
uint256 NSPV_doublesha256(uint8_t *data,int32_t datalen)
|
||||||
{
|
{
|
||||||
bits256 _hash; uint256 hash; int32_t i;
|
bits256 _hash; uint256 hash; int32_t i;
|
||||||
_hash = bits256_doublesha256(0,data,datalen);
|
_hash = bits256_doublesha256(0,data,datalen);
|
||||||
|
|||||||
@@ -33,11 +33,11 @@ int32_t NSPV_validatehdrs(struct NSPV_ntzsproofresp *ptr)
|
|||||||
return(-4);
|
return(-4);
|
||||||
else if ( height != ptr->common.nextht )
|
else if ( height != ptr->common.nextht )
|
||||||
return(-5);
|
return(-5);
|
||||||
else if ( NSPV_doublesha256(&ptr->common.hdrs[ptr->common.numhdrs-1],sizeof(*ptr->common.hdrs)) != blockhash )
|
else if ( NSPV_doublesha256((uint8_t *)&ptr->common.hdrs[ptr->common.numhdrs-1],sizeof(*ptr->common.hdrs)) != blockhash )
|
||||||
return(-6);
|
return(-6);
|
||||||
for (i=ptr->common.numhdrs-1; i>0; i--)
|
for (i=ptr->common.numhdrs-1; i>0; i--)
|
||||||
{
|
{
|
||||||
if ( NSPV_doublesha256(&ptr->common.hdrs[i-1],sizeof(*ptr->common.hdrs)) != ptr->common.hdrs.prevblockhash )
|
if ( NSPV_doublesha256((uint8_t *)&ptr->common.hdrs[i-1],sizeof(*ptr->common.hdrs)) != ptr->common.hdrs.prevblockhash )
|
||||||
return(-i-11);
|
return(-i-11);
|
||||||
}
|
}
|
||||||
if ( NSPV_txextract(tx,ptr->prevntz,ptr->prevtxlen) < 0 )
|
if ( NSPV_txextract(tx,ptr->prevntz,ptr->prevtxlen) < 0 )
|
||||||
@@ -48,7 +48,7 @@ int32_t NSPV_validatehdrs(struct NSPV_ntzsproofresp *ptr)
|
|||||||
return(-8);
|
return(-8);
|
||||||
else if ( height != ptr->common.prevht )
|
else if ( height != ptr->common.prevht )
|
||||||
return(-9);
|
return(-9);
|
||||||
else if ( NSPV_doublesha256(&ptr->common.hdrs[0],sizeof(*ptr->common.hdrs)) != blockhash )
|
else if ( NSPV_doublesha256((uint8_t *)&ptr->common.hdrs[0],sizeof(*ptr->common.hdrs)) != blockhash )
|
||||||
return(-10);
|
return(-10);
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user