Browse Source

test

pull/4/head
jl777 8 years ago
parent
commit
03ef7187bc
  1. 1
      src/komodo_globals.h
  2. 31
      src/komodo_notary.h
  3. 1
      src/komodo_structs.h

1
src/komodo_globals.h

@ -29,7 +29,6 @@ pthread_mutex_t komodo_mutex;
struct pax_transaction *PAX;
int32_t NUM_PRICES; uint32_t *PVALS;
struct knotaries_entry *Pubkeys;
struct notarized_checkpoint *NPOINTS; int32_t NUM_NPOINTS;
struct komodo_state KOMODO_STATES[34];

31
src/komodo_notary.h

@ -168,8 +168,8 @@ void komodo_notarized_update(struct komodo_state *sp,int32_t nHeight,int32_t not
printf("komodo_notarized_update REJECT notarized_height %d > %d nHeight\n",notarized_height,nHeight);
return;
}
NPOINTS = (struct notarized_checkpoint *)realloc(NPOINTS,(NUM_NPOINTS+1) * sizeof(*NPOINTS));
np = &NPOINTS[NUM_NPOINTS++];
sp->NPOINTS = (struct notarized_checkpoint *)realloc(sp->NPOINTS,(sp->NUM_NPOINTS+1) * sizeof(*sp->NPOINTS));
np = &sp->NPOINTS[NUM_NPOINTS++];
memset(np,0,sizeof(*np));
np->nHeight = nHeight;
sp->NOTARIZED_HEIGHT = np->notarized_height = notarized_height;
@ -197,22 +197,25 @@ int32_t komodo_notarized_height(uint256 *hashp,uint256 *txidp)
int32_t komodo_notarizeddata(int32_t nHeight,uint256 *notarized_hashp,uint256 *notarized_desttxidp)
{
struct notarized_checkpoint *np = 0; int32_t i;
if ( NUM_NPOINTS > 0 )
struct notarized_checkpoint *np = 0; int32_t i; char symbol[16],dest[16]; struct komodo_state *sp;
if ( (sp= komodo_stateptr(symbol,dest)) != 0 )
{
for (i=0; i<NUM_NPOINTS; i++)
if ( sp->NUM_NPOINTS > 0 )
{
for (i=0; i<sp->NUM_NPOINTS; i++)
{
if ( sp->NPOINTS[i].nHeight >= nHeight )
break;
np = &sp->NPOINTS[i];
}
}
if ( np != 0 )
{
if ( NPOINTS[i].nHeight >= nHeight )
break;
np = &NPOINTS[i];
*notarized_hashp = np->notarized_hash;
*notarized_desttxidp = np->notarized_desttxid;
return(np->notarized_height);
}
}
if ( np != 0 )
{
*notarized_hashp = np->notarized_hash;
*notarized_desttxidp = np->notarized_desttxid;
return(np->notarized_height);
}
memset(notarized_hashp,0,sizeof(*notarized_hashp));
return(0);
}

1
src/komodo_structs.h

@ -72,5 +72,6 @@ struct komodo_state
uint256 NOTARIZED_HASH,NOTARIZED_DESTTXID;
int32_t SAVEDHEIGHT,CURRENT_HEIGHT,NOTARIZED_HEIGHT;
uint32_t KOMODO_REALTIME,SAVEDTIMESTAMP;
struct notarized_checkpoint *NPOINTS; int32_t NUM_NPOINTS;
struct komodo_event **Komodo_events; int32_t Komodo_numevents;
};

Loading…
Cancel
Save