int32_t komodo_staked(CMutableTransaction &txNew,uint32_t nBits,uint32_t *blocktimep,uint32_t *txtimep,uint256 *utxotxidp,int32_t *utxovoutp,uint64_t *utxovaluep,uint8_t *utxosig)
{
- set<CBitcoinAddress> setAddress; int32_t i,siglen=0,nMinDepth = 1,nMaxDepth = 9999999; vector<COutput> vecOutputs; uint32_t eligible,earliest = 0; CScript best_scriptPubKey; arith_uint256 bnTarget; bool fNegative,fOverflow;
+ set<CBitcoinAddress> setAddress; int32_t i,siglen=0,nMinDepth = 1,nMaxDepth = 99999999; vector<COutput> vecOutputs; uint32_t eligible,earliest = 0; CScript best_scriptPubKey; arith_uint256 bnTarget; bool fNegative,fOverflow;
bnTarget.SetCompact(nBits, &fNegative, &fOverflow);
assert(pwalletMain != NULL);
LOCK2(cs_main, pwalletMain->cs_wallet);
BOOST_FOREACH(const COutput& out, vecOutputs)
{
if ( out.nDepth < nMinDepth || out.nDepth > nMaxDepth )
+ {
+ fprintf(stderr,"komodo_staked invalid depth %d\n",(int32_t)out.nDepth);
continue;
+ }
if ( setAddress.size() )
{
CTxDestination address;
if (!ExtractDestination(out.tx->vout[out.i].scriptPubKey, address))
+ {
+ fprintf(stderr,"komodo_staked ExtractDestination error\n");
continue;
+ }
if (!setAddress.count(address))
+ {
+ fprintf(stderr,"komodo_staked setAddress.count error\n");
continue;
+ }
}
CAmount nValue = out.tx->vout[out.i].nValue;
const CScript& pk = out.tx->vout[out.i].scriptPubKey;
*txtimep = (uint32_t)out.tx->nLockTime;
fprintf(stderr,"earliest.%u [%d] (%s) nValue %.8f locktime.%u\n",earliest,(int32_t)(earliest- *blocktimep),CBitcoinAddress(address).ToString().c_str(),(double)nValue/COIN,*txtimep);
}
- }
- }
+ } else fprintf(stderr,"%s not eligible\n",out.tx->GetHash().c_str());
+ } else fprintf(stderr,"no tipindex\n");
}
if ( earliest != 0 )
{