Browse Source

Successful staking on Sapling wit Crypto Conditions

pull/4/head
miketout 6 years ago
parent
commit
95c5c69bab
  1. 4
      src/cc/CoinbaseGuard.cpp
  2. 16
      src/komodo_bitcoind.h
  3. 10
      src/main.cpp
  4. 14
      src/rpc/server.cpp

4
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]))
{

16
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);

10
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();

14
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);

Loading…
Cancel
Save