Browse Source

test

pull/4/head
jl777 8 years ago
parent
commit
f4a5902e31
  1. 21
      src/chainparams.cpp
  2. 3
      src/chainparams.h

21
src/chainparams.cpp

@ -171,6 +171,27 @@ public:
};
static CMainParams mainParams;
CBlock CreateGenesisBlock(const char* pszTimestamp, const CScript& genesisOutputScript, uint32_t nTime, uint32_t nNonce, uint32_t nBits, int32_t nVersion, const CAmount& genesisReward)
{
CMutableTransaction txNew;
txNew.nVersion = 1;
txNew.vin.resize(1);
txNew.vout.resize(1);
txNew.vin[0].scriptSig = CScript() << 486604799 << CScriptNum(4) << std::vector<unsigned char>((const unsigned char*)pszTimestamp, (const unsigned char*)pszTimestamp + strlen(pszTimestamp));
txNew.vout[0].nValue = genesisReward;
txNew.vout[0].scriptPubKey = genesisOutputScript;
CBlock genesis;
genesis.nTime = nTime;
genesis.nBits = nBits;
genesis.nNonce = nNonce;
genesis.nVersion = nVersion;
genesis.vtx.push_back(txNew);
genesis.hashPrevBlock.SetNull();
genesis.hashMerkleRoot = BlockMerkleRoot(genesis);
return genesis;
}
void *chainparams_commandline(void *ptr)
{
//CChainParams *consensus = (CChainParams *)ptr;

3
src/chainparams.h

@ -14,6 +14,7 @@
#define KOMODO_MINDIFF_NBITS 0x200f0f0f
#define GENESIS_NBITS 0x1f00ffff
extern uint32_t ASSETCHAINS_TIMESTAMP;
#include <vector>
@ -88,7 +89,7 @@ public:
void SetRegTestCoinbaseMustBeProtected() { consensus.fCoinbaseMustBeProtected = true; }
void SetDefaultPort(uint16_t port) { nDefaultPort = port; }
void setnonce(uint32_t nonce) { genesis.nNonce = nonce; }
void setnonce(uint32_t nonce) { memcpy(&genesis.nNonce,&nonce,sizeof(nonce)); }
void settimestamp(uint32_t timestamp) { genesis.nTime = timestamp; }
void setgenesis(CBlock &block) { genesis = block; }
void recalc_genesis(uint32_t nonce) { genesis = CreateGenesisBlock(ASSETCHAINS_TIMESTAMP, nonce, GENESIS_NBITS, 1, COIN); };

Loading…
Cancel
Save