Initial notarisation validation

This commit is contained in:
jl777
2019-07-07 00:37:07 -11:00
parent 2498cdfc88
commit 01fe40136f
2 changed files with 28 additions and 12 deletions

View File

@@ -29,12 +29,12 @@ int32_t NSPV_validatehdrs(struct NSPV_ntzsproofresp *ptr)
return(-2);
else if ( tx.GetHash() != ptr->nexttxid )
return(-3);
else if ( NSPV_notarizationextract(&height,&blockhash,&txid,&txidht,&desttxid,tx) < 0 )
else if ( NSPV_notarizationextract(&height,&blockhash,&txid,&desttxid,tx,ptr->common.nextht) < 0 )
return(-4);
//else if ( height != ptr->common.nextht )
// return(-5);
//else if ( NSPV_doublesha256((uint8_t *)&ptr->common.hdrs[ptr->common.numhdrs-1],sizeof(*ptr->common.hdrs)) != blockhash )
// return(-6);
else if ( height != ptr->common.nextht )
return(-5);
else if ( NSPV_hdrhash(&ptr->common.hdrs[ptr->common.numhdrs-1]) != blockhash )
return(-6);
for (i=ptr->common.numhdrs-1; i>0; i--)
{
blockhash = NSPV_hdrhash(&ptr->common.hdrs[i-1]);
@@ -45,12 +45,12 @@ int32_t NSPV_validatehdrs(struct NSPV_ntzsproofresp *ptr)
return(-6);
else if ( tx.GetHash() != ptr->prevtxid )
return(-7);
else if ( NSPV_notarizationextract(&height,&blockhash,&txid,&txidht,&desttxid,tx) < 0 )
else if ( NSPV_notarizationextract(&height,&blockhash,&txid,&desttxid,tx,ptr->common.prevht) < 0 )
return(-8);
//else if ( height != ptr->common.prevht )
// return(-9);
//else if ( NSPV_doublesha256((uint8_t *)&ptr->common.hdrs[0],sizeof(*ptr->common.hdrs)) != blockhash )
// return(-10);
else if ( height != ptr->common.prevht )
return(-9);
else if ( NSPV_hdrhash(&ptr->common.hdrs[0]) != blockhash )
return(-10);
return(0);
}