From 974173549cb31986ff00d7ef6b5a9be97d0ae19b Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 14 Nov 2016 13:25:05 -0300 Subject: [PATCH] test --- src/komodo_notary.h | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/komodo_notary.h b/src/komodo_notary.h index 02c702a0f..8cbd3bc0d 100644 --- a/src/komodo_notary.h +++ b/src/komodo_notary.h @@ -129,10 +129,13 @@ void komodo_notarysinit(int32_t height,uint8_t pubkeys[64][33],int32_t num) static int32_t hwmheight; int32_t k,i,htind,nonz; struct knotary_entry *kp; struct knotaries_entry N; memset(&N,0,sizeof(N)); - height += KOMODO_ELECTION_GAP/2; - height /= KOMODO_ELECTION_GAP; - height = ((height + 1) * KOMODO_ELECTION_GAP); - htind = (height / KOMODO_ELECTION_GAP); + if ( height > 0 ) + { + height += KOMODO_ELECTION_GAP/2; + height /= KOMODO_ELECTION_GAP; + height = ((height + 1) * KOMODO_ELECTION_GAP); + htind = (height / KOMODO_ELECTION_GAP); + } else htind = 0; pthread_mutex_lock(&komodo_mutex); for (k=0; k