diff --git a/src/cc/CoinbaseGuard.cpp b/src/cc/CoinbaseGuard.cpp index 3db0d835e..cd56987ce 100644 --- a/src/cc/CoinbaseGuard.cpp +++ b/src/cc/CoinbaseGuard.cpp @@ -260,8 +260,8 @@ bool ValidateMatchingStake(const CTransaction &ccTx, uint32_t voutNum, const CTr { height = (height << 8) + ccp.vData[2][i]; } - // strange issue - printf("iterator: %d, height: %d, datalen: %d\n", i, height, dataLen); + // for debugging strange issue + // printf("iterator: %d, height: %d, datalen: %d\n", i, height, dataLen); if (utxo == uint256(ccp.vData[0])) { diff --git a/src/komodo_bitcoind.h b/src/komodo_bitcoind.h index f6e96fc28..89048c00d 100644 --- a/src/komodo_bitcoind.h +++ b/src/komodo_bitcoind.h @@ -1496,6 +1496,22 @@ bool verusCheckPOSBlock(int32_t slowflag, CBlock *pblock, int32_t height) bool newPOSEnforcement = enablePOSNonce && (Params().GetConsensus().vUpgrades[Consensus::UPGRADE_SAPLING].nActivationHeight <= height); uint256 rawHash; arith_uint256 posHash; + + // check without consequences if not enforced yet + { + if (pblock->GetRawVerusPOSHash(rawHash, height)) + { + posHash = UintToArith256(rawHash) / value; + printf("PoS block\nblkHash: %s\nnNonce: %s\nrawHash: %s\nposHash: %s\nvalue: %lu\n", + pblock->GetHash().GetHex().c_str(), pblock->nNonce.GetHex().c_str(), rawHash.GetHex().c_str(), posHash.GetHex().c_str(), value); + } + else + { + printf("PoS block\nblkHash: %s\nnNonce: %s\nFAILED TO GET posHash\n", + pblock->GetHash().GetHex().c_str(), pblock->nNonce.GetHex().c_str()); + } + } + if (newPOSEnforcement) { validHash = pblock->GetRawVerusPOSHash(rawHash, height); diff --git a/src/main.cpp b/src/main.cpp index d62473f82..366f77d21 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -4957,11 +4957,11 @@ bool ProcessNewBlock(bool from_miner,int32_t height,CValidationState &state, CNo } // Store to disk CBlockIndex *pindex = NULL; - if ( 1 ) - { - // without the komodo_ensure call, it is quite possible to get a non-error but null pindex returned from AcceptBlockHeader. In a 2 node network, it will be a long time before that block is reprocessed. Even though restarting makes it rescan, it seems much better to keep the nodes in sync - komodo_ensure(pblock, hash); - } + //if ( 1 ) + //{ + // // without the komodo_ensure call, it is quite possible to get a non-error but null pindex returned from AcceptBlockHeader. In a 2 node network, it will be a long time before that block is reprocessed. Even though restarting makes it rescan, it seems much better to keep the nodes in sync + // komodo_ensure(pblock, hash); + //} bool ret = AcceptBlock(&futureblock,*pblock, state, &pindex, fRequested, dbp); if (pindex && pfrom) { mapBlockSource[pindex->GetBlockHash()] = pfrom->GetId(); diff --git a/src/rpc/server.cpp b/src/rpc/server.cpp index 9fcd3bd3c..d0dc46957 100644 --- a/src/rpc/server.cpp +++ b/src/rpc/server.cpp @@ -240,6 +240,13 @@ UniValue help(const UniValue& params, bool fHelp) extern char ASSETCHAINS_SYMBOL[KOMODO_ASSETCHAIN_MAXLEN]; +#ifdef ENABLE_WALLET +void GenerateBitcoins(bool b, CWallet *pw, int t); +#else +void GenerateBitcoins(bool b, CWallet *pw); +#endif + + UniValue stop(const UniValue& params, bool fHelp) { char buf[64]; @@ -248,6 +255,13 @@ UniValue stop(const UniValue& params, bool fHelp) throw runtime_error( "stop\n" "\nStop Komodo server."); + +#ifdef ENABLE_WALLET + GenerateBitcoins(false, pwalletMain, 0); +#else + GenerateBitcoins(false, 0); +#endif + // Shutdown will take long enough that the response should get back StartShutdown(); sprintf(buf,"%s Komodo server stopping",ASSETCHAINS_SYMBOL);