Test
This commit is contained in:
@@ -1084,12 +1084,12 @@ uint32_t komodo_stake(int32_t validateflag,arith_uint256 bnTarget,int32_t nHeigh
|
||||
{
|
||||
CBlockIndex *pindex; uint8_t hashbuf[128]; char address[64]; bits256 addrhash; arith_uint256 hashval; uint256 hash,pasthash; int64_t diff=0; int32_t segid,minage,i,iter=0; uint32_t txtime,winner = 0; uint64_t value,coinage,supply = ASSETCHAINS_SUPPLY + nHeight*ASSETCHAINS_REWARD/SATOSHIDEN;
|
||||
txtime = komodo_txtime(&value,txid,vout,address);
|
||||
if ( blocktime < prevtime+57 )
|
||||
blocktime = prevtime+57;
|
||||
if ( value == 0 || txtime == 0 || blocktime == 0 || prevtime == 0 )
|
||||
return(0);
|
||||
if ( (minage= nHeight*3) > 6000 )
|
||||
minage = 6000;
|
||||
if ( blocktime < prevtime+57 )
|
||||
blocktime = prevtime+57;
|
||||
if ( blocktime > txtime+minage && (pindex= komodo_chainactive(nHeight>200?nHeight-200:1)) != 0 )
|
||||
{
|
||||
vcalc_sha256(0,(uint8_t *)&addrhash,(uint8_t *)address,(int32_t)strlen(address));
|
||||
|
||||
@@ -419,7 +419,8 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn)
|
||||
pblocktemplate->vTxSigOps.push_back(GetLegacySigOpCount(txStaked));
|
||||
nFees += txfees;
|
||||
pblock->nTime = blocktime;
|
||||
if ( GetAdjustedTime() < pblock->nTime )//|| pblock->GetBlockTime() > GetAdjustedTime() + 60)
|
||||
printf("PoS ht.%d t%u\n",(int32_t)pblock->nHeight,blocktime);
|
||||
if ( 0 && GetAdjustedTime() < pblock->nTime )//|| pblock->GetBlockTime() > GetAdjustedTime() + 60)
|
||||
{
|
||||
fprintf(stderr,"need to wait %d seconds to mine:\n",(int32_t)(pblock->nTime - GetAdjustedTime()));
|
||||
while ( GetAdjustedTime()+30 < pblock->nTime )
|
||||
|
||||
@@ -4574,23 +4574,11 @@ int32_t komodo_staked(CMutableTransaction &txNew,uint32_t nBits,uint32_t *blockt
|
||||
//if (pwalletMain->mapAddressBook.count(address))
|
||||
// entry.push_back(Pair("account", pwalletMain->mapAddressBook[address].name));
|
||||
}
|
||||
/*entry.push_back(Pair("scriptPubKey", HexStr(pk.begin(), pk.end())));
|
||||
if (pk.IsPayToScriptHash())
|
||||
{
|
||||
CTxDestination address;
|
||||
if (ExtractDestination(pk, address)) {
|
||||
const CScriptID& hash = boost::get<CScriptID>(address);
|
||||
CScript redeemScript;
|
||||
if (pwalletMain->GetCScript(hash, redeemScript))
|
||||
entry.push_back(Pair("redeemScript", HexStr(redeemScript.begin(), redeemScript.end())));
|
||||
}
|
||||
}
|
||||
entry.push_back(Pair("amount",ValueFromAmount(nValue)));*/
|
||||
//BlockMap::iterator it = mapBlockIndex.find(pcoinsTip->GetBestBlock());
|
||||
CBlockIndex *tipindex;
|
||||
if ( (tipindex= chainActive.Tip()) != 0 )
|
||||
{
|
||||
eligible = komodo_stake(0,bnTarget,(uint32_t)tipindex->nHeight+1,out.tx->GetHash(),out.i,*blocktimep,(uint32_t)tipindex->nTime,(char *)CBitcoinAddress(address).ToString().c_str());
|
||||
eligible = komodo_stake(0,bnTarget,(uint32_t)tipindex->nHeight+1,out.tx->GetHash(),out.i,0,(uint32_t)tipindex->nTime,(char *)CBitcoinAddress(address).ToString().c_str());
|
||||
if ( eligible > 0 )
|
||||
{
|
||||
if ( eligible != komodo_stake(1,bnTarget,(uint32_t)tipindex->nHeight+1,out.tx->GetHash(),out.i,eligible,(uint32_t)tipindex->nTime,(char *)CBitcoinAddress(address).ToString().c_str()) )
|
||||
|
||||
Reference in New Issue
Block a user