X-Git-Url: https://git.novaco.in/?a=blobdiff_plain;f=src%2Fminer.cpp;h=0f04521bc5bba70e1ecd7f0d567e734b6ee2f133;hb=056f3b1ef51d160dad763ed43cacc151735999de;hp=f91b3bda5e85c6f32d96e431bcb5d08a42fb18eb;hpb=d008ea3376606276a86ed3c972654363eb23f47d;p=novacoin.git diff --git a/src/miner.cpp b/src/miner.cpp index f91b3bd..0f04521 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -78,9 +78,9 @@ public: }; -uint64 nLastBlockTx = 0; -uint64 nLastBlockSize = 0; -int64 nLastCoinStakeSearchInterval = 0; +uint64_t nLastBlockTx = 0; +uint64_t nLastBlockSize = 0; +uint32_t nLastCoinStakeSearchInterval = 0; // We want to sort transactions by priority and fee, so: typedef boost::tuple TxPriority; @@ -151,7 +151,7 @@ CBlock* CreateNewBlock(CWallet* pwallet, bool fProofOfStake) // a transaction spammer can cheaply fill blocks using // 1-satoshi-fee transactions. It should be set above the real // cost to you of processing a transaction. - int64 nMinTxFee = MIN_TX_FEE; + int64_t nMinTxFee = MIN_TX_FEE; if (mapArgs.count("-mintxfee")) ParseMoney(mapArgs["-mintxfee"], nMinTxFee); @@ -160,7 +160,7 @@ CBlock* CreateNewBlock(CWallet* pwallet, bool fProofOfStake) pblock->nBits = GetNextTargetRequired(pindexPrev, fProofOfStake); // Collect memory pool transactions into the block - int64 nFees = 0; + int64_t nFees = 0; { LOCK2(cs_main, mempool.cs); CBlockIndex* pindexPrev = pindexBest; @@ -181,7 +181,7 @@ CBlock* CreateNewBlock(CWallet* pwallet, bool fProofOfStake) COrphan* porphan = NULL; double dPriority = 0; - int64 nTotalIn = 0; + int64_t nTotalIn = 0; bool fMissingInputs = false; BOOST_FOREACH(const CTxIn& txin, tx.vin) { @@ -215,7 +215,7 @@ CBlock* CreateNewBlock(CWallet* pwallet, bool fProofOfStake) nTotalIn += mempool.mapTx[txin.prevout.hash].vout[txin.prevout.n].nValue; continue; } - int64 nValueIn = txPrev.vout[txin.prevout.n].nValue; + int64_t nValueIn = txPrev.vout[txin.prevout.n].nValue; nTotalIn += nValueIn; int nConf = txindex.GetDepthInMainChain(); @@ -243,8 +243,8 @@ CBlock* CreateNewBlock(CWallet* pwallet, bool fProofOfStake) // Collect transactions into block map mapTestPool; - uint64 nBlockSize = 1000; - uint64 nBlockTx = 0; + uint64_t nBlockSize = 1000; + uint64_t nBlockTx = 0; int nBlockSigOps = 100; bool fSortedByFee = (nBlockPrioritySize <= 0); @@ -276,7 +276,7 @@ CBlock* CreateNewBlock(CWallet* pwallet, bool fProofOfStake) continue; // Simplify transaction fee - allow free = false - int64 nMinFee = tx.GetMinFee(nBlockSize, true, GMF_BLOCK, nTxSize); + int64_t nMinFee = tx.GetMinFee(nBlockSize, true, GMF_BLOCK, nTxSize); // Skip free transactions if we're past the minimum block size: if (fSortedByFee && (dFeePerKb < nMinTxFee) && (nBlockSize + nTxSize >= nBlockMinSize)) @@ -300,7 +300,7 @@ CBlock* CreateNewBlock(CWallet* pwallet, bool fProofOfStake) if (!tx.FetchInputs(txdb, mapTestPoolTmp, false, true, mapInputs, fInvalid)) continue; - int64 nTxFees = tx.GetValueIn(mapInputs)-tx.GetValueOut(); + int64_t nTxFees = tx.GetValueIn(mapInputs)-tx.GetValueOut(); if (nTxFees < nMinFee) continue; @@ -348,15 +348,17 @@ CBlock* CreateNewBlock(CWallet* pwallet, bool fProofOfStake) nLastBlockTx = nBlockTx; nLastBlockSize = nBlockSize; - if (fDebug && GetBoolArg("-printpriority")) - printf("CreateNewBlock(): total size %" PRI64u "\n", nBlockSize); - if (!fProofOfStake) { - bool fProtocol048 = fTestNet || VALIDATION_SWITCH_TIME < pblock->nTime; - pblock->vtx[0].vout[0].nValue = GetProofOfWorkReward(pblock->nBits, fProtocol048 ? nFees : 0); + pblock->vtx[0].vout[0].nValue = GetProofOfWorkReward(pblock->nBits, nFees); + + if (fDebug) + printf("CreateNewBlock(): reward %" PRIu64 "\n", pblock->vtx[0].vout[0].nValue); } + if (fDebug && GetBoolArg("-printpriority")) + printf("CreateNewBlock(): total size %" PRIu64 "\n", nBlockSize); + // Fill in header pblock->hashPrevBlock = pindexPrev->GetBlockHash(); pblock->nTime = max(pindexPrev->GetMedianTimePast()+1, pblock->GetMaxTransactionTime());