mirror of
https://github.com/twisterarmy/twister-core.git
synced 2025-01-23 04:54:30 +00:00
block creation
This commit is contained in:
parent
97ba3b787c
commit
3cc155526a
19
src/main.cpp
19
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();
|
||||
}
|
||||
|
||||
|
@ -1236,8 +1236,6 @@ extern CBlockTreeDB *pblocktree;
|
||||
struct CBlockTemplate
|
||||
{
|
||||
CBlock block;
|
||||
std::vector<int64_t> vTxFees;
|
||||
std::vector<int64_t> vTxSigOps;
|
||||
};
|
||||
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user