Test
This commit is contained in:
@@ -549,8 +549,8 @@ void komodo_connectblock(CBlockIndex *pindex,CBlock& block)
|
|||||||
(numvalid >= KOMODO_MINRATIFY && ASSETCHAINS_SYMBOL[0] != 0) ||
|
(numvalid >= KOMODO_MINRATIFY && ASSETCHAINS_SYMBOL[0] != 0) ||
|
||||||
numvalid > (numnotaries/5)) )
|
numvalid > (numnotaries/5)) )
|
||||||
{
|
{
|
||||||
if ( height > 500000 )
|
if ( height > 500000 || ASSETCHAINS_SYMBOL[0] != 0 )
|
||||||
printf("%s ht.%d txi.%d signedmask.%llx numvins.%d numvouts.%d <<<<<<<<<<< notarized\n",ASSETCHAINS_SYMBOL,height,i,(long long)signedmask,numvins,numvouts);
|
printf("[%s] ht.%d txi.%d signedmask.%llx numvins.%d numvouts.%d <<<<<<<<<<< notarized\n",ASSETCHAINS_SYMBOL,height,i,(long long)signedmask,numvins,numvouts);
|
||||||
notarized = 1;
|
notarized = 1;
|
||||||
}
|
}
|
||||||
if ( NOTARY_PUBKEY33[0] != 0 && ASSETCHAINS_SYMBOL[0] == 0 )
|
if ( NOTARY_PUBKEY33[0] != 0 && ASSETCHAINS_SYMBOL[0] == 0 )
|
||||||
|
|||||||
@@ -427,15 +427,18 @@ int32_t komodo_verifynotarization(char *symbol,char *dest,int32_t height,int32_t
|
|||||||
sprintf(params,"[\"%s\", 1]",NOTARIZED_DESTTXID.ToString().c_str());
|
sprintf(params,"[\"%s\", 1]",NOTARIZED_DESTTXID.ToString().c_str());
|
||||||
if ( strcmp(symbol,ASSETCHAINS_SYMBOL[0]==0?(char *)"KMD":ASSETCHAINS_SYMBOL) != 0 )
|
if ( strcmp(symbol,ASSETCHAINS_SYMBOL[0]==0?(char *)"KMD":ASSETCHAINS_SYMBOL) != 0 )
|
||||||
return(0);
|
return(0);
|
||||||
//printf("[%s] src.%s dest.%s params.[%s] ht.%d notarized.%d\n",ASSETCHAINS_SYMBOL,symbol,dest,params,height,NOTARIZED_HEIGHT);
|
if ( ASSETCHAINS_SYMBOL[0] != 0 )
|
||||||
|
printf("[%s] src.%s dest.%s params.[%s] ht.%d notarized.%d\n",ASSETCHAINS_SYMBOL,symbol,dest,params,height,NOTARIZED_HEIGHT);
|
||||||
if ( strcmp(dest,"KMD") == 0 )
|
if ( strcmp(dest,"KMD") == 0 )
|
||||||
{
|
{
|
||||||
if ( KMDUSERPASS[0] != 0 )
|
if ( KMDUSERPASS[0] != 0 )
|
||||||
{
|
{
|
||||||
if ( ASSETCHAINS_SYMBOL[0] != 0 )
|
if ( ASSETCHAINS_SYMBOL[0] != 0 )
|
||||||
|
{
|
||||||
jsonstr = komodo_issuemethod(KMDUSERPASS,(char *)"getrawtransaction",params,7771);
|
jsonstr = komodo_issuemethod(KMDUSERPASS,(char *)"getrawtransaction",params,7771);
|
||||||
}
|
printf("got (%s)\n",jsonstr);
|
||||||
//else jsonstr = _dex_getrawtransaction();
|
}
|
||||||
|
}//else jsonstr = _dex_getrawtransaction();
|
||||||
else return(0); // need universal way to issue DEX* API, since notaries mine most blocks, this ok
|
else return(0); // need universal way to issue DEX* API, since notaries mine most blocks, this ok
|
||||||
}
|
}
|
||||||
else if ( strcmp(dest,"BTC") == 0 )
|
else if ( strcmp(dest,"BTC") == 0 )
|
||||||
@@ -460,7 +463,8 @@ int32_t komodo_verifynotarization(char *symbol,char *dest,int32_t height,int32_t
|
|||||||
if ( (txjson= jobj(json,(char *)"result")) != 0 && (vouts= jarray(&n,txjson,(char *)"vout")) > 0 )
|
if ( (txjson= jobj(json,(char *)"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));
|
if ( ASSETCHAINS_SYMBOL[0] != 0 )
|
||||||
|
printf("vout.(%s)\n",jprint(vout,0));
|
||||||
if ( (skey= jobj(vout,(char *)"scriptPubKey")) != 0 )
|
if ( (skey= jobj(vout,(char *)"scriptPubKey")) != 0 )
|
||||||
{
|
{
|
||||||
if ( (hexstr= jstr(skey,(char *)"hex")) != 0 )
|
if ( (hexstr= jstr(skey,(char *)"hex")) != 0 )
|
||||||
|
|||||||
@@ -320,26 +320,48 @@ int32_t komodo_notarized_height(uint256 *hashp,uint256 *txidp)
|
|||||||
|
|
||||||
int32_t komodo_notarizeddata(int32_t nHeight,uint256 *notarized_hashp,uint256 *notarized_desttxidp)
|
int32_t komodo_notarizeddata(int32_t nHeight,uint256 *notarized_hashp,uint256 *notarized_desttxidp)
|
||||||
{
|
{
|
||||||
struct notarized_checkpoint *np = 0; int32_t i; char symbol[16],dest[16]; struct komodo_state *sp;
|
struct notarized_checkpoint *np = 0; int32_t i,flag = 0; char symbol[16],dest[16]; struct komodo_state *sp;
|
||||||
if ( (sp= komodo_stateptr(symbol,dest)) != 0 )
|
if ( (sp= komodo_stateptr(symbol,dest)) != 0 )
|
||||||
{
|
{
|
||||||
if ( sp->NUM_NPOINTS > 0 )
|
if ( sp->NUM_NPOINTS > 0 )
|
||||||
{
|
{
|
||||||
for (i=0; i<sp->NUM_NPOINTS; i++)
|
flag = 0;
|
||||||
|
if ( sp->last_NPOINTSi < sp->NUM_POINTS && sp->last_NPOINTSi > 0 )
|
||||||
{
|
{
|
||||||
if ( sp->NPOINTS[i].nHeight >= nHeight )
|
np = &sp->NPOINTS[sp->last_NPOINTSi-1];
|
||||||
break;
|
for (i=sp->last_NPOINTSi; i<sp->NUM_NPOINTS; i++)
|
||||||
np = &sp->NPOINTS[i];
|
{
|
||||||
|
if ( sp->NPOINTS[i].nHeight >= nHeight )
|
||||||
|
{
|
||||||
|
flag = 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
np = &sp->NPOINTS[i];
|
||||||
|
sp->last_NPOINTSi = i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ( flag == 0 )
|
||||||
|
{
|
||||||
|
np = 0;
|
||||||
|
for (i=0; i<sp->NUM_NPOINTS; i++)
|
||||||
|
{
|
||||||
|
if ( sp->NPOINTS[i].nHeight >= nHeight )
|
||||||
|
break;
|
||||||
|
np = &sp->NPOINTS[i];
|
||||||
|
sp->last_NPOINTSi = i;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( np != 0 )
|
if ( np != 0 )
|
||||||
{
|
{
|
||||||
|
char str[65],str2[65]; printf("[%s] notarized_ht.%d %s -> %s\n",ASSETCHAINS_SYMBOL,np->notarized_height,bits256_str(str,np->notarized_hash),bits256_str(str2,np->notarized_desttxid));
|
||||||
*notarized_hashp = np->notarized_hash;
|
*notarized_hashp = np->notarized_hash;
|
||||||
*notarized_desttxidp = np->notarized_desttxid;
|
*notarized_desttxidp = np->notarized_desttxid;
|
||||||
return(np->notarized_height);
|
return(np->notarized_height);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
memset(notarized_hashp,0,sizeof(*notarized_hashp));
|
memset(notarized_hashp,0,sizeof(*notarized_hashp));
|
||||||
|
memset(notarized_desttxidp,0,sizeof(*notarized_desttxidp));
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ struct komodo_state
|
|||||||
int32_t SAVEDHEIGHT,CURRENT_HEIGHT,NOTARIZED_HEIGHT;
|
int32_t SAVEDHEIGHT,CURRENT_HEIGHT,NOTARIZED_HEIGHT;
|
||||||
uint32_t SAVEDTIMESTAMP;
|
uint32_t SAVEDTIMESTAMP;
|
||||||
uint64_t deposited,issued,withdrawn,approved,redeemed,shorted;
|
uint64_t deposited,issued,withdrawn,approved,redeemed,shorted;
|
||||||
struct notarized_checkpoint *NPOINTS; int32_t NUM_NPOINTS;
|
struct notarized_checkpoint *NPOINTS; int32_t NUM_NPOINTS,last_NPOINTSi;
|
||||||
struct komodo_event **Komodo_events; int32_t Komodo_numevents;
|
struct komodo_event **Komodo_events; int32_t Komodo_numevents;
|
||||||
uint32_t RTbufs[64][3]; uint64_t RTmask;
|
uint32_t RTbufs[64][3]; uint64_t RTmask;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user