Test
This commit is contained in:
@@ -876,7 +876,8 @@ int32_t komodo_is_special(uint8_t pubkeys[66][33],int32_t mids[66],uint32_t bloc
|
|||||||
fprintf(stderr,"lag.%d ht.%d n.%d blocktimes[%u vs %u %u]\n",blocktime-blocktimes[1],height,notaryid,blocktime,blocktimes[0],blocktimes[1]);
|
fprintf(stderr,"lag.%d ht.%d n.%d blocktimes[%u vs %u %u]\n",blocktime-blocktimes[1],height,notaryid,blocktime,blocktimes[0],blocktimes[1]);
|
||||||
if ( height > 807000 )
|
if ( height > 807000 )
|
||||||
return(-2);
|
return(-2);
|
||||||
} else return(1);
|
}
|
||||||
|
return(1);
|
||||||
} else return(0);
|
} else return(0);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -212,7 +212,7 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn)
|
|||||||
|
|
||||||
if (tx.IsCoinBase() || !IsFinalTx(tx, nHeight, nLockTimeCutoff) || IsExpiredTx(tx, nHeight))
|
if (tx.IsCoinBase() || !IsFinalTx(tx, nHeight, nLockTimeCutoff) || IsExpiredTx(tx, nHeight))
|
||||||
continue;
|
continue;
|
||||||
if ( komodo_validate_interest(tx,nHeight,(uint32_t)pblock->nTime,2) < 0 )
|
if ( komodo_validate_interest(tx,nHeight,(uint32_t)pblock->nTime,0) < 0 )
|
||||||
{
|
{
|
||||||
fprintf(stderr,"CreateNewBlock: komodo_validate_interest failure\n");
|
fprintf(stderr,"CreateNewBlock: komodo_validate_interest failure\n");
|
||||||
continue;
|
continue;
|
||||||
@@ -401,16 +401,16 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn)
|
|||||||
pblocktemplate->vTxSigOps.push_back(GetLegacySigOpCount(txStaked));
|
pblocktemplate->vTxSigOps.push_back(GetLegacySigOpCount(txStaked));
|
||||||
nFees += txfees;
|
nFees += txfees;
|
||||||
pblock->nTime = blocktime;
|
pblock->nTime = blocktime;
|
||||||
if ( GetAdjustedTime()+30 < pblock->nTime )
|
if ( GetAdjustedTime() < pblock->nTime )
|
||||||
{
|
{
|
||||||
//printf("need to wait %d seconds to submit: ",(int32_t)(pblock->nTime - GetAdjustedTime()));
|
printf("need to wait %d seconds to submit: ",(int32_t)(pblock->nTime - GetAdjustedTime()));
|
||||||
/*while ( GetAdjustedTime()+30 < pblock->nTime )
|
while ( GetAdjustedTime()+30 < pblock->nTime )
|
||||||
{
|
{
|
||||||
sleep(30);
|
sleep(30);
|
||||||
fprintf(stderr,"%d ",(int32_t)(pblock->nTime - GetAdjustedTime()));
|
fprintf(stderr,"%d ",(int32_t)(pblock->nTime - GetAdjustedTime()));
|
||||||
}*/
|
}
|
||||||
//fprintf(stderr,"finished waiting\n");
|
fprintf(stderr,"finished waiting\n");
|
||||||
sleep(30);
|
//sleep(pblock->nTime - GetAdjustedTime());
|
||||||
}
|
}
|
||||||
|
|
||||||
} else fprintf(stderr,"no utxos eligible for staking\n");
|
} else fprintf(stderr,"no utxos eligible for staking\n");
|
||||||
@@ -484,6 +484,8 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn)
|
|||||||
UpdateTime(pblock, Params().GetConsensus(), pindexPrev);
|
UpdateTime(pblock, Params().GetConsensus(), pindexPrev);
|
||||||
pblock->nBits = GetNextWorkRequired(pindexPrev, pblock, Params().GetConsensus());
|
pblock->nBits = GetNextWorkRequired(pindexPrev, pblock, Params().GetConsensus());
|
||||||
}
|
}
|
||||||
|
if ( ASSETCHAINS_SYMBOL[0] == 0 && NOTARY_PUBKEY33[0] != 0 && pblock->nTime < pindexPrev->nTime+60 )
|
||||||
|
pblock->nTime = pindexPrev->nTime + 60;
|
||||||
pblock->nSolution.clear();
|
pblock->nSolution.clear();
|
||||||
pblocktemplate->vTxSigOps[0] = GetLegacySigOpCount(pblock->vtx[0]);
|
pblocktemplate->vTxSigOps[0] = GetLegacySigOpCount(pblock->vtx[0]);
|
||||||
|
|
||||||
@@ -501,47 +503,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);
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
@@ -657,7 +659,7 @@ static bool ProcessBlockFound(CBlock* pblock)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int32_t komodo_baseid(char *origbase);
|
int32_t komodo_baseid(char *origbase);
|
||||||
int32_t komodo_eligiblenotary(uint8_t pubkeys[66][33],int32_t *mids,uint32_t blocktimes[66],int32_t *nonzpkeysp,int32_t height);
|
int32_t komodo_eligiblenotary(uint8_t pubkeys[66][33],int32_t *mids,uint32_t *blocktimes,int32_t *nonzpkeysp,int32_t height);
|
||||||
arith_uint256 komodo_PoWtarget(int32_t *percPoSp,arith_uint256 target,int32_t height,int32_t goalperc);
|
arith_uint256 komodo_PoWtarget(int32_t *percPoSp,arith_uint256 target,int32_t height,int32_t goalperc);
|
||||||
int32_t FOUND_BLOCK,KOMODO_MAYBEMINED;
|
int32_t FOUND_BLOCK,KOMODO_MAYBEMINED;
|
||||||
extern int32_t KOMODO_LASTMINED;
|
extern int32_t KOMODO_LASTMINED;
|
||||||
@@ -692,7 +694,6 @@ void static BitcoinMiner()
|
|||||||
if ( komodo_baseid(ASSETCHAINS_SYMBOL) < 0 )
|
if ( komodo_baseid(ASSETCHAINS_SYMBOL) < 0 )
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
//sleep(60);
|
|
||||||
komodo_chosennotary(¬aryid,chainActive.Tip()->nHeight,NOTARY_PUBKEY33,(uint32_t)chainActive.Tip()->GetBlockTime());
|
komodo_chosennotary(¬aryid,chainActive.Tip()->nHeight,NOTARY_PUBKEY33,(uint32_t)chainActive.Tip()->GetBlockTime());
|
||||||
|
|
||||||
std::string solver;
|
std::string solver;
|
||||||
@@ -1103,14 +1104,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)
|
||||||
@@ -1134,6 +1135,6 @@ void GenerateBitcoins(bool fGenerate, int nThreads)
|
|||||||
minerThreads->create_thread(&BitcoinMiner);
|
minerThreads->create_thread(&BitcoinMiner);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // ENABLE_MINING
|
#endif // ENABLE_MINING
|
||||||
|
|||||||
Reference in New Issue
Block a user