Browse Source

Test

pull/4/head
jl777 6 years ago
parent
commit
9465da966b
  1. 15
      src/komodo_gateway.h
  2. 11
      src/miner.cpp
  3. 5
      src/wallet/rpcwallet.cpp

15
src/komodo_gateway.h

@ -705,12 +705,15 @@ 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>=24; i--)
fprintf(stderr,"%02x",((uint8_t *)&hashval)[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);
if ( 0 )
{
for (i=31; i>=24; i--)
fprintf(stderr,"%02x",((uint8_t *)&hashval)[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);
}
}
if ( nHeight < 2 )
return(blocktime);

11
src/miner.cpp

@ -402,13 +402,14 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn)
pblock->nTime = blocktime;
if ( GetAdjustedTime()+30 < pblock->nTime )
{
printf("need to wait %d seconds to submit: ",(int32_t)(pblock->nTime - GetAdjustedTime()));
while ( GetAdjustedTime()+30 < pblock->nTime )
//printf("need to wait %d seconds to submit: ",(int32_t)(pblock->nTime - GetAdjustedTime()));
/*while ( GetAdjustedTime()+30 < pblock->nTime )
{
sleep(1);
sleep(30);
fprintf(stderr,"%d ",(int32_t)(pblock->nTime - GetAdjustedTime()));
}
fprintf(stderr,"finished waiting\n");
}*/
//fprintf(stderr,"finished waiting\n");
sleep(30);
}
} else fprintf(stderr,"no utxos eligible for staking\n");

5
src/wallet/rpcwallet.cpp

@ -4486,9 +4486,8 @@ int32_t komodo_staked(CMutableTransaction &txNew,uint32_t nBits,uint32_t *blockt
}
}
entry.push_back(Pair("amount",ValueFromAmount(nValue)));*/
BlockMap::iterator it = mapBlockIndex.find(pcoinsTip->GetBestBlock());
//BlockMap::iterator it = mapBlockIndex.find(pcoinsTip->GetBestBlock());
CBlockIndex *tipindex;
uint64_t interest; uint32_t locktime; int32_t txheight;
if ( (tipindex= chainActive.Tip()) != 0 )
{
eligible = komodo_stake(bnTarget,(uint32_t)tipindex->nHeight+1,out.tx->GetHash(),out.i,*blocktimep,(uint32_t)tipindex->nTime);
@ -4502,7 +4501,7 @@ int32_t komodo_staked(CMutableTransaction &txNew,uint32_t nBits,uint32_t *blockt
decode_hex((uint8_t *)utxotxidp,32,(char *)out.tx->GetHash().GetHex().c_str());
*utxovoutp = out.i;
*txtimep = (uint32_t)out.tx->nLockTime;
fprintf(stderr,"earliest.%u [%d] (%s) nValue %.8f locktime.%u txheight.%d\n",earliest,(int32_t)(earliest- *blocktimep),CBitcoinAddress(address).ToString().c_str(),(double)nValue/COIN,locktime,txheight);
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);
}
}
}

Loading…
Cancel
Save