From f846a85733062831e2e3e5110f7c1767ee8f9e3a Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 7 Nov 2016 14:21:35 -0300 Subject: [PATCH] test --- src/komodo_gateway.h | 8 +++++--- src/komodo_globals.h | 2 +- src/miner.cpp | 10 +++++----- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/komodo_gateway.h b/src/komodo_gateway.h index da5af5d88..1ad9e22da 100644 --- a/src/komodo_gateway.h +++ b/src/komodo_gateway.h @@ -43,7 +43,11 @@ uint64_t komodo_paxtotal() while ( PAX != 0 && (pax= (struct pax_transaction *)PAX->hh.next) != 0 && pax != tmp ) { if ( pax->marked == 0 ) - total += pax->fiatoshis; + { + if ( ASSETCHAINS_SYMBOL[0] == 0 ) + total += pax->fiatoshis; + else total += pax->komodoshis; + } tmp = pax; pax = (struct pax_transaction *)pax->hh.next; } @@ -471,8 +475,6 @@ void komodo_gateway_iteration(char *symbol) printf("error from %s\n",symbol); sleep(30); } - if ( (KOMODO_DEPOSIT= komodo_paxtotal()) != 0 ) - printf("KOMODO_DEPOSIT %.8f RT.%u\n",dstr(KOMODO_DEPOSIT),KOMODO_REALTIME); } void komodo_iteration(char *symbol) diff --git a/src/komodo_globals.h b/src/komodo_globals.h index 4cd550141..e0516aa31 100644 --- a/src/komodo_globals.h +++ b/src/komodo_globals.h @@ -31,4 +31,4 @@ uint256 NOTARIZED_HASH,NOTARIZED_DESTTXID; pthread_mutex_t komodo_mutex; uint32_t KOMODO_INITDONE,KOMODO_REALTIME; char KMDUSERPASS[1024]; uint16_t BITCOIND_PORT = 7771; -uint64_t KOMODO_DEPOSIT,PENDING_KOMODO_TX; +uint64_t PENDING_KOMODO_TX; diff --git a/src/miner.cpp b/src/miner.cpp index 1afd34b4b..51d8add99 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -102,29 +102,29 @@ void UpdateTime(CBlockHeader* pblock, const Consensus::Params& consensusParams, int32_t komodo_pax_opreturn(uint8_t *opret,int32_t maxsize); void komodo_gateway_deposits(CMutableTransaction *txNew,int32_t shortflag,char *symbol); extern int32_t KOMODO_INITDONE,ASSETCHAINS_SHORTFLAG; -extern uint64_t KOMODO_DEPOSIT; extern char ASSETCHAINS_SYMBOL[16]; CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn) { - const CChainParams& chainparams = Params(); + uint64_t deposits; const CChainParams& chainparams = Params(); // Create new block unique_ptr pblocktemplate(new CBlockTemplate()); if(!pblocktemplate.get()) return NULL; CBlock *pblock = &pblocktemplate->block; // pointer for convenience - fprintf(stderr,"CreateNewBlock initdone.%d deposit %.8f\n",KOMODO_INITDONE,(double)KOMODO_DEPOSIT/COIN); while ( chainActive.Tip()->nHeight > ASSETCHAINS_MINHEIGHT && mempool.GetTotalTxSize() <= 0 ) { + deposit = komodo_paxtotal(); + fprintf(stderr,"CreateNewBlock initdone.%d deposit %.8f mempool.%d\n",KOMODO_INITDONE,(double)deposits/COIN,(int32_t)mempool.GetTotalTxSize()); sleep(10); if ( KOMODO_INITDONE == 0 || time(NULL) < KOMODO_INITDONE+60 ) continue; - if ( KOMODO_DEPOSIT != 0 ) + if ( deposit != 0 ) { - printf("miner KOMODO_DEPOSIT %llu pblock->nHeight %d mempool.GetTotalTxSize(%d)\n",(long long)KOMODO_DEPOSIT,(int32_t)chainActive.Tip()->nHeight,(int32_t)mempool.GetTotalTxSize()); break; } } + printf("miner KOMODO_DEPOSIT %llu pblock->nHeight %d mempool.GetTotalTxSize(%d)\n",(long long)deposit,(int32_t)chainActive.Tip()->nHeight,(int32_t)mempool.GetTotalTxSize()); // -regtest only: allow overriding block.nVersion with // -blockversion=N to test forking scenarios