Browse Source

Test

pull/4/head
jl777 6 years ago
parent
commit
88d4a95ae7
  1. 4
      src/komodo_gateway.h
  2. 2
      src/komodo_kv.h
  3. 55
      src/komodo_notary.h

4
src/komodo_gateway.h

@ -711,6 +711,10 @@ int32_t komodo_check_deposit(int32_t height,const CBlock& block) // verify above
if ( height >= activation )
return(-1);
}
else if ( block.nBits == KOMODO_MINDIFF_NBITS && total > 0 )
{
fprintf(stderr,"notary mined ht.%d with extra %.8f\n",height,dstr(total));
}
}
else
{

2
src/komodo_kv.h

@ -171,7 +171,7 @@ void komodo_kvupdate(uint8_t *opretbuf,int32_t opretlen,uint64_t value)
memcpy(ptr->key,key,keylen);
newflag = 1;
HASH_ADD_KEYPTR(hh,KOMODO_KV,ptr->key,ptr->keylen,ptr);
//printf("KV add.(%s) (%s)\n",ptr->key,valueptr);
printf("KV add.(%s) (%s)\n",ptr->key,valueptr);
}
if ( newflag != 0 || (ptr->flags & KOMODO_KVPROTECTED) == 0 )
{

55
src/komodo_notary.h

@ -131,8 +131,8 @@ const char *Notaries_elected0[][2] =
const char *Notaries_elected1[][2] =
{
{ "0_jl777_testB", "02ebfc784a4ba768aad88d44d1045d240d47b26e248cafaf1c5169a42d7a61d344" },
{ "0_jl777_testA", "03b7621b44118017a16043f19b30cc8a4cfe068ac4e42417bae16ba460c80f3828" },
{ "0_jl777_testB", "02ebfc784a4ba768aad88d44d1045d240d47b26e248cafaf1c5169a42d7a61d344" },
{ "0_kolo_testA", "0287aa4b73988ba26cf6565d815786caf0d2c4af704d7883d163ee89cd9977edec" },
{ "artik_AR", "029acf1dcd9f5ff9c455f8bb717d4ae0c703e089d16cf8424619c491dff5994c90" },
{ "artik_EU", "03f54b2c24f82632e3cdebe4568ba0acf487a80f8a89779173cdb78f74514847ce" },
@ -378,29 +378,6 @@ int32_t komodo_chosennotary(int32_t *notaryidp,int32_t height,uint8_t *pubkey33,
return(modval);
}
void komodo_notarized_update(struct komodo_state *sp,int32_t nHeight,int32_t notarized_height,uint256 notarized_hash,uint256 notarized_desttxid,uint256 MoM,int32_t MoMdepth)
{
struct notarized_checkpoint *np;
if ( notarized_height >= nHeight )
{
printf("komodo_notarized_update REJECT notarized_height %d > %d nHeight\n",notarized_height,nHeight);
return;
}
if ( 0 && ASSETCHAINS_SYMBOL[0] != 0 )
printf("[%s] komodo_notarized_update nHeight.%d notarized_height.%d\n",ASSETCHAINS_SYMBOL,nHeight,notarized_height);
portable_mutex_lock(&komodo_mutex);
sp->NPOINTS = (struct notarized_checkpoint *)realloc(sp->NPOINTS,(sp->NUM_NPOINTS+1) * sizeof(*sp->NPOINTS));
np = &sp->NPOINTS[sp->NUM_NPOINTS++];
memset(np,0,sizeof(*np));
np->nHeight = nHeight;
sp->NOTARIZED_HEIGHT = np->notarized_height = notarized_height;
sp->NOTARIZED_HASH = np->notarized_hash = notarized_hash;
sp->NOTARIZED_DESTTXID = np->notarized_desttxid = notarized_desttxid;
sp->MoM = np->MoM = MoM;
sp->MoMdepth = np->MoMdepth = MoMdepth;
portable_mutex_unlock(&komodo_mutex);
}
//struct komodo_state *komodo_stateptr(char *symbol,char *dest);
int32_t komodo_notarized_height(uint256 *hashp,uint256 *txidp)
{
@ -499,6 +476,36 @@ int32_t komodo_notarizeddata(int32_t nHeight,uint256 *notarized_hashp,uint256 *n
return(0);
}
void komodo_notarized_update(struct komodo_state *sp,int32_t nHeight,int32_t notarized_height,uint256 notarized_hash,uint256 notarized_desttxid,uint256 MoM,int32_t MoMdepth)
{
struct notarized_checkpoint *np; uint256 hash,desttxid; int32_t ht;
if ( notarized_height >= nHeight )
{
fprintf(stderr,"komodo_notarized_update REJECT notarized_height %d > %d nHeight\n",notarized_height,nHeight);
return;
}
if ( (ht= komodo_notarizeddata(notarized_height,&hash,&desttxid)) > 0 )
{
fprintf(stderr,"komodo_notarized_update %d already there ht.%d hash %s vs %s\n",notarized_height,ht,hash.ToString().cstr(),desttxid.ToString().cstr());
}
else
{
if ( 0 && ASSETCHAINS_SYMBOL[0] != 0 )
fprintf(stderr,"[%s] komodo_notarized_update nHeight.%d notarized_height.%d\n",ASSETCHAINS_SYMBOL,nHeight,notarized_height);
portable_mutex_lock(&komodo_mutex);
sp->NPOINTS = (struct notarized_checkpoint *)realloc(sp->NPOINTS,(sp->NUM_NPOINTS+1) * sizeof(*sp->NPOINTS));
np = &sp->NPOINTS[sp->NUM_NPOINTS++];
memset(np,0,sizeof(*np));
np->nHeight = nHeight;
sp->NOTARIZED_HEIGHT = np->notarized_height = notarized_height;
sp->NOTARIZED_HASH = np->notarized_hash = notarized_hash;
sp->NOTARIZED_DESTTXID = np->notarized_desttxid = notarized_desttxid;
sp->MoM = np->MoM = MoM;
sp->MoMdepth = np->MoMdepth = MoMdepth;
portable_mutex_unlock(&komodo_mutex);
}
}
void komodo_init(int32_t height)
{
static int didinit; uint256 zero; int32_t k,n; uint8_t pubkeys[64][33];

Loading…
Cancel
Save