Browse Source

Merge branch 'dev' into jl777

pull/4/head
jl777 6 years ago
committed by GitHub
parent
commit
7213e636c1
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      src/komodo.h
  2. 46
      src/miner.cpp
  3. 3
      src/pow.cpp

6
src/komodo.h

@ -679,7 +679,7 @@ int32_t komodo_voutupdate(int32_t *isratificationp,int32_t notaryid,uint8_t *scr
} }
else else
{ {
komodo_rwccdata(ASSETCHAINS_SYMBOL,1,&ccdata,&MoMoMdata); //komodo_rwccdata(ASSETCHAINS_SYMBOL,1,&ccdata,&MoMoMdata);
//printf("[%s] matched.%d VALID (%s) MoM.%s [%d]\n",ASSETCHAINS_SYMBOL,matched,ccdata.symbol,MoM.ToString().c_str(),MoMdepth); //printf("[%s] matched.%d VALID (%s) MoM.%s [%d]\n",ASSETCHAINS_SYMBOL,matched,ccdata.symbol,MoM.ToString().c_str(),MoMdepth);
} }
if ( MoMoMdata.pairs != 0 ) if ( MoMoMdata.pairs != 0 )
@ -687,8 +687,8 @@ int32_t komodo_voutupdate(int32_t *isratificationp,int32_t notaryid,uint8_t *scr
memset(&ccdata,0,sizeof(ccdata)); memset(&ccdata,0,sizeof(ccdata));
memset(&MoMoMdata,0,sizeof(MoMoMdata)); memset(&MoMoMdata,0,sizeof(MoMoMdata));
} }
else if ( ASSETCHAINS_SYMBOL[0] == 0 && matched != 0 && notarized != 0 && validated != 0 ) //else if ( ASSETCHAINS_SYMBOL[0] == 0 && matched != 0 && notarized != 0 && validated != 0 )
komodo_rwccdata((char *)"KMD",1,&ccdata,0); // komodo_rwccdata((char *)"KMD",1,&ccdata,0);
if ( matched != 0 && *notarizedheightp > sp->NOTARIZED_HEIGHT && *notarizedheightp < height ) if ( matched != 0 && *notarizedheightp > sp->NOTARIZED_HEIGHT && *notarizedheightp < height )
{ {
sp->NOTARIZED_HEIGHT = *notarizedheightp; sp->NOTARIZED_HEIGHT = *notarizedheightp;

46
src/miner.cpp

@ -508,47 +508,47 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn)
} }
/* /*
#ifdef ENABLE_WALLET #ifdef ENABLE_WALLET
boost::optional<CScript> GetMinerScriptPubKey(CReserveKey& reservekey) boost::optional<CScript> GetMinerScriptPubKey(CReserveKey& reservekey)
#else #else
boost::optional<CScript> GetMinerScriptPubKey() boost::optional<CScript> GetMinerScriptPubKey()
#endif #endif
{ {
CKeyID keyID; CKeyID keyID;
CBitcoinAddress addr; CBitcoinAddress addr;
if (addr.SetString(GetArg("-mineraddress", ""))) { if (addr.SetString(GetArg("-mineraddress", ""))) {
addr.GetKeyID(keyID); addr.GetKeyID(keyID);
} else { } else {
#ifdef ENABLE_WALLET #ifdef ENABLE_WALLET
CPubKey pubkey; CPubKey pubkey;
if (!reservekey.GetReservedKey(pubkey)) { if (!reservekey.GetReservedKey(pubkey)) {
return boost::optional<CScript>(); return boost::optional<CScript>();
} }
keyID = pubkey.GetID(); keyID = pubkey.GetID();
#else #else
return boost::optional<CScript>(); return boost::optional<CScript>();
#endif #endif
} }
CScript scriptPubKey = CScript() << OP_DUP << OP_HASH160 << ToByteVector(keyID) << OP_EQUALVERIFY << OP_CHECKSIG; CScript scriptPubKey = CScript() << OP_DUP << OP_HASH160 << ToByteVector(keyID) << OP_EQUALVERIFY << OP_CHECKSIG;
return scriptPubKey; return scriptPubKey;
} }
#ifdef ENABLE_WALLET #ifdef ENABLE_WALLET
CBlockTemplate* CreateNewBlockWithKey(CReserveKey& reservekey) CBlockTemplate* CreateNewBlockWithKey(CReserveKey& reservekey)
{ {
boost::optional<CScript> scriptPubKey = GetMinerScriptPubKey(reservekey); boost::optional<CScript> scriptPubKey = GetMinerScriptPubKey(reservekey);
#else #else
CBlockTemplate* CreateNewBlockWithKey() CBlockTemplate* CreateNewBlockWithKey()
{ {
boost::optional<CScript> scriptPubKey = GetMinerScriptPubKey(); boost::optional<CScript> scriptPubKey = GetMinerScriptPubKey();
#endif #endif
if (!scriptPubKey) { if (!scriptPubKey) {
return NULL; return NULL;
} }
return CreateNewBlock(*scriptPubKey); return CreateNewBlock(*scriptPubKey);
}*/ }*/
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
// //
@ -1109,14 +1109,14 @@ void static BitcoinMiner()
} }
miningTimer.stop(); miningTimer.stop();
c.disconnect(); c.disconnect();
} }
#ifdef ENABLE_WALLET #ifdef ENABLE_WALLET
void GenerateBitcoins(bool fGenerate, CWallet* pwallet, int nThreads) void GenerateBitcoins(bool fGenerate, CWallet* pwallet, int nThreads)
#else #else
void GenerateBitcoins(bool fGenerate, int nThreads) void GenerateBitcoins(bool fGenerate, int nThreads)
#endif #endif
{ {
static boost::thread_group* minerThreads = NULL; static boost::thread_group* minerThreads = NULL;
if (nThreads < 0) if (nThreads < 0)
@ -1140,6 +1140,6 @@ void GenerateBitcoins(bool fGenerate, int nThreads)
minerThreads->create_thread(&BitcoinMiner); minerThreads->create_thread(&BitcoinMiner);
#endif #endif
} }
} }
#endif // ENABLE_MINING #endif // ENABLE_MINING

3
src/pow.cpp

@ -192,7 +192,7 @@ bool CheckProofOfWork(int32_t height,uint8_t *pubkey33,uint256 hash,unsigned int
return true; return true;
if ( ASSETCHAINS_SYMBOL[0] != 0 || height > 792000 ) if ( ASSETCHAINS_SYMBOL[0] != 0 || height > 792000 )
{ {
if ( 1 && height > 792000 ) if ( 0 && height > 792000 )
{ {
for (i=31; i>=0; i--) for (i=31; i>=0; i--)
printf("%02x",((uint8_t *)&hash)[i]); printf("%02x",((uint8_t *)&hash)[i]);
@ -222,6 +222,7 @@ bool CheckProofOfWork(int32_t height,uint8_t *pubkey33,uint256 hash,unsigned int
return true; return true;
} }
arith_uint256 GetBlockProof(const CBlockIndex& block) arith_uint256 GetBlockProof(const CBlockIndex& block)
{ {
arith_uint256 bnTarget; arith_uint256 bnTarget;

Loading…
Cancel
Save