@@ -638,11 +638,7 @@ bool OraclesDataValidate(struct CCcontract_info *cp,Eval* eval,const CTransactio
|
|||||||
|
|
||||||
int32_t GetLatestTimestamp(int32_t height)
|
int32_t GetLatestTimestamp(int32_t height)
|
||||||
{
|
{
|
||||||
uint256 blockHash; CBlock block; CBlockIndex* pindex;
|
return(komodo_heightstamp(height));
|
||||||
|
|
||||||
blockHash = chainActive[height]->GetBlockHash();
|
|
||||||
pindex = mapBlockIndex[blockHash];
|
|
||||||
return(pindex->nTime);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool OraclesValidate(struct CCcontract_info *cp,Eval* eval,const CTransaction &tx, uint32_t nIn)
|
bool OraclesValidate(struct CCcontract_info *cp,Eval* eval,const CTransaction &tx, uint32_t nIn)
|
||||||
|
|||||||
@@ -1692,7 +1692,7 @@ int8_t equihash_params_possible(uint64_t n, uint64_t k)
|
|||||||
|
|
||||||
void komodo_args(char *argv0)
|
void komodo_args(char *argv0)
|
||||||
{
|
{
|
||||||
std::string name,addn,hexstr,symbol; char *dirname,fname[512],arg0str[64],magicstr[9]; uint8_t magic[4],extrabuf[32756],disablebits[32],*extraptr=0; FILE *fp; uint64_t val; uint16_t port; int32_t i,nonz=0,baseid,len,n,extralen = 0; uint64_t ccenables[256], ccEnablesHeight[512];
|
std::string name,addn,hexstr,symbol; char *dirname,fname[512],arg0str[64],magicstr[9]; uint8_t magic[4],extrabuf[32756],disablebits[32],*extraptr=0; FILE *fp; uint64_t val; uint16_t port; int32_t i,nonz=0,baseid,len,n,extralen = 0; uint64_t ccenables[256], ccEnablesHeight[512] = {0};
|
||||||
IS_KOMODO_NOTARY = GetBoolArg("-notary", false);
|
IS_KOMODO_NOTARY = GetBoolArg("-notary", false);
|
||||||
IS_STAKED_NOTARY = GetArg("-stakednotary", -1);
|
IS_STAKED_NOTARY = GetArg("-stakednotary", -1);
|
||||||
memset(ccenables,0,sizeof(ccenables));
|
memset(ccenables,0,sizeof(ccenables));
|
||||||
@@ -1717,15 +1717,17 @@ void komodo_args(char *argv0)
|
|||||||
// I think on season change should reccomend notaries to use -notary to avoid needing this.
|
// I think on season change should reccomend notaries to use -notary to avoid needing this.
|
||||||
int32_t kmd_season = getacseason(time(NULL));
|
int32_t kmd_season = getacseason(time(NULL));
|
||||||
for (i=0; i<64; i++)
|
for (i=0; i<64; i++)
|
||||||
if ( strcmp(NOTARY_PUBKEY.c_str(),notaries_elected[kmd_season][NUM_KMD_NOTARIES][1]) == 0 )
|
{
|
||||||
|
if ( strcmp(NOTARY_PUBKEY.c_str(),notaries_elected[kmd_season-1][i][1]) == 0 )
|
||||||
{
|
{
|
||||||
IS_KOMODO_NOTARY = 1;
|
IS_KOMODO_NOTARY = 1;
|
||||||
KOMODO_MININGTHREADS = 1;
|
KOMODO_MININGTHREADS = 1;
|
||||||
mapArgs ["-genproclimit"] = itostr(KOMODO_MININGTHREADS);
|
mapArgs ["-genproclimit"] = itostr(KOMODO_MININGTHREADS);
|
||||||
IS_STAKED_NOTARY = -1;
|
IS_STAKED_NOTARY = -1;
|
||||||
fprintf(stderr,"running as notary.%d %s\n",i,notaries_elected[kmd_season][NUM_KMD_NOTARIES][0]);
|
fprintf(stderr,"running as notary.%d %s\n",i,notaries_elected[kmd_season-1][i][0]);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( IS_STAKED_NOTARY != -1 && IS_KOMODO_NOTARY == true ) {
|
if ( IS_STAKED_NOTARY != -1 && IS_KOMODO_NOTARY == true ) {
|
||||||
@@ -1767,7 +1769,7 @@ void komodo_args(char *argv0)
|
|||||||
{
|
{
|
||||||
int32_t ecode = ccEnablesHeight[i];
|
int32_t ecode = ccEnablesHeight[i];
|
||||||
int32_t ht = ccEnablesHeight[i+1];
|
int32_t ht = ccEnablesHeight[i+1];
|
||||||
if ( ecode > 256 )
|
if ( ecode > 255 || ecode < 0 )
|
||||||
fprintf(stderr, "ac_ccactivateht: invalid evalcode.%i must be between 0 and 256.\n", ecode);
|
fprintf(stderr, "ac_ccactivateht: invalid evalcode.%i must be between 0 and 256.\n", ecode);
|
||||||
else if ( ht > 0 )
|
else if ( ht > 0 )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -222,9 +222,13 @@ CBlockTemplate* CreateNewBlock(CPubKey _pk,const CScript& _scriptPubKeyIn, int32
|
|||||||
boost::optional<CTransaction> cheatSpend;
|
boost::optional<CTransaction> cheatSpend;
|
||||||
|
|
||||||
uint256 cbHash;
|
uint256 cbHash;
|
||||||
|
|
||||||
|
boost::this_thread::interruption_point(); // exit thread before entering locks.
|
||||||
|
|
||||||
CBlockIndex* pindexPrev = 0;
|
CBlockIndex* pindexPrev = 0;
|
||||||
{
|
{
|
||||||
|
// this should stop create block ever exiting until it has returned something.
|
||||||
|
boost::this_thread::disable_interruption();
|
||||||
ENTER_CRITICAL_SECTION(cs_main);
|
ENTER_CRITICAL_SECTION(cs_main);
|
||||||
ENTER_CRITICAL_SECTION(mempool.cs);
|
ENTER_CRITICAL_SECTION(mempool.cs);
|
||||||
pindexPrev = chainActive.LastTip();
|
pindexPrev = chainActive.LastTip();
|
||||||
@@ -815,7 +819,8 @@ CBlockTemplate* CreateNewBlock(CPubKey _pk,const CScript& _scriptPubKeyIn, int32
|
|||||||
LEAVE_CRITICAL_SECTION(cs_main);
|
LEAVE_CRITICAL_SECTION(cs_main);
|
||||||
LEAVE_CRITICAL_SECTION(mempool.cs);
|
LEAVE_CRITICAL_SECTION(mempool.cs);
|
||||||
}
|
}
|
||||||
throw std::runtime_error("CreateNewBlock(): TestBlockValidity failed");
|
//throw std::runtime_error("CreateNewBlock(): TestBlockValidity failed"); // crashes the node, moved to GetBlockTemplate and issue return.
|
||||||
|
return(0);
|
||||||
}
|
}
|
||||||
//fprintf(stderr,"valid\n");
|
//fprintf(stderr,"valid\n");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -745,7 +745,8 @@ UniValue getblocktemplate(const UniValue& params, bool fHelp)
|
|||||||
#endif
|
#endif
|
||||||
ENTER_CRITICAL_SECTION(cs_main);
|
ENTER_CRITICAL_SECTION(cs_main);
|
||||||
if (!pblocktemplate)
|
if (!pblocktemplate)
|
||||||
throw JSONRPCError(RPC_OUT_OF_MEMORY, "Out of memory or no available utxo for staking");
|
throw std::runtime_error("CreateNewBlock(): create block failed");
|
||||||
|
//throw JSONRPCError(RPC_OUT_OF_MEMORY, "Out of memory or no available utxo for staking");
|
||||||
|
|
||||||
// Need to update only after we know CreateNewBlockWithKey succeeded
|
// Need to update only after we know CreateNewBlockWithKey succeeded
|
||||||
pindexPrev = pindexPrevNew;
|
pindexPrev = pindexPrevNew;
|
||||||
|
|||||||
Reference in New Issue
Block a user