This commit is contained in:
jl777
2018-04-09 21:12:25 +03:00
parent 14a53f21a1
commit e005f57633
2 changed files with 14 additions and 11 deletions

View File

@@ -704,11 +704,11 @@ uint32_t komodo_stake(arith_uint256 bnTarget,int32_t nHeight,uint256 txid,int32_
}
//fprintf(stderr,"iterated until i.%d winner.%d\n",i,winner);
}
for (i=31; i>=0; i--)
for (i=31; i>=24; i--)
fprintf(stderr,"%02x",((uint8_t *)&hashval)[i]);
//fprintf(stderr," vs ");
//for (i=31; i>=0; i--)
// fprintf(stderr,"%02x",((uint8_t *)&bnTarget)[i]);
fprintf(stderr," vs ");
for (i=31; i>=24; i--)
fprintf(stderr,"%02x",((uint8_t *)&bnTarget)[i]);
fprintf(stderr," iter.%d winner.%d coinage.%llu %d ht.%d gap.%d %.8f/%llu\n",iter,winner,(long long)coinage,(int32_t)(blocktime - txtime),nHeight,(int32_t)(blocktime - prevtime),dstr(value),(long long)supply);
}
return(blocktime * winner);

View File

@@ -4492,14 +4492,17 @@ int32_t komodo_staked(uint32_t nBits,uint32_t *blocktimep,uint32_t *txtimep,uint
if ( pindex != 0 && (tipindex= chainActive.Tip()) != 0 )
{
eligible = komodo_stake(bnTarget,(uint32_t)tipindex->nHeight+1,out.tx->GetHash(),out.i,*blocktimep,(uint32_t)tipindex->nTime);
if ( (eligible > 0 && eligible < earliest) || (eligible == earliest && (*utxovaluep == 0 || nValue < *utxovaluep)) )
if ( eligible > 0 )
{
earliest = eligible;
best_scriptPubKey = out.tx->vout[out.i].scriptPubKey;
*utxovaluep = (uint64_t)nValue;
decode_hex((uint8_t *)utxotxidp,32,(char *)out.tx->GetHash().GetHex().c_str());
*utxovoutp = out.i;
*txtimep = (uint32_t)out.tx->nLockTime;
if ( earliest == 0 || eligible < earliest || (eligible == earliest && (*utxovaluep == 0 || nValue < *utxovaluep)) )
{
earliest = eligible;
best_scriptPubKey = out.tx->vout[out.i].scriptPubKey;
*utxovaluep = (uint64_t)nValue;
decode_hex((uint8_t *)utxotxidp,32,(char *)out.tx->GetHash().GetHex().c_str());
*utxovoutp = out.i;
*txtimep = (uint32_t)out.tx->nLockTime;
}
}
//fprintf(stderr,"(%s) %s/v%d nValue %.8f locktime.%u txheight.%d pindexht.%d\n",CBitcoinAddress(address).ToString().c_str(),out.tx->GetHash().GetHex().c_str(),out.i,(double)nValue/COIN,locktime,txheight,pindex->nHeight);
}