Browse Source

test

pull/4/head
jl777 7 years ago
parent
commit
48d0e5df77
  1. 2
      src/komodo.h
  2. 9
      src/komodo_bitcoind.h
  3. 1
      src/komodo_utils.h

2
src/komodo.h

@ -409,7 +409,7 @@ int32_t komodo_voutupdate(int32_t *isratificationp,int32_t notaryid,uint8_t *scr
komodo_stateupdate(height,0,0,0,txhash,0,0,0,0,0,0,value,&scriptbuf[len],opretlen-len+4+3+(scriptbuf[1] == 0x4d),j);
}
}
} else printf("notarized.%d %llx reject ht.%d NOTARIZED.%d %s.%s DESTTXID.%s (%s)\n",notarized,(long long)signedmask,height,*notarizedheightp,ASSETCHAINS_SYMBOL[0]==0?"KMD":ASSETCHAINS_SYMBOL,kmdtxid.ToString().c_str(),desttxid.ToString().c_str(),(char *)&scriptbuf[len]);
} else printf("notarized.%d %llx reject ht.%d NOTARIZED.%d prev.%d %s.%s DESTTXID.%s (%s)\n",notarized,(long long)signedmask,height,*notarizedheightp,sp->NOTARIZED_HEIGHT,ASSETCHAINS_SYMBOL[0]==0?"KMD":ASSETCHAINS_SYMBOL,kmdtxid.ToString().c_str(),desttxid.ToString().c_str(),(char *)&scriptbuf[len]);
}
else if ( i == 0 && j == 1 && opretlen == 149 )
{

9
src/komodo_bitcoind.h

@ -367,30 +367,39 @@ int32_t komodo_verifynotarization(char *symbol,char *dest,int32_t height,int32_t
{
char params[256],*jsonstr,*hexstr; uint8_t script[8192]; int32_t n,len,retval = -1; cJSON *txjson,*vouts,*vout,*skey;
sprintf(params,"[\"%s\", 1]",NOTARIZED_DESTTXID.ToString().c_str());
printf("src.%s dest.%s params.[%s] ht.%d notarized.%d\n",src,dest,params,height,NOTARIZED_HEIGHT);
if ( strcmp(dest,"KMD") == 0 )
{
if ( KMDUSERPASS[0] != 0 )
jsonstr = komodo_issuemethod(KMDUSERPASS,(char *)"getrawtransaction",params,7771);
//else jsonstr = _dex_getrawtransaction();
else return(0); // need universal way to issue DEX* API, since notaries mine most blocks, this ok
}
else if ( strcmp(dest,"BTC") == 0 )
{
if ( BTCUSERPASS[0] != 0 )
{
printf("BTCUSERPASS.(%s)\n",BTCUSERPASS);
jsonstr = komodo_issuemethod(BTCUSERPASS,(char *)"getrawtransaction",params,8332);
}
//else jsonstr = _dex_getrawtransaction();
else return(0);
}
else return(-1);
if ( jsonstr != 0 )
{
printf("GOT.(%s)\n",jsonstr);
if ( (txjson= cJSON_Parse(jsonstr)) != 0 )
{
if ( (vouts= jarray(&n,txjson,(char *)"vout")) > 0 )
{
vout = jitem(vouts,n-1);
printf("vout.(%s)\n",jprint(vout,0));
if ( (skey= jobj(vout,(char *)"scriptPubKey")) != 0 )
{
if ( (hexstr= jstr(skey,(char *)"hex")) != 0 )
{
printf("HEX.(%s)\n",hexstr);
len = strlen(hexstr) >> 1;
decode_hex(script,len,hexstr);
retval = komodo_verifynotarizedscript(script,len,NOTARIZED_HASH);

1
src/komodo_utils.h

@ -1534,6 +1534,7 @@ void komodo_args()
//printf("KOMODO.(%s) -> userpass.(%s)\n",fname,KMDUSERPASS);
} else printf("couldnt open.(%s)\n",fname);
}
printf("BTCUSERPASS.(%s)\n",BTCUSERPASS);
}
//fprintf(stderr,"%s chain params initialized\n",ASSETCHAINS_SYMBOL);
}

Loading…
Cancel
Save