diff --git a/src/komodo.h b/src/komodo.h index e4cfa9b32..31db5a866 100644 --- a/src/komodo.h +++ b/src/komodo.h @@ -303,20 +303,6 @@ int32_t komodo_stateupdate(int32_t height,uint8_t notarypubs[][33],uint8_t numno #endif if ( fp == 0 ) { - if ( didinit == 0 ) - { - pthread_mutex_init(&komodo_mutex,NULL); - decode_hex(NOTARY_PUBKEY33,33,(char *)NOTARY_PUBKEY.c_str()); - KOMODO_NUMNOTARIES = (int32_t)(sizeof(Notaries)/sizeof(*Notaries)); - for (k=0; knHeight; @@ -572,6 +573,7 @@ void komodo_connectblock(CBlockIndex *pindex,CBlock& block) void komodo_disconnect(CBlockIndex *pindex,CBlock& block) { + komodo_init(); //uint256 zero; //printf("disconnect ht.%d\n",pindex->nHeight); //memset(&zero,0,sizeof(zero)); @@ -581,6 +583,7 @@ void komodo_disconnect(CBlockIndex *pindex,CBlock& block) int32_t komodo_block2height(CBlock *block) { int32_t i,n,height = 0; uint8_t *ptr = (uint8_t *)block->vtx[0].vin[0].scriptSig.data(); + komodo_init(); if ( block->vtx[0].vin[0].scriptSig.size() > 5 ) { //for (i=0; i<6; i++) @@ -600,12 +603,14 @@ int32_t komodo_block2height(CBlock *block) void komodo_block2pubkey33(uint8_t *pubkey33,CBlock& block) { uint8_t *ptr = (uint8_t *)block.vtx[0].vout[0].scriptPubKey.data(); + komodo_init(); memcpy(pubkey33,ptr+1,33); } void komodo_index2pubkey33(uint8_t *pubkey33,CBlockIndex *pindex,int32_t height) { CBlock block; + komodo_init(); memset(pubkey33,0,33); if ( pindex != 0 ) { @@ -625,6 +630,7 @@ uint32_t komodo_txtime(uint256 hash) { CTransaction tx; uint256 hashBlock; + komodo_init(); if (!GetTransaction(hash, tx, hashBlock, true)) return(0); if (!hashBlock.IsNull()) {