From 9b570fb1f25842f4e2bb1260666395d1acb8d8bb Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 9 Dec 2016 16:05:21 +0200 Subject: [PATCH] test --- src/komodo_gateway.h | 2 +- src/komodo_interest.h | 16 ++++++++++++---- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/komodo_gateway.h b/src/komodo_gateway.h index 3902384d2..794ea3727 100644 --- a/src/komodo_gateway.h +++ b/src/komodo_gateway.h @@ -511,7 +511,7 @@ int32_t komodo_check_deposit(int32_t height,const CBlock& block) // verify above { printf("WOULD REJECT %s: ht.%d (%c) matched.%d vs num.%d\n",symbol,height,opcode,matched,num); // can easily happen depending on order of loading - if ( height > 110000 ) //&& opcode == 'X' ) + if ( height > 150000 ) { printf("REJECT: ht.%d (%c) matched.%d vs num.%d\n",height,opcode,matched,num); return(-1); diff --git a/src/komodo_interest.h b/src/komodo_interest.h index bc9df3e3a..36b5e2f09 100644 --- a/src/komodo_interest.h +++ b/src/komodo_interest.h @@ -18,12 +18,20 @@ uint64_t komodo_earned_interest(int32_t height,int64_t paidinterest) { static uint64_t *interests; static int32_t maxheight; - uint64_t total; int32_t ind,incr = 100000; + uint64_t total; int32_t ind,incr = 1000000; if ( height >= maxheight ) { - interests = (uint64_t *)realloc(interests,(maxheight + incr) * sizeof(*interests) * 2); - memset(&interests[maxheight << 1],0,incr * sizeof(*interests) * 2); - maxheight += incr; + if ( interests == 0 ) + { + interests = (uint64_t *)calloc(incr,sizeof(*interests) * 2); // fix before block 1 million + maxheight += incr; + } + else + { + interests = (uint64_t *)realloc(interests,(maxheight + incr) * sizeof(*interests) * 2); + memset(&interests[maxheight << 1],0,incr * sizeof(*interests) * 2); + maxheight += incr; + } } ind = (height << 1); if ( paidinterest < 0 ) // request