Successful staking on Sapling wit Crypto Conditions

This commit is contained in:
miketout
2018-10-05 21:09:09 -07:00
parent 185b2d4f2f
commit 95c5c69bab
4 changed files with 37 additions and 7 deletions

View File

@@ -260,8 +260,8 @@ bool ValidateMatchingStake(const CTransaction &ccTx, uint32_t voutNum, const CTr
{ {
height = (height << 8) + ccp.vData[2][i]; height = (height << 8) + ccp.vData[2][i];
} }
// strange issue // for debugging strange issue
printf("iterator: %d, height: %d, datalen: %d\n", i, height, dataLen); // printf("iterator: %d, height: %d, datalen: %d\n", i, height, dataLen);
if (utxo == uint256(ccp.vData[0])) if (utxo == uint256(ccp.vData[0]))
{ {

View File

@@ -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); bool newPOSEnforcement = enablePOSNonce && (Params().GetConsensus().vUpgrades[Consensus::UPGRADE_SAPLING].nActivationHeight <= height);
uint256 rawHash; uint256 rawHash;
arith_uint256 posHash; 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) if (newPOSEnforcement)
{ {
validHash = pblock->GetRawVerusPOSHash(rawHash, height); validHash = pblock->GetRawVerusPOSHash(rawHash, height);

View File

@@ -4957,11 +4957,11 @@ bool ProcessNewBlock(bool from_miner,int32_t height,CValidationState &state, CNo
} }
// Store to disk // Store to disk
CBlockIndex *pindex = NULL; CBlockIndex *pindex = NULL;
if ( 1 ) //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 // // 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); // komodo_ensure(pblock, hash);
} //}
bool ret = AcceptBlock(&futureblock,*pblock, state, &pindex, fRequested, dbp); bool ret = AcceptBlock(&futureblock,*pblock, state, &pindex, fRequested, dbp);
if (pindex && pfrom) { if (pindex && pfrom) {
mapBlockSource[pindex->GetBlockHash()] = pfrom->GetId(); mapBlockSource[pindex->GetBlockHash()] = pfrom->GetId();

View File

@@ -240,6 +240,13 @@ UniValue help(const UniValue& params, bool fHelp)
extern char ASSETCHAINS_SYMBOL[KOMODO_ASSETCHAIN_MAXLEN]; 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) UniValue stop(const UniValue& params, bool fHelp)
{ {
char buf[64]; char buf[64];
@@ -248,6 +255,13 @@ UniValue stop(const UniValue& params, bool fHelp)
throw runtime_error( throw runtime_error(
"stop\n" "stop\n"
"\nStop Komodo server."); "\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 // Shutdown will take long enough that the response should get back
StartShutdown(); StartShutdown();
sprintf(buf,"%s Komodo server stopping",ASSETCHAINS_SYMBOL); sprintf(buf,"%s Komodo server stopping",ASSETCHAINS_SYMBOL);