From 3cc155526ab5027a890ab385c62bb0426474025c Mon Sep 17 00:00:00 2001 From: Miguel Freitas Date: Tue, 16 Jul 2013 23:53:02 -0300 Subject: [PATCH] block creation --- src/main.cpp | 19 +++++-------------- src/main.h | 2 -- src/rpcmining.cpp | 4 +--- 3 files changed, 6 insertions(+), 19 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 18139af5..586170e7 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -3929,25 +3929,17 @@ CBlockTemplate* CreateNewBlock(CReserveKey& reservekey) // Create coinbase tx CTransaction txNew; - /* [MF] - txNew.vin.resize(1); - txNew.vin[0].prevout.SetNull(); - txNew.vout.resize(1); - */ txNew.message.clear(); - /* [MF] Check! add spam */ CPubKey pubkey; if (!reservekey.GetReservedKey(pubkey)) return NULL; txNew.pubKey << pubkey << OP_CHECKSIG; - + txNew.nNonce = 0; // [MF] TODO: fix nNonce // Add our coinbase tx as first transaction pblock->vtx.push_back(txNew); - pblocktemplate->vTxFees.push_back(-1); // updated at end - pblocktemplate->vTxSigOps.push_back(-1); // updated at end // Largest block you're willing to create: unsigned int nBlockMaxSize = GetArg("-blockmaxsize", MAX_BLOCK_SIZE_GEN/2); @@ -4040,11 +4032,10 @@ void IncrementExtraNonce(CBlock* pblock, CBlockIndex* pindexPrev, unsigned int& hashPrevBlock = pblock->hashPrevBlock; } ++nExtraNonce; - unsigned int nHeight = pindexPrev->nHeight+1; // Height first in coinbase required for block.version=2 - /* [MF] Check! - pblock->vtx[0].vin[0].scriptSig = (CScript() << nHeight << CBigNum(nExtraNonce)) + COINBASE_FLAGS; - assert(pblock->vtx[0].vin[0].scriptSig.size() <= 100); - */ + pblock->nHeight = pindexPrev->nHeight+1; + /* extra nonce added to spamMessage.pubKey */ + pblock->vtx[0].pubKey = (CScript() << CBigNum(nExtraNonce)) + COINBASE_FLAGS; + assert(pblock->vtx[0].pubKey.size() <= 100); pblock->hashMerkleRoot = pblock->BuildMerkleTree(); } diff --git a/src/main.h b/src/main.h index 9b315050..01655931 100644 --- a/src/main.h +++ b/src/main.h @@ -1236,8 +1236,6 @@ extern CBlockTreeDB *pblocktree; struct CBlockTemplate { CBlock block; - std::vector vTxFees; - std::vector vTxSigOps; }; diff --git a/src/rpcmining.cpp b/src/rpcmining.cpp index da74f95a..e10f57ed 100644 --- a/src/rpcmining.cpp +++ b/src/rpcmining.cpp @@ -167,7 +167,7 @@ Value getwork(const Array& params, bool fHelp) IncrementExtraNonce(pblock, pindexPrev, nExtraNonce); // Save - /* [MF] + /* [MF] Check! mapNewBlock[pblock->hashMerkleRoot] = make_pair(pblock, pblock->vtx[0].vin[0].scriptSig); */ @@ -326,8 +326,6 @@ Value getblocktemplate(const Array& params, bool fHelp) entry.push_back(Pair("depends", deps)); int index_in_template = i - 1; - entry.push_back(Pair("fee", pblocktemplate->vTxFees[index_in_template])); - entry.push_back(Pair("sigops", pblocktemplate->vTxSigOps[index_in_template])); transactions.push_back(entry); }