test
This commit is contained in:
@@ -99,8 +99,6 @@ int32_t komodo_parsestatefile(struct komodo_state *sp,FILE *fp,char *symbol,char
|
|||||||
if ( 0 && sp != 0 )
|
if ( 0 && sp != 0 )
|
||||||
printf("%s load[%s.%d] NOTARIZED %d %s\n",ASSETCHAINS_SYMBOL,symbol,sp->NUM_NPOINTS,notarized_height,notarized_hash.ToString().c_str());
|
printf("%s load[%s.%d] NOTARIZED %d %s\n",ASSETCHAINS_SYMBOL,symbol,sp->NUM_NPOINTS,notarized_height,notarized_hash.ToString().c_str());
|
||||||
//if ( matched != 0 ) global independent states -> inside *sp
|
//if ( matched != 0 ) global independent states -> inside *sp
|
||||||
if ( komodo_verifynotarization(symbol,dest,ht,notarized_height,notarized_hash,notarized_desttxid) != 0 )
|
|
||||||
printf("error validating notarization\n");
|
|
||||||
komodo_eventadd_notarized(sp,symbol,ht,dest,notarized_hash,notarized_desttxid,notarized_height);
|
komodo_eventadd_notarized(sp,symbol,ht,dest,notarized_hash,notarized_desttxid,notarized_height);
|
||||||
}
|
}
|
||||||
else if ( func == 'U' ) // deprecated
|
else if ( func == 'U' ) // deprecated
|
||||||
|
|||||||
@@ -365,7 +365,7 @@ int32_t komodo_verifynotarizedscript(uint8_t *script,int32_t len,uint256 NOTARIZ
|
|||||||
|
|
||||||
int32_t komodo_verifynotarization(char *symbol,char *dest,int32_t height,int32_t NOTARIZED_HEIGHT,uint256 NOTARIZED_HASH,uint256 NOTARIZED_DESTTXID)
|
int32_t komodo_verifynotarization(char *symbol,char *dest,int32_t height,int32_t NOTARIZED_HEIGHT,uint256 NOTARIZED_HASH,uint256 NOTARIZED_DESTTXID)
|
||||||
{
|
{
|
||||||
char params[256],*jsonstr,*hexstr; uint8_t script[8192]; int32_t i,n,len,retval = -1; cJSON *txjson,*vouts,*vout,*skey;
|
char params[256],*jsonstr,*hexstr; uint8_t script[8192]; int32_t i,n,len,retval = -1; cJSON *json,*txjson,*vouts,*vout,*skey;
|
||||||
params[0] = '[';
|
params[0] = '[';
|
||||||
params[1] = '"';
|
params[1] = '"';
|
||||||
for (i=0; i<32; i++)
|
for (i=0; i<32; i++)
|
||||||
@@ -393,10 +393,9 @@ int32_t komodo_verifynotarization(char *symbol,char *dest,int32_t height,int32_t
|
|||||||
else return(-1);
|
else return(-1);
|
||||||
if ( jsonstr != 0 )
|
if ( jsonstr != 0 )
|
||||||
{
|
{
|
||||||
printf("GOT.(%s)\n",jsonstr);
|
if ( (json= cJSON_Parse(jsonstr)) != 0 )
|
||||||
if ( (txjson= cJSON_Parse(jsonstr)) != 0 )
|
|
||||||
{
|
{
|
||||||
if ( (vouts= jarray(&n,txjson,(char *)"vout")) > 0 )
|
if ( (txjson= jobj(json,"result")) != 0 && (vouts= jarray(&n,txjson,(char *)"vout")) > 0 )
|
||||||
{
|
{
|
||||||
vout = jitem(vouts,n-1);
|
vout = jitem(vouts,n-1);
|
||||||
printf("vout.(%s)\n",jprint(vout,0));
|
printf("vout.(%s)\n",jprint(vout,0));
|
||||||
|
|||||||
@@ -39,14 +39,19 @@ struct komodo_event *komodo_eventadd(struct komodo_state *sp,int32_t height,char
|
|||||||
void komodo_eventadd_notarized(struct komodo_state *sp,char *symbol,int32_t height,char *dest,uint256 notarized_hash,uint256 notarized_desttxid,int32_t notarizedheight)
|
void komodo_eventadd_notarized(struct komodo_state *sp,char *symbol,int32_t height,char *dest,uint256 notarized_hash,uint256 notarized_desttxid,int32_t notarizedheight)
|
||||||
{
|
{
|
||||||
struct komodo_event_notarized N;
|
struct komodo_event_notarized N;
|
||||||
memset(&N,0,sizeof(N));
|
if ( komodo_verifynotarization(symbol,dest,ht,notarized_height,notarized_hash,notarized_desttxid) != 0 )
|
||||||
N.blockhash = notarized_hash;
|
printf("error validating notarization\n");
|
||||||
N.desttxid = notarized_desttxid;
|
else
|
||||||
N.notarizedheight = notarizedheight;
|
{
|
||||||
strcpy(N.dest,dest);
|
memset(&N,0,sizeof(N));
|
||||||
komodo_eventadd(sp,height,symbol,KOMODO_EVENT_NOTARIZED,(uint8_t *)&N,sizeof(N));
|
N.blockhash = notarized_hash;
|
||||||
if ( sp != 0 )
|
N.desttxid = notarized_desttxid;
|
||||||
komodo_notarized_update(sp,height,notarizedheight,notarized_hash,notarized_desttxid);
|
N.notarizedheight = notarizedheight;
|
||||||
|
strcpy(N.dest,dest);
|
||||||
|
komodo_eventadd(sp,height,symbol,KOMODO_EVENT_NOTARIZED,(uint8_t *)&N,sizeof(N));
|
||||||
|
if ( sp != 0 )
|
||||||
|
komodo_notarized_update(sp,height,notarizedheight,notarized_hash,notarized_desttxid);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void komodo_eventadd_pubkeys(struct komodo_state *sp,char *symbol,int32_t height,uint8_t num,uint8_t pubkeys[64][33])
|
void komodo_eventadd_pubkeys(struct komodo_state *sp,char *symbol,int32_t height,uint8_t num,uint8_t pubkeys[64][33])
|
||||||
|
|||||||
Reference in New Issue
Block a user