This commit is contained in:
@@ -40,15 +40,23 @@ struct NSPV_ntzsproofresp
|
|||||||
|
|
||||||
int32_t NSPV_validatehdrs(struct NSPV_ntzsproofresp *ptr)
|
int32_t NSPV_validatehdrs(struct NSPV_ntzsproofresp *ptr)
|
||||||
{
|
{
|
||||||
int32_t i;
|
/* int32_t i,height,txidht; CTransaction tx; uint256 blockhash,txid,desttxid;
|
||||||
// verify nextntz is valid notarization
|
if ( NSPV_txextract(tx,ptr->nextntz,ptr->nexttxlen) < 0 )
|
||||||
// validate blockhash of lasthdr with nextntz value, and height
|
return(-1);
|
||||||
|
else if ( NSPV_notarizationextract(&height,&blockhash,&txid,&txidht,&desttxid) < 0 )
|
||||||
|
return(-2);
|
||||||
|
else if ( NSPV_doublesha256(&ptr->common.hdrs[ptr->common.numhdrs-1],sizeof(*ptr->common.hdrs)) != blockhash )
|
||||||
|
return(-3);
|
||||||
for (i=ptr->common.numhdrs-1; i>0; i--)
|
for (i=ptr->common.numhdrs-1; i>0; i--)
|
||||||
{
|
{
|
||||||
// make sure the hash of i-1 matches the prevBlockhash of i
|
// make sure the hash of i-1 matches the prevBlockhash of i
|
||||||
}
|
}
|
||||||
// verify prevntz is valid notarization
|
// verify prevntz is valid notarization
|
||||||
// verify blockhash of first hdr with prevntz value and height
|
// verify blockhash of first hdr with prevntz value and height
|
||||||
|
if ( NSPV_txextract(tx,ptr->prevntz,ptr->prevtxlen) < 0 )
|
||||||
|
return(-1);
|
||||||
|
else if ( NSPV_notarizationextract(&height,&blockhash,&txid,&txidht,&desttxid) < 0 )
|
||||||
|
return(-2);*/
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1068,6 +1068,7 @@ UniValue nspv_spend(const UniValue& params, bool fHelp)
|
|||||||
if ( NSPV_address.size() == 0 )
|
if ( NSPV_address.size() == 0 )
|
||||||
throw runtime_error("to nspv_send you need an active nspv_login\n");
|
throw runtime_error("to nspv_send you need an active nspv_login\n");
|
||||||
satoshis = atof(params[1].get_str().c_str())*COIN + 0.0000000049;
|
satoshis = atof(params[1].get_str().c_str())*COIN + 0.0000000049;
|
||||||
|
fprintf(stderr,"satoshis.%lld from %.8f\n",(long long)satoshis,atof(params[1].get_str().c_str()));
|
||||||
if ( satoshis < 1000 )
|
if ( satoshis < 1000 )
|
||||||
throw runtime_error("amount too small\n");
|
throw runtime_error("amount too small\n");
|
||||||
return(NSPV_spend((char *)NSPV_address.c_str(),(char *)params[0].get_str().c_str(),satoshis));
|
return(NSPV_spend((char *)NSPV_address.c_str(),(char *)params[0].get_str().c_str(),satoshis));
|
||||||
|
|||||||
Reference in New Issue
Block a user