From 85ef725a7d5700e5b35bf5f46ddf2d8e516c15c4 Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 13 Feb 2018 22:52:45 +0200 Subject: [PATCH] Test --- src/komodo.h | 2 +- src/komodo_bitcoind.h | 11 ++++++----- src/rpcblockchain.cpp | 12 +++++++++--- 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/src/komodo.h b/src/komodo.h index 3b22453a4..129ea3b5f 100644 --- a/src/komodo.h +++ b/src/komodo.h @@ -646,7 +646,7 @@ void komodo_connectblock(CBlockIndex *pindex,CBlock& block) return; } //fprintf(stderr,"%s connect.%d\n",ASSETCHAINS_SYMBOL,pindex->nHeight); - numnotaries = komodo_notaries(pubkeys,pindex->nHeight); + numnotaries = komodo_notaries(pubkeys,pindex->nHeight,pindex->GetBlockTime()); calc_rmd160_sha256(rmd160,pubkeys[0],33); if ( pindex->nHeight > hwmheight ) hwmheight = pindex->nHeight; diff --git a/src/komodo_bitcoind.h b/src/komodo_bitcoind.h index 2a226a714..e73cae4e5 100644 --- a/src/komodo_bitcoind.h +++ b/src/komodo_bitcoind.h @@ -710,27 +710,28 @@ void komodo_connectpindex(CBlockIndex *pindex) komodo_connectblock(pindex,block); } -int32_t komodo_notaries(uint8_t pubkeys[64][33],int32_t height); -int32_t komodo_electednotary(uint8_t *pubkey33,int32_t height); +int32_t komodo_notaries(uint8_t pubkeys[64][33],int32_t height,uint32_t timestamp); +int32_t komodo_electednotary(uint8_t *pubkey33,int32_t height,uint32_t timestamp); int8_t komodo_minerid(int32_t height,uint8_t *pubkey33) { - int32_t num,i; CBlockIndex *pindex; uint8_t _pubkey33[33],pubkeys[64][33]; + int32_t num,i; CBlockIndex *pindex; uint32_t timestamp=0; uint8_t _pubkey33[33],pubkeys[64][33]; if ( pubkey33 == 0 && (pindex= chainActive[height]) != 0 ) { + timestamp = pindex->GetBlockTime(); if ( pubkey33 == 0 ) { pubkey33 = _pubkey33; komodo_index2pubkey33(pubkey33,pindex,height); } - if ( (num= komodo_notaries(pubkeys,height)) > 0 ) + if ( (num= komodo_notaries(pubkeys,height,timestamp)) > 0 ) { for (i=0; inHeight; + else + { + CBlockIndex *pblockindex = chainActive[height]; + if ( pblockindex != 0 ) + timestamp = pblockindex->GetBlockTime(); + } if ( (n= komodo_minerids(minerids,height,(int32_t)(sizeof(minerids)/sizeof(*minerids)))) > 0 ) { memset(tally,0,sizeof(tally)); - numnotaries = komodo_notaries(pubkeys,height); + numnotaries = komodo_notaries(pubkeys,height,timestamp); if ( numnotaries > 0 ) { for (i=0; i