From 03ef7187bc613ce41a5873c53f3406927475b38b Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 19 Nov 2016 16:26:49 -0300 Subject: [PATCH] test --- src/komodo_globals.h | 1 - src/komodo_notary.h | 31 +++++++++++++++++-------------- src/komodo_structs.h | 1 + 3 files changed, 18 insertions(+), 15 deletions(-) diff --git a/src/komodo_globals.h b/src/komodo_globals.h index cdd4cb5f3..72ecc3eba 100644 --- a/src/komodo_globals.h +++ b/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]; diff --git a/src/komodo_notary.h b/src/komodo_notary.h index 0df2b8502..d44eb5177 100644 --- a/src/komodo_notary.h +++ b/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,21 +197,24 @@ 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; iNUM_NPOINTS > 0 ) { - if ( NPOINTS[i].nHeight >= nHeight ) - break; - np = &NPOINTS[i]; + for (i=0; iNUM_NPOINTS; i++) + { + if ( sp->NPOINTS[i].nHeight >= nHeight ) + break; + np = &sp->NPOINTS[i]; + } + } + if ( np != 0 ) + { + *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); diff --git a/src/komodo_structs.h b/src/komodo_structs.h index eed4103bd..89ebcab33 100644 --- a/src/komodo_structs.h +++ b/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; };