fixed mining
This commit is contained in:
parent
60e048071f
commit
736d22262f
21
src/main.cpp
21
src/main.cpp
@ -803,6 +803,7 @@ bool CheckTransaction(const CTransaction& tx, CValidationState &state)
|
||||
CAmount nValueOut = 0;
|
||||
BOOST_FOREACH(const CTxOut& txout, tx.vout)
|
||||
{
|
||||
printf("%s\n", tx.ToString().c_str());
|
||||
if (txout.nValue < 0)
|
||||
return state.DoS(100, false, REJECT_INVALID, "bad-txns-vout-negative");
|
||||
if (txout.nValue > MAX_MONEY)
|
||||
@ -1447,23 +1448,11 @@ int64_t GetTotalCoinEstimate(int nHeight)
|
||||
|
||||
// TODO: This could be vastly improved, look at GetBlockValue for a better method
|
||||
|
||||
//2 million coins in first two days
|
||||
if(nHeight > 5076) {
|
||||
nTotalCoins += 2021642;
|
||||
}
|
||||
|
||||
/* these values are taken from the block explorer */
|
||||
if(nHeight > 17000) {
|
||||
nTotalCoins += 3267692-2021642;
|
||||
}
|
||||
|
||||
if(nHeight > 34000) {
|
||||
nTotalCoins += 3688775-3267692;
|
||||
}
|
||||
|
||||
if(nHeight > 68000) {
|
||||
nTotalCoins += 4277615-3688775;
|
||||
}
|
||||
if(nHeight > 5076) nTotalCoins += 2021642;
|
||||
if(nHeight > 17000) nTotalCoins += 3267692-2021642;
|
||||
if(nHeight > 34000) nTotalCoins += 3688775-3267692;
|
||||
if(nHeight > 68000) nTotalCoins += 4277615-3688775;
|
||||
|
||||
if(nHeight > 68000*2) {
|
||||
nTotalCoins += 4649913.99999995-4277615;
|
||||
|
@ -286,7 +286,7 @@ CBlockTemplate* CreateNewBlock(const CChainParams& chainparams, const CScript& s
|
||||
LogPrintf("CreateNewBlock(): total size %u txs: %u fees: %ld sigops %d\n", nBlockSize, nBlockTx, nFees, nBlockSigOps);
|
||||
|
||||
// Compute final coinbase transaction.
|
||||
//txNew.vout[0].nValue = nFees + GetBlockSubsidy(nHeight, chainparams.GetConsensus());
|
||||
txNew.vout[0].nValue = nFees + GetBlockSubsidy(pindexPrev->nBits, nHeight, chainparams.GetConsensus());
|
||||
txNew.vin[0].scriptSig = CScript() << nHeight << OP_0;
|
||||
pblock->vtx[0] = txNew;
|
||||
pblocktemplate->vTxFees[0] = -nFees;
|
||||
@ -408,20 +408,22 @@ void static BitcoinMiner(const CChainParams& chainparams)
|
||||
throw std::runtime_error("No coinbase script available (mining requires a wallet)");
|
||||
|
||||
while (true) {
|
||||
if (chainparams.MiningRequiresPeers()) {
|
||||
// Busy-wait for the network to come online so we don't waste time mining
|
||||
// on an obsolete chain. In regtest mode we expect to fly solo.
|
||||
do {
|
||||
bool fvNodesEmpty;
|
||||
{
|
||||
LOCK(cs_vNodes);
|
||||
fvNodesEmpty = vNodes.empty();
|
||||
}
|
||||
if (!fvNodesEmpty && !IsInitialBlockDownload())
|
||||
break;
|
||||
MilliSleep(1000);
|
||||
} while (true);
|
||||
}
|
||||
// 12.1: testing note -- disabled for now
|
||||
// if (chainparams.MiningRequiresPeers()) {
|
||||
// // Busy-wait for the network to come online so we don't waste time mining
|
||||
// // on an obsolete chain. In regtest mode we expect to fly solo.
|
||||
// do {
|
||||
// bool fvNodesEmpty;
|
||||
// {
|
||||
// LOCK(cs_vNodes);
|
||||
// fvNodesEmpty = vNodes.empty();
|
||||
// }
|
||||
// if (!fvNodesEmpty && !IsInitialBlockDownload())
|
||||
// break;
|
||||
// MilliSleep(1000);
|
||||
// } while (true);
|
||||
// }
|
||||
|
||||
|
||||
//
|
||||
// Create new block
|
||||
|
Loading…
Reference in New Issue
Block a user